Browse Source

Added self check for updates

Joachim M. Giæver 5 years ago
parent
commit
e1d841776f
1 changed files with 12 additions and 1 deletions
  1. 12 1
      bin/lxcbuild

+ 12 - 1
bin/lxcbuild

@@ -9,6 +9,17 @@ if [ "${CONTAINER_NAME}" != "$(basename $(pwd))" ]; then
 	exit 1
 fi
 
+CURRF="$(md5sum "${0}")"
+
+git pull
+
+if [ "${CURRF}" != "$(md5sum "${0}")" ]; then
+	cprint "File changes on last pull. Restarting..."
+	${SELF}
+	exit 1
+fi
+exit 1
+
 function cprint {
 	ERR='\033[0;31m'
 	OK='\033[0;32m'
@@ -130,7 +141,7 @@ if [ $? -ne 0 ]; then
 	lxc file push "$(pwd)" "${CONTAINER_NAME}/$(container_home)" -rq
 else
 	cprint "Pulling repo"
-	git pull
+	container_snap_sh "git pull"
 fi
 
 TAG=$(git tag | tail -n 1)