Skip to content

Commit

Permalink
fix unable uninstall in script issue
Browse files Browse the repository at this point in the history
  • Loading branch information
john-shine committed Feb 9, 2020
1 parent aeec902 commit 571ec0b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.3
1.0.4
11 changes: 9 additions & 2 deletions scripts/preuninst
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@
echo 'start remove docker baidunetdisk container.' >> "${SYNOPKG_PKGDEST}/package/logs/output.log"

container_id=$(cat "${SYNOPKG_PKGDEST}/package/cid")
if [ -z $container_id ]; then
# if container not exist, just exit
exit 0
fi

container_name=$(docker ps --filter "id=${container_id}" --format "{{.Names}}")

docker stop -t 0 $container_id 2>>"${SYNOPKG_PKGDEST}/package/logs/output.log"
docker rm -f $container_id >> "${SYNOPKG_PKGDEST}/package/logs/output.log" 2>&1
ret=$?

if [ -f "/usr/local/etc/services.d/docker_${container_name}.sc" ]; then
rm -f "/usr/local/etc/services.d/docker_${container_name}.sc"
if [ ! -z $container_name]; then
if [ -f "/usr/local/etc/services.d/docker_${container_name}.sc" ]; then
rm -f "/usr/local/etc/services.d/docker_${container_name}.sc"
fi
fi

exit $ret

0 comments on commit 571ec0b

Please sign in to comment.