]> git.proxmox.com Git - mirror_smartmontools-debian.git/blob - os_darwin/pkg/root/usr/local/sbin/smart-pkg-uninstall
Imported Upstream version 6.4+svn4214
[mirror_smartmontools-debian.git] / os_darwin / pkg / root / usr / local / sbin / smart-pkg-uninstall
1 #!/bin/sh
2
3 echo "Smartmontools package uninstaller:"
4
5 # check if we are running with root uid
6 if [[ $EUID -ne 0 ]]; then
7 echo " Error: this script must be run as root"
8 exit 1
9 fi
10
11 # check if package is installed
12 pkgutil --info com.smartmontools.pkg > /dev/null 2>/dev/null
13 if [ $? -ne 0 ]; then
14 echo " Error: smartmontools package is not installed"
15 exit 1
16 fi
17
18 # smartmontools pkg could be installed only on system volume, so this should be safe
19 cd /
20
21 echo " - removing files"
22 for str in `pkgutil --files com.smartmontools.pkg`
23 do
24 if [ -f "$str" ]
25 then
26 rm -f "$str"
27 fi
28 done
29 echo " - removing empty directories"
30 for str in `pkgutil --files com.smartmontools.pkg`
31 do
32 if [ -d "$str" ]
33 then
34 rmdir -p "$str" 2>/dev/null
35 fi
36 done
37
38 echo " - removing package system entry"
39 pkgutil --forget com.smartmontools.pkg
40 echo "Done, smartmontolls package removed"