-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsoftware
executable file
·67 lines (57 loc) · 1.28 KB
/
software
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash -e
# Simple script to do installation and uninstallation.
# A bad excuse for not doing a proper package
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
PackageName=openhab_tellstick
Destination=/opt/$PackageName
DestinationBin=$Destination/bin
InitDir=/etc/init.d
usage()
{
echo "$0 [ install|update|uninstall ]
}
errExit()
{
echo "$1"
echo
usage
exit 1
}
doUpdate()
{
service openhab_tellstick stop
cp ./openhab_tellstick $InitDir
chmod 755 $InitDir/openhab_tellstick
cp ./openhab_tellstick_inbound $DestinationBin
service openhab_tellstick start
}
doInstall()
{
install -d "$DestinationBin"
cp ./openhab_tellstick $InitDir
chmod 755 $InitDir/openhab_tellstick
update-rc.d openhab_tellstick defaults
cp ./openhab_tellstick_inbound $DestinationBin
service openhab_tellstick start
}
doUnInstall()
{
service openhab_tellstick stop
update-rc.d -f openhab_tellstick remove
rm -rf "$Destination"
rm $InitDir/openhab_tellstick
}
#set -x
if [ "$1" == "install" ]; then
doInstall
elif [ "$1" == "uninstall" ]; then
doUnInstall
elif [ "$1" == "update" ]; then
doUpdate
else
errExit "Option '$1' not supported"
fi