add an init option to twlight_update_code.sh
@@ -6,6 +6,11 @@ then
source /etc/environment
fi
+if [ "${1}" = "init" ]
+then
+ init="true"
+fi
+
# Check the remote status.
cd ${TWLIGHT_HOME}
git fetch
@@ -17,12 +22,7 @@ local=$(git rev-parse @)
remote=$(git rev-parse "$upstream")
base=$(git merge-base @ "$upstream")
-if [ $local = $remote ]; then
- echo "Up-to-date"
- exit 0
-elif [ $local = $base ]; then
- echo "Need to pull"
-
+update() {
venv_update_cmd="${TWLIGHT_HOME}/bin/./virtualenv_update.sh >>${TWLIGHT_HOME}/TWLight/logs/update.log 2>&1"
venv_test_cmd="${TWLIGHT_HOME}/bin/./virtualenv_test.sh >>${TWLIGHT_HOME}/TWLight/logs/test.log 2>&1"
@@ -42,7 +42,21 @@ elif [ $local = $base ]; then
else
exit 1
fi
-elif [ $remote = $base ]; then
+}
+
+if [ "${init}" = "true" ]
+then
+ echo "Init"
+ update
+elif [ "${local}" = "${remote}" ]
+then
+ echo "Up-to-date"
+elif [ "${local}" = "${base}" ]
+then
+ echo "Need to pull"
+ update
+elif [ "${remote}" = "${base}" ]
+then
echo "Need to push"
exit 1
else
