mirror of
https://github.com/arkenfox/user.js.git
synced 2025-05-24 00:07:10 +02:00
Update updater.sh
- by moving `cd "$ff_profile"` to the Execute section we don't need to restore working directory if we hit the Exit 0 in File Handling - return 1 in confirmation() instead of exit and chained with `&& update_userjs` is functionally identical but always cleans up userjs_temps and restores the original working directory
This commit is contained in:
parent
f0e21c674c
commit
c12f6cda26
1 changed files with 8 additions and 8 deletions
14
updater.sh
14
updater.sh
|
@ -31,9 +31,8 @@ currdir=$(pwd)
|
||||||
sfp=$(readlink -f "${BASH_SOURCE[0]}" 2>/dev/null || greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null)
|
sfp=$(readlink -f "${BASH_SOURCE[0]}" 2>/dev/null || greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null)
|
||||||
## fallback for Macs without coreutils
|
## fallback for Macs without coreutils
|
||||||
if [ -z "$sfp" ]; then sfp=${BASH_SOURCE[0]}; fi
|
if [ -z "$sfp" ]; then sfp=${BASH_SOURCE[0]}; fi
|
||||||
## change directory to the Firefox profile directory
|
## store the Firefox profile directory
|
||||||
ff_profile="$(dirname "${sfp}")"
|
ff_profile="$(dirname "${sfp}")"
|
||||||
cd $ff_profile
|
|
||||||
|
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
|
@ -48,7 +47,7 @@ elif [[ $(command -v "wget") ]] > /dev/null 2>&1; then
|
||||||
elif [[ $(command -v "perl") ]]; then
|
elif [[ $(command -v "perl") ]]; then
|
||||||
DOWNLOAD_METHOD="perl"
|
DOWNLOAD_METHOD="perl"
|
||||||
else
|
else
|
||||||
echo -e ${RED}"This script requires curl, wget, or pearl to be installed.\nProcess aborted"${NC}
|
echo -e ${RED}"This script requires curl, wget or perl to be installed.\nProcess aborted"${NC}
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -119,7 +118,7 @@ confirmation () {
|
||||||
|
|
||||||
if [[ $REPLY =~ ^[Nn]$ ]]; then
|
if [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||||
echo -e ${RED}"Process aborted"${NC}
|
echo -e ${RED}"Process aborted"${NC}
|
||||||
exit 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +132,6 @@ get_updater_version () {
|
||||||
filename=$1
|
filename=$1
|
||||||
version_regex='5 s/.*[[:blank:]]\([[:digit:]]*\.[[:digit:]]*\)/\1/p'
|
version_regex='5 s/.*[[:blank:]]\([[:digit:]]*\.[[:digit:]]*\)/\1/p'
|
||||||
echo "$(sed -n "$version_regex" "${ff_profile}/${filename}")"
|
echo "$(sed -n "$version_regex" "${ff_profile}/${filename}")"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Update updater.sh
|
# Update updater.sh
|
||||||
|
@ -196,9 +194,11 @@ update_userjs () {
|
||||||
# Execute #
|
# Execute #
|
||||||
#########################
|
#########################
|
||||||
|
|
||||||
|
## change directory to the Firefox profile directory
|
||||||
|
cd "$ff_profile"
|
||||||
|
|
||||||
initiate
|
initiate
|
||||||
update_updater
|
update_updater
|
||||||
confirmation
|
confirmation && update_userjs
|
||||||
update_userjs
|
|
||||||
rm -rf userjs_temps
|
rm -rf userjs_temps
|
||||||
cd "${currdir}"
|
cd "${currdir}"
|
Loading…
Add table
Add a link
Reference in a new issue