Add cleanup function to make the build.sh more robust

This commit is contained in:
wizard
2015-03-06 12:04:42 +08:00
parent c80ef5de60
commit ca16a57b54
2 changed files with 9 additions and 3 deletions

View File

@@ -17,9 +17,15 @@
# Download the etcd, flannel, and K8s binaries automatically
# Run as root only
# author @resouer
# author @resouer @WIZARD-CXY
set -e
function cleanup {
# cleanup work
rm -rf flannel kubernetes* etcd* binaries
}
trap cleanup SIGHUP SIGINT SIGTERM
# check root
if [ "$(id -u)" != "0" ]; then
echo >&2 "Please run as root"