-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·62 lines (56 loc) · 1.29 KB
/
install
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
#!/bin/bash
_check_for_sudo()
{
if [ $USER != "root" ]; then
echo "Installation requires root privileges. Use sudo."
return 1
fi
return 0
}
_install()
{
local -i result
install -D --mode=755 scrape /usr/local/lib/scrape/scrape
result=$?
if [ $result -eq 0 ]; then
install -D --mode=644 sanitize.xsl /usr/local/lib/scrape/sanitize.xsl
cp -sf /usr/local/lib/scrape/scrape /usr/local/bin/scrape
echo "Successfully installed."
else
echo "Failed to copy files, result=$result"
fi
}
_uninstall()
{
local -i result
rm -f /usr/local/bin/scrape
result=$?
if [ $result -eq 0 ]; then
rm -fr /usr/local/lib/scrape
echo "Successfully un-installed."
else
echo "Failed to uninstall, result=$result"
fi
}
_show_usage()
{
echo "To install the python executable, scrape, and the companion"
echo "stylesheet, sanitize.xsl, simply run this program."
echo
echo "To uninstall, type:"
echo "./install --uninstall"
echo
echo "To see this help page, type:"
echo "./install --help"
}
if [ $# -lt 1 ]; then
if _check_for_sudo; then
_install
fi
elif [ $# -eq 1 -a $2=="--uninstall" ]; then
if _check_for_sudo; then
_uninstall
fi
else
_show_usage
fi