File: prerm

package info (click to toggle)
linpopup 1.2.0-7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 600 kB
  • ctags: 251
  • sloc: ansic: 2,885; sh: 250; makefile: 223
file content (36 lines) | stat: -rw-r--r-- 746 bytes parent folder | download | duplicates (4)
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
#!/bin/sh

set -e

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