Skip to content

Commit

Permalink
fix fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
ipitio committed Jan 25, 2024
1 parent 0c9e219 commit b6ab4f3
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions mod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ help() {
setTags() {
local path=${1-}
local name=${2-}

if [ ! -z "$path" ]; then
cd "$path"
git fetch --tags -q
git fetch origin -q
git fetch --tags -f -q
latestTag=$(git describe --tags $(git rev-list --tags --max-count=1))
fi
if [ ! -z "$name" ]; then
Expand All @@ -30,7 +30,6 @@ download() {
local url=$3
local src=${4-}
local dest=$path/$name

if [ ! -d $dest ]; then # replicate
cd "$path"
rm -rf "$name"
Expand All @@ -47,8 +46,12 @@ download() {
if [ ! -z "$src" ]; then
if [ "$url" != "old" ]; then
git config --global --add safe.directory "$dest"
git remote -v | grep -q "old" || git remote rename origin old
git remote -v | grep -q "origin" && git remote remove origin
if ! git remote -v | grep -q "old"; then
git remote rename origin old
fi
if git remote -v | grep -q "origin"; then
git remote remove origin
fi
git remote add origin $url
else
git remote rename origin new
Expand Down Expand Up @@ -206,6 +209,11 @@ uninstall() {
}

abort() {
if (( $aborted == 1 )); then
exit 1
fi
aborted=1

echo "$(date) - Process Aborting..." | sudo tee -a /var/log/pimod.log

if [ -f /opt/pihole/webpage.sh.bak ]; then
Expand Down Expand Up @@ -252,8 +260,10 @@ main() {
sudo "$0" "$@"
exit $?
fi
aborted=0
set -Eeuo pipefail
trap '[ "$?" -eq "0" ] && commit || abort $op' EXIT
trap '[ "$?" -eq "0" ] && commit || abort' EXIT
trap 'abort' INT TERM ERR

local db=$([ "$op" == "up" ] && echo "${3-}" || [ "$op" == "un" ] && echo "${2-}" || echo "$op")
case $op in
Expand Down

0 comments on commit b6ab4f3

Please sign in to comment.