~ubuntu-branches/ubuntu/precise/pastebinit/precise

« back to all changes in this revision

Viewing changes to debian/pastebinit.preinst

  • Committer: Bazaar Package Importer
  • Author(s): Rolf Leggewie
  • Date: 2011-07-04 09:48:21 UTC
  • mfrom: (7.1.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20110704094821-024scpcp0i741wdz
Tags: 1.2-3
update to latest Debian policy and release to unstable pocket
(no further changes necessary)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh -e
 
2
 
 
3
# Drop unchanged conffiles in deprecated location without triggering a dpkg question
 
4
# c.f. LP: #621923 and http://wiki.debian.org/DpkgConffileHandling
 
5
# BEGIN FIXME: use dpkg-maintscript-helper when my main OS supports it
 
6
 
 
7
prep_mv_conffile() {
 
8
    local PKGNAME="$1"
 
9
    local CONFFILE="$2"
 
10
 
 
11
    [ -e "$CONFFILE" ] || return 0
 
12
 
 
13
    local md5sum="$(md5sum $CONFFILE | sed -e 's/ .*//')"
 
14
    local old_md5sum="$(dpkg-query -W -f='${Conffiles}' $PKGNAME | \
 
15
            sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")"
 
16
    if [ "$md5sum" = "$old_md5sum" ]; then
 
17
        rm -f "$CONFFILE"
 
18
    fi
 
19
}
 
20
 
 
21
case "$1" in
 
22
install|upgrade)
 
23
    if dpkg --compare-versions "$2" lt "1.2-1"; then
 
24
        prep_mv_conffile pastebinit "/etc/pastebin.d/fpaste.org.conf"
 
25
        prep_mv_conffile pastebinit "/etc/pastebin.d/paste2.org.conf"
 
26
        prep_mv_conffile pastebinit "/etc/pastebin.d/pastebin.ca.conf"
 
27
        prep_mv_conffile pastebinit "/etc/pastebin.d/pastebin.com.conf"
 
28
        prep_mv_conffile pastebinit "/etc/pastebin.d/paste.debian.net.conf"
 
29
        prep_mv_conffile pastebinit "/etc/pastebin.d/paste.ubuntu.com.conf"
 
30
        prep_mv_conffile pastebinit "/etc/pastebin.d/pastie.org.conf"
 
31
        prep_mv_conffile pastebinit "/etc/pastebin.d/slexy.org.conf"
 
32
        prep_mv_conffile pastebinit "/etc/pastebin.d/stikked.com.conf"
 
33
        prep_mv_conffile pastebinit "/etc/pastebin.d/yourpaste.net.conf"
 
34
    fi
 
35
esac
 
36
 
 
37
# END FIXME
 
38
 
 
39
exit 0