Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush Tiwari
slapos.package
Commits
39a7ae8c
Commit
39a7ae8c
authored
Sep 17, 2013
by
Jondy Zhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refine slapos-cleanup.sh with csih_inform
parent
0d0f797f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
33 deletions
+33
-33
windows/scripts/slapos-cleanup.sh
windows/scripts/slapos-cleanup.sh
+33
-33
No files found.
windows/scripts/slapos-cleanup.sh
View file @
39a7ae8c
...
@@ -32,9 +32,9 @@ readonly -f show_usage
...
@@ -32,9 +32,9 @@ readonly -f show_usage
function
slapos_kill_process
()
function
slapos_kill_process
()
{
{
name
=
$1
name
=
$1
echo
"Try to kill all
$name
..."
csih_inform
"Try to kill all
$name
..."
for
pid
in
$(
ps |
grep
"
$name
"
| gawk
'{print $4}'
)
;
do
for
pid
in
$(
ps |
grep
"
$name
"
| gawk
'{print $4}'
)
;
do
echo
"Kill pid
$pid
"
csih_inform
"Kill pid
$pid
"
TASKKILL /F /T /PID
$pid
TASKKILL /F /T /PID
$pid
done
done
}
}
...
@@ -43,7 +43,7 @@ readonly -f slapos_kill_process
...
@@ -43,7 +43,7 @@ readonly -f slapos_kill_process
# -----------------------------------------------------------
# -----------------------------------------------------------
# Start script
# Start script
# -----------------------------------------------------------
# -----------------------------------------------------------
echo
"Start cleanup slapos node ..."
csih_inform
"Start cleanup slapos node ..."
echo
""
echo
""
while
test
$#
-gt
0
;
do
while
test
$#
-gt
0
;
do
...
@@ -73,16 +73,16 @@ done
...
@@ -73,16 +73,16 @@ done
#
#
for
name
in
${
re6stnet_service_name
}
${
cron_service_name
}
\
for
name
in
${
re6stnet_service_name
}
${
cron_service_name
}
\
${
syslog_service_name
}
${
cygserver_service_name
}
;
do
${
syslog_service_name
}
${
cygserver_service_name
}
;
do
echo
"Removing service
$name
"
csih_inform
"Removing service
$name
"
cygrunsrv
-R
$name
&&
echo
OK.
cygrunsrv
-R
$name
&&
csih_inform
"OK."
done
done
#
#
# Stop slapos
# Stop slapos
#
#
if
[[
-x
/opt/slapos/bin/slapos
]]
;
then
if
[[
-x
/opt/slapos/bin/slapos
]]
;
then
echo
"Stopping slapos node ..."
csih_inform
"Stopping slapos node ..."
/opt/slapos/bin/slapos node stop all
&&
echo
OK.
/opt/slapos/bin/slapos node stop all
&&
csih_inform
"OK."
fi
fi
slapos_kill_process /usr/bin/python2.7
slapos_kill_process /usr/bin/python2.7
...
@@ -93,68 +93,68 @@ slapos_kill_process /usr/bin/python2.7
...
@@ -93,68 +93,68 @@ slapos_kill_process /usr/bin/python2.7
#
#
# Remove virtual netcard installed by slapos
# Remove virtual netcard installed by slapos
#
#
echo
"Removing network connection
${
slapos_ifname
}
"
csih_inform
"Removing network connection
${
slapos_ifname
}
"
ipwin remove
*
msloop
${
slapos_ifname
}
&&
echo
OK.
ipwin remove
*
msloop
${
slapos_ifname
}
&&
csih_inform
"OK."
echo
"Removing all Tap-Windows Drivers ..."
csih_inform
"Removing all Tap-Windows Drivers ..."
which devcon
>
/dev/null 2>&1
&&
devcon remove tap0901
&&
echo
OK.
which devcon
>
/dev/null 2>&1
&&
devcon remove tap0901
&&
csih_inform
"OK."
#
#
# Remove configure files
# Remove configure files
#
#
echo
Removing /etc/opt/slapos
csih_inform
Removing /etc/opt/slapos
rm
-rf
/etc/opt/slapos/
&&
echo
OK.
rm
-rf
/etc/opt/slapos/
&&
csih_inform
"OK."
echo
Removing ~/.slapos
csih_inform
Removing ~/.slapos
rm
-rf
~/.slapos
&&
echo
OK.
rm
-rf
~/.slapos
&&
csih_inform
"OK."
#
#
# Remove crontab
# Remove crontab
#
#
_filename
=
/var/cron/tabs/
${
slapos_administrator
}
_filename
=
/var/cron/tabs/
${
slapos_administrator
}
echo
"Removing
${
_filename
}
"
csih_inform
"Removing
${
_filename
}
"
rm
-rf
${
_filename
}
&&
echo
OK.
rm
-rf
${
_filename
}
&&
csih_inform
"OK."
#
#
# Remove default instance root and software root, because they belong to
# Remove default instance root and software root, because they belong to
# slapuser, and would not be removed by the windows uninstaller.
# slapuser, and would not be removed by the windows uninstaller.
#
#
[[
-
f
/srv/slapgrid
]]
&&
echo
"Removing /srv/slapgrid"
&&
rm
-rf
/srv/slapgrid
&&
echo
OK.
[[
-
d
/srv/slapgrid
]]
&&
csih_inform
"Removing /srv/slapgrid"
&&
rm
-rf
/srv/slapgrid
&&
csih_inform
"OK."
[[
-
f
/opt/slapgrid
]]
&&
echo
"Removing /opt/slapgrid"
&&
rm
-rf
/opt/slapgrid
&&
echo
OK.
[[
-
d
/opt/slapgrid
]]
&&
csih_inform
"Removing /opt/slapgrid"
&&
rm
-rf
/opt/slapgrid
&&
csih_inform
"OK."
#
#
# Remove users installed by slapos
# Remove users installed by slapos
#
#
[[
-
f
/var/empty
]]
&&
echo
"Removing /var/empty"
&&
rm
-rf
/var/empty
&&
echo
OK.
[[
-
d
/var/empty
]]
&&
csih_inform
"Removing /var/empty"
&&
rm
-rf
/var/empty
&&
csih_inform
"OK."
for
_name
in
$(
NET USER
)
;
do
for
_name
in
$(
NET USER
)
;
do
if
[[
"
${
_name
}
"
==
${
slapos_user_basename
}*
]]
;
then
if
[[
"
${
_name
}
"
==
${
slapos_user_basename
}*
]]
;
then
echo
"Removing user:
${
_name
}
"
csih_inform
"Removing user:
${
_name
}
"
NET USER
${
_name
}
/DELETE
&&
echo
OK.
NET USER
${
_name
}
/DELETE
&&
csih_inform
"OK."
elif
echo
"
${
_name
}
"
|
grep
-q
-E
"(cyg_server)|(
${
slapos_administrator
}
)"
;
then
elif
echo
"
${
_name
}
"
|
grep
-q
-E
"(cyg_server)|(
${
slapos_administrator
}
)"
;
then
echo
"Removing user:
${
_name
}
"
csih_inform
"Removing user:
${
_name
}
"
NET USER
${
_name
}
/DELETE
&&
echo
OK.
NET USER
${
_name
}
/DELETE
&&
csih_inform
"OK."
fi
fi
done
done
echo
"Creating /etc/passwd ..."
csih_inform
"Creating /etc/passwd ..."
mkpasswd
-l
>
/etc/passwd
&&
echo
OK.
mkpasswd
-l
>
/etc/passwd
&&
csih_inform
"OK."
#
#
# Remove local group installed by slapos node
# Remove local group installed by slapos node
#
#
for
_name
in
$(
NET LOCALGROUP |
sed
-n
-e
"s/^*//p"
|
sed
-e
"s/
\\
s//g"
)
;
do
for
_name
in
$(
NET LOCALGROUP |
sed
-n
-e
"s/^*//p"
|
sed
-e
"s/
\\
s//g"
)
;
do
if
[[
"
${
_name
}
"
==
grp_
${
slapos_user_basename
}*
]]
;
then
if
[[
"
${
_name
}
"
==
grp_
${
slapos_user_basename
}*
]]
;
then
echo
"Removing localgroup:
${
_name
}
"
csih_inform
"Removing localgroup:
${
_name
}
"
NET LOCALGROUP
${
_name
}
/DELETE
&&
echo
OK.
NET LOCALGROUP
${
_name
}
/DELETE
&&
csih_inform
"OK."
fi
fi
done
done
echo
"Creating /etc/group ..."
csih_inform
"Creating /etc/group ..."
mkgroup
-l
>
/etc/group
&&
echo
OK.
mkgroup
-l
>
/etc/group
&&
csih_inform
"OK."
# -----------------------------------------------------------
# -----------------------------------------------------------
# End script
# End script
# -----------------------------------------------------------
# -----------------------------------------------------------
echo
echo
""
echo
Run pre-uninstall script complete.
csih_inform
Run pre-uninstall script complete.
echo
echo
""
read
-n
1
-t
60
-p
"Press any key to exit..."
read
-n
1
-t
60
-p
"Press any key to exit..."
exit
0
exit
0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment