File: vim-common.preinst

package info (click to toggle)
vim 1%3A7.0-122%2B1etch5
  • links: PTS
  • area: main
  • in suites: etch
  • size: 9,992 kB
  • ctags: 55
  • sloc: makefile: 444; sh: 224; perl: 97; python: 25
file content (39 lines) | stat: -rw-r--r-- 778 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash -e

remove_symlink () {
  if [ -L $1 ]; then
    rm $1
  fi
}

LASTVERSION="1:7.0-017+5"
prep_mv_conffile() {
    CONFFILE="$1"

    if [ -e "$CONFFILE" ]; then
        md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
        old_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $CONFFILE'{s/.* //;p}}\" /var/lib/dpkg/status`"
        if [ "$md5sum" = "$old_md5sum" ]; then
            rm -f "$CONFFILE"
        fi
    fi
}

case "$1" in
  install)
    if dpkg --compare-versions "$2" le "$LASTVERSION"; then
        prep_mv_conffile "/etc/vim/virc"
    fi
    ;;
  upgrade)
    remove_symlink /usr/share/doc/vim-common
    if dpkg --compare-versions "$2" le "$LASTVERSION"; then
        prep_mv_conffile "/etc/vim/virc"
    fi
    ;;
esac

#DEBHELPER#

exit 0