File: prerm

package info (click to toggle)
linpopup 1.2.0-8.3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 640 kB
  • ctags: 247
  • sloc: ansic: 2,885; sh: 259; makefile: 228
file content (38 lines) | stat: -rw-r--r-- 759 bytes parent folder | download
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
#!/bin/sh

set -e

#DEBHELPER#

SMBCONF=/etc/smb.conf
if [ -e /etc/samba/smb.conf ]; then
	SMBCONF=/etc/samba/smb.conf
fi

removefromsmbconf() {
    # undo what addtosmbconf did.
    perl -i -pe 's/^(\s*message command)/;linpopup-removed $1/;
                 s/^;removed-by-linpopup-install //' $SMBCONF
}

case "$1" in
    remove)
        search='^[^;].*message command.*linpopup '
        if grep -s "$search" $SMBCONF > /dev/null
        then
            echo -n "
Removing linpopup line in $SMBCONF..."
            removefromsmbconf
            echo ' done'
        fi
        ;;
    upgrade)
        ;;
    failed-upgrade)
        ;;
    deconfigure)
        ;;
    *)
        echo "prerm called with unexpected argument '$1', ignored."
        ;;
esac