Update run.sh

This commit is contained in:
2023-12-03 21:15:25 -06:00
parent f3b6557cbd
commit 90972d4a4a

52
run.sh
View File

@@ -31,29 +31,41 @@ if [ "${1}" == "update" ]; then
git submodule update --remote >/dev/null 2>&1
fi
cd ${NM_FOLDER}
if [ "`git log --pretty=%H ...refs/heads/master^ | head -n 1`" != "`git ls-remote origin -h refs/heads/master |cut -f1`" ]; then
# if [ "`git log --pretty=%H ...refs/heads/dev^ | head -n 1`" != "`git ls-remote origin -h refs/heads/dev |cut -f1`" ]; then
if [ "${2}" != "q" ]; then
if [ "`git log --pretty=%H ...refs/heads/master^ | head -n 1`" != "`git ls-remote origin -h refs/heads/master |cut -f1`" ]; then
goforup=0
if [ "$(${NM_SCRIPT} betacheck)" == "true" ]; then
echo -en "\e[1A";
echo -e "\e[0K\r ${idsCL[LightCyan]}Updating NodeMgmt...${idsCL[Default]}"
fi
git fetch origin master >/dev/null 2>&1
git reset --hard origin/master >/dev/null 2>&1
# git fetch origin dev >/dev/null 2>&1
# git reset --hard origin/dev >/dev/null 2>&1
git reflog expire --expire=now --all >/dev/null 2>&1
git repack -ad >/dev/null 2>&1
git prune >/dev/null 2>&1
git pull >/dev/null 2>&1
git submodule update --remote >/dev/null 2>&1
/bin/chmod +x /opt/idssys/nodemgmt/*.sh 2>&1
source ${NM_FOLDER}/defaults.inc
if [ "${2}" != "q" ]; then
echo -en "\e[1A";
echo -e "\e[0K\r ${idsCL[Green]}Updated to v${VERS}${idsCL[Default]}"
echo -en "\e[0K\r${idsCL[LightCyan]}This update is currently in BETA, proceed (N/y)? ${idsCL[Default]}"
read -n1 choice
case $choice in
[Yy]) goforup=1;;
esac
else
echo -e "${idsCL[Green]}Updated to v${VERS}${idsCL[Default]}"
goforup=1
fi
if [ ${goforup} -eq 1 ]; then
if [ "${2}" != "q" ]; then
echo -en "\e[1A";
echo -e "\e[0K\r ${idsCL[LightCyan]}Updating NodeMgmt...${idsCL[Default]}"
fi
git fetch origin master >/dev/null 2>&1
git reset --hard origin/master >/dev/null 2>&1
# git fetch origin dev >/dev/null 2>&1
# git reset --hard origin/dev >/dev/null 2>&1
git reflog expire --expire=now --all >/dev/null 2>&1
git repack -ad >/dev/null 2>&1
git prune >/dev/null 2>&1
git pull >/dev/null 2>&1
git submodule update --remote >/dev/null 2>&1
/bin/chmod +x /opt/idssys/nodemgmt/*.sh 2>&1
source ${NM_FOLDER}/defaults.inc
if [ "${2}" != "q" ]; then
echo -en "\e[1A";
echo -e "\e[0K\r ${idsCL[Green]}Updated to v${VERS}${idsCL[Default]}"
else
echo -e "${idsCL[Green]}Updated to v${VERS}${idsCL[Default]}"
fi
fi
elif [ "${2}" != "q" ]; then