mirror of
https://github.com/arkenfox/user.js.git
synced 2025-04-22 00:19:28 -04: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
16
updater.sh
16
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)
|
||||
## fallback for Macs without coreutils
|
||||
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}")"
|
||||
cd $ff_profile
|
||||
|
||||
|
||||
#########################
|
||||
@ -48,7 +47,7 @@ elif [[ $(command -v "wget") ]] > /dev/null 2>&1; then
|
||||
elif [[ $(command -v "perl") ]]; then
|
||||
DOWNLOAD_METHOD="perl"
|
||||
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
|
||||
fi
|
||||
|
||||
@ -119,7 +118,7 @@ confirmation () {
|
||||
|
||||
if [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||
echo -e ${RED}"Process aborted"${NC}
|
||||
exit 1
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
@ -133,7 +132,6 @@ get_updater_version () {
|
||||
filename=$1
|
||||
version_regex='5 s/.*[[:blank:]]\([[:digit:]]*\.[[:digit:]]*\)/\1/p'
|
||||
echo "$(sed -n "$version_regex" "${ff_profile}/${filename}")"
|
||||
|
||||
}
|
||||
|
||||
# Update updater.sh
|
||||
@ -196,9 +194,11 @@ update_userjs () {
|
||||
# Execute #
|
||||
#########################
|
||||
|
||||
## change directory to the Firefox profile directory
|
||||
cd "$ff_profile"
|
||||
|
||||
initiate
|
||||
update_updater
|
||||
confirmation
|
||||
update_userjs
|
||||
confirmation && update_userjs
|
||||
rm -rf userjs_temps
|
||||
cd "${currdir}"
|
||||
cd "${currdir}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user