Update run.sh
This commit is contained in:
@@ -36,17 +36,26 @@ if [[ "${noupdate}" != *" ${1:-} "* ]] && [[ "${noupdate}" != *" ${2:-} "* ]]; t
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cd /opt/idssys/ta-proxmenu
|
cd /opt/idssys/ta-proxmenu
|
||||||
if [ "$(git rev-parse HEAD)" != "$(git ls-remote origin refs/heads/main | cut -f1)" ]; then
|
current_branch="$(git branch --show-current)"
|
||||||
|
remote_commit=""
|
||||||
|
if [ -n "$current_branch" ]; then
|
||||||
|
remote_commit="$(git ls-remote origin "refs/heads/${current_branch}" | cut -f1)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$current_branch" ]; then
|
||||||
|
echo -e "${idsCL[Red]}TA-Proxmenu is in a detached HEAD state; automatic updates were skipped${idsCL[Default]}"
|
||||||
|
elif [ -z "$remote_commit" ]; then
|
||||||
|
echo -e "${idsCL[Red]}Could not find branch '${current_branch}' on the TA-Proxmenu origin; automatic updates were skipped${idsCL[Default]}"
|
||||||
|
elif [ "$(git rev-parse HEAD)" != "$remote_commit" ]; then
|
||||||
if [ "${1}" != "tapm" ]; then
|
if [ "${1}" != "tapm" ]; then
|
||||||
[ ${udtd} -eq 0 ] && echo -en "\e[1A";
|
[ ${udtd} -eq 0 ] && echo -en "\e[1A";
|
||||||
echo -en "\e[0K\r${idsCL[LightCyan]}Updating TA-Proxmenu...${idsCL[Default]}"
|
echo -en "\e[0K\r${idsCL[LightCyan]}Updating TA-Proxmenu (${current_branch})...${idsCL[Default]}"
|
||||||
fi
|
fi
|
||||||
git fetch origin main >/dev/null 2>&1
|
git fetch origin "$current_branch" >/dev/null 2>&1
|
||||||
git reset --hard origin/main >/dev/null 2>&1
|
git reset --hard "origin/${current_branch}" >/dev/null 2>&1
|
||||||
git reflog expire --expire=now --all >/dev/null 2>&1
|
git reflog expire --expire=now --all >/dev/null 2>&1
|
||||||
git repack -ad >/dev/null 2>&1
|
git repack -ad >/dev/null 2>&1
|
||||||
git prune >/dev/null 2>&1
|
git prune >/dev/null 2>&1
|
||||||
git pull >/dev/null 2>&1
|
|
||||||
|
|
||||||
if [ "${1}" != "tapm" ]; then
|
if [ "${1}" != "tapm" ]; then
|
||||||
source /opt/idssys/ta-proxmenu/defaults.inc
|
source /opt/idssys/ta-proxmenu/defaults.inc
|
||||||
|
|||||||
Reference in New Issue
Block a user