-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcopy-util.sh
executable file
·87 lines (72 loc) · 2.06 KB
/
copy-util.sh
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
function diffFunc {
set -x
diff -s ./scripts/html/adverb.html /var/www/html/adverb.html
diff -s ./scripts/cgi-bin/adverb-cgi.py /var/www/cgi-bin/adverb-cgi.py
diff -s ./scripts/adverb.py /var/www/cgi-bin/adverb/scripts/adverb.py
}
function putFunc {
set -x
cp -i ./scripts/html/adverb.html /var/www/html/adverb.html
cp -i ./scripts/cgi-bin/adverb-cgi.py /var/www/cgi-bin/adverb-cgi.py
cp -i ./scripts/adverb.py /var/www/cgi-bin/adverb/scripts/adverb.py
}
function installFunc {
set -x
mkdir /var/www/cgi-bin/adverb
mkdir /var/www/cgi-bin/adverb/scripts
cp ./scripts/html/adverb.html /var/www/html/adverb.html
cp ./scripts/cgi-bin/adverb-cgi.py /var/www/cgi-bin/adverb-cgi.py
cp ./scripts/adverb.py /var/www/cgi-bin/adverb/scripts/adverb.py
selinuxenabled
if [[ $? == 0 ]]; then
chcon -t httpd_sys_content_t /var/www/html/adverb.html
chcon -t httpd_unconfined_script_exec_t /var/www/cgi-bin/adverb-cgi.py
chcon -t httpd_unconfined_script_exec_t /var/www/cgi-bin/adverb/scripts/adverb.py
fi
}
function installIndexFunc {
set -x
installFunc
cp ./scripts/html/adverb.html /var/www/html/index.html
selinuxenabled
if [[ $? == 0 ]]; then
chcon -t httpd_sys_content_t /var/www/html/index.html
fi
}
function getFunc {
set -x
cp -i /var/www/html/adverb.html ./scripts/html/adverb.html
cp -i /var/www/cgi-bin/adverb-cgi.py ./scripts/cgi-bin/adverb-cgi.py
cp -i /var/www/cgi-bin/adverb/scripts/adverb.py ./scripts/adverb.py
}
if [ $# -eq 0 ]; then
diffFunc
exit 0
fi
if [ -z "$1" ]; then
diffFunc
exit 0
fi
if [ "$1" == "diff" ]; then
diffFunc
exit 0
fi
if [ "$1" == "get" ]; then
getFunc
exit 0
fi
if [ "$1" == "put" ]; then
putFunc
exit 0
fi
if [ "$1" == "install" ]; then
installFunc
exit 0
fi
if [ "$1" == "installindex" ]; then
installIndexFunc
exit 0
fi
echo "unknown arg $1"
exit 1