File: postrm

package info (click to toggle)
firestarter 1.0.3-11
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 6,548 kB
  • sloc: ansic: 14,749; sh: 8,068; makefile: 187
file content (31 lines) | stat: -rw-r--r-- 784 bytes parent folder | download | duplicates (3)
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
#!/bin/bash
set -e

if [ "$1" = "purge" ]; then
	rm -rf /etc/firestarter

	DHCP_HOOK=/etc/dhclient-exit-hooks
	FS_ADDED_LINE="sh /etc/init.d/firestarter start"
	if [ -r $DHCP_HOOK -a -w $DHCP_HOOK ]; then
	  if grep "${FS_ADDED_LINE}" ${DHCP_HOOK} >/dev/null; then
	    TMP=`mktemp -q`
	    if grep -v "${FS_ADDED_LINE}" $DHCP_HOOK > $TMP; then
	      # replace /etc/dhclient-exit-hooks with
	      # itself "purged" (and remove temporary file)
	      mv $TMP $DHCP_HOOK
	    else
	      if [ $? -eq 1 ]; then
	        # /etc/dhclient-exit-hooks is empty, as it was filled
		# with only the firestarter hook, we can remove it.
	        rm -f $DHCP_HOOK
	      fi
	      # remove temporary file
	      rm -f $TMP
	    fi
	  fi
	fi

	rm -f /etc/ppp/ip-up.d/1firestarter
fi

#DEBHELPER#