~ubuntu-branches/ubuntu/trusty/firestarter/trusty

« back to all changes in this revision

Viewing changes to debian/preinst

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Le Folgoc
  • Date: 2007-04-10 11:52:55 UTC
  • Revision ID: james.westby@ubuntu.com-20070410115255-exy4bey2g2gzmfuw
Tags: 1.0.3-2ubuntu1
* Merge from debian unstable. (fixes removal/purge issue, see LP: #83728)
* Remaining Ubuntu changes:
  + Add "GNOME" to .desktop Categories (closes Ubuntu #42452, #42501)
  + Don't run browser as root (closes Ubuntu #569)
  + debian/firestarter.init: apply patch from Daniel Robitaille adding
    lsb-base functions. Thanks also to Lionel Le Folgoc for taking note of
    this. (Closes: Malone #34217)
* Adhere to DebianMaintainerField.
* debian/postinst: use /bin/bash instead of /bin/sh (possible bashism).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
 
1
#!/bin/bash
2
2
set -e
3
3
 
4
4
if [ "$1" = "install" ] || [ "$1" = "upgrade" ]; then
27
27
                #considered as a configuration file
28
28
                mkdir /etc/firestarter
29
29
                cp -f /etc/firestarter.old/non-routables /etc/firestarter/non-routables
30
 
        fi
31
 
fi
32
 
 
33
 
if [ "$1" = "install" ] || [ "$1" = "upgrade" ]; then
34
 
        #remove /etc/ppp/ip-up.local only if firestarter hook
35
 
        #is the only one contained in it.
36
 
 
37
 
        if [ -e /etc/ppp/ip-up.local ]; then
38
 
                grep -v "firestarter\|^PATH" /etc/ppp/ip-up.local >/dev/null
39
 
                if [ $? -eq 1 ]; then
40
 
                        #we can remove safely /etc/ppp/ip-up.local
41
 
                        rm -f /etc/ppp/ip-up.local
42
 
                fi
43
 
        fi
44
 
 
45
 
        DHCP_HOOK=/etc/dhclient-exit-hooks
46
 
        if [ -e $DHCP_HOOK ] && grep firestarter $DHCP_HOOK >/dev/null; then
47
 
                TMP=`mktemp -q` && awk '
48
 
                /PATH=\$PATH:\/sbin:\/usr\/sbin:\/bin:\/usr\/bin/ {
49
 
                        #firestarter <= 0.9.3
50
 
                        path_line = $0;
51
 
                        getline;
52
 
 
53
 
                        #if PATH... is used for firestarter then
54
 
                        #we remove PATH line and the next line (firestarter hook)
55
 
                        #else we keep these lines
56
 
                        if ($0 != "sh /etc/firestarter/firewall.sh")
57
 
                        {
58
 
                                print path_line;
59
 
                                print $0;
60
 
                        }               
61
 
                        next;
62
 
                }
63
 
                /sh \/etc\/firestarter\/firewall.sh/ {
64
 
                        #firestarter <= 0.9.3
65
 
                        next;
66
 
                }
67
 
                {print $0;}' < $DHCP_HOOK > $TMP && mv $TMP $DHCP_HOOK
 
30
        
 
31
                #remove /etc/ppp/ip-up.local only if firestarter hook
 
32
                #is the only one contained in it.
 
33
 
 
34
                if [ -w /etc/ppp/ip-up.local ]; then
 
35
                        if grep -v "firestarter\|^PATH" /etc/ppp/ip-up.local >/dev/null; then
 
36
                                #TODO: fix this condition
 
37
                                eval    
 
38
                        else
 
39
                                if [ $? -eq 1 ]; then
 
40
                                        #we can remove safely /etc/ppp/ip-up.local
 
41
                                        rm -f /etc/ppp/ip-up.local
 
42
                                fi
 
43
                        fi
 
44
                fi
 
45
 
 
46
                DHCP_HOOK=/etc/dhclient-exit-hooks
 
47
                if [ -w $DHCP_HOOK ] && grep firestarter $DHCP_HOOK >/dev/null; then
 
48
                        TMP=`mktemp -q` && awk '
 
49
                        /PATH=\$PATH:\/sbin:\/usr\/sbin:\/bin:\/usr\/bin/ {
 
50
                                #firestarter <= 0.9.3
 
51
                                path_line = $0;
 
52
                                getline;
 
53
 
 
54
                                #if PATH... is used for firestarter then
 
55
                                #we remove PATH line and the next line (firestarter hook)
 
56
                                #else we keep these lines
 
57
                                if ($0 != "sh /etc/firestarter/firewall.sh")
 
58
                                {
 
59
                                        print path_line;
 
60
                                        print $0;
 
61
                                }               
 
62
                                next;
 
63
                        }
 
64
                        /sh \/etc\/firestarter\/firewall.sh/ {
 
65
                                #firestarter <= 0.9.3
 
66
                                next;
 
67
                        }
 
68
                        {print $0;}' < $DHCP_HOOK > $TMP && mv $TMP $DHCP_HOOK
 
69
                fi
68
70
        fi
69
71
fi
70
72