mirror of
https://github.com/arkenfox/user.js.git
synced 2025-05-03 23:43:40 +02:00
updater.sh tweaks
This commit is contained in:
parent
2980d7b519
commit
ce0f86558f
1 changed files with 8 additions and 11 deletions
19
updater.sh
19
updater.sh
|
@ -50,7 +50,7 @@ set_wd () {
|
||||||
ff_profile="$SCRIPT_DIR"
|
ff_profile="$SCRIPT_DIR"
|
||||||
elif [ "$PROFILE_PATH" = "list" ]; then
|
elif [ "$PROFILE_PATH" = "list" ]; then
|
||||||
local firefox_dir=""
|
local firefox_dir=""
|
||||||
if [ -d $macdir ]; then
|
if [ -d "$macdir" ]; then
|
||||||
firefox_dir=$macdir
|
firefox_dir=$macdir
|
||||||
elif [ -d $nixdir ]; then
|
elif [ -d $nixdir ]; then
|
||||||
firefox_dir=$nixdir
|
firefox_dir=$nixdir
|
||||||
|
@ -80,7 +80,6 @@ usage() {
|
||||||
echo -e "\t-h,\t\t Show this help message and exit."
|
echo -e "\t-h,\t\t Show this help message and exit."
|
||||||
echo -e "\t-p PROFILE,\t Path to your Firefox profile (if different than the dir of this script)"
|
echo -e "\t-p PROFILE,\t Path to your Firefox profile (if different than the dir of this script)"
|
||||||
echo -e "\t-l, \t\t Choose your Firefox profile from a list"
|
echo -e "\t-l, \t\t Choose your Firefox profile from a list"
|
||||||
echo -e "\t\t\t Note: This will not work with portable Firefox installations."
|
|
||||||
echo -e "\t\t\t IMPORTANT: if the path include spaces, wrap the entire argument in quotes."
|
echo -e "\t\t\t IMPORTANT: if the path include spaces, wrap the entire argument in quotes."
|
||||||
echo -e "\t-u,\t\t Update updater.sh and execute silently. Do not seek confirmation."
|
echo -e "\t-u,\t\t Update updater.sh and execute silently. Do not seek confirmation."
|
||||||
echo -e "\t-d,\t\t Do not look for updates to updater.sh."
|
echo -e "\t-d,\t\t Do not look for updates to updater.sh."
|
||||||
|
@ -176,8 +175,7 @@ get_updater_version () {
|
||||||
# -update: Check for update, if available, execute without asking
|
# -update: Check for update, if available, execute without asking
|
||||||
update_updater () {
|
update_updater () {
|
||||||
if [ $UPDATE = "no" ]; then
|
if [ $UPDATE = "no" ]; then
|
||||||
# User signified not to check for updates
|
return 0 # User signified not to check for updates
|
||||||
return 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
declare -r tmpfile=$(download_file 'https://raw.githubusercontent.com/ghacksuserjs/ghacks-user.js/master/updater.sh')
|
declare -r tmpfile=$(download_file 'https://raw.githubusercontent.com/ghacksuserjs/ghacks-user.js/master/updater.sh')
|
||||||
|
@ -188,13 +186,11 @@ update_updater () {
|
||||||
read -p "" -n 1 -r
|
read -p "" -n 1 -r
|
||||||
echo -e "\n\n"
|
echo -e "\n\n"
|
||||||
if [[ $REPLY =~ ^[Nn]$ ]]; then
|
if [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||||
# Update available, but user chooses not to update
|
return 0 # Update available, but user chooses not to update
|
||||||
return 0
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# No update available
|
return 0 # No update available
|
||||||
return 0
|
|
||||||
fi
|
fi
|
||||||
mv "${tmpfile}" "${SCRIPT_DIR}/updater.sh"
|
mv "${tmpfile}" "${SCRIPT_DIR}/updater.sh"
|
||||||
chmod u+x "${SCRIPT_DIR}/updater.sh"
|
chmod u+x "${SCRIPT_DIR}/updater.sh"
|
||||||
|
@ -209,7 +205,7 @@ update_updater () {
|
||||||
|
|
||||||
# Returns version number of a user.js file
|
# Returns version number of a user.js file
|
||||||
get_userjs_version () {
|
get_userjs_version () {
|
||||||
echo $(sed -n '4p' "$1")
|
echo "$(sed -n '4p' "$1")"
|
||||||
}
|
}
|
||||||
|
|
||||||
add_override () {
|
add_override () {
|
||||||
|
@ -354,8 +350,9 @@ if [ $# != 0 ]; then
|
||||||
;;
|
;;
|
||||||
r)
|
r)
|
||||||
tfile=$(download_file 'https://raw.githubusercontent.com/ghacksuserjs/ghacks-user.js/master/user.js')
|
tfile=$(download_file 'https://raw.githubusercontent.com/ghacksuserjs/ghacks-user.js/master/user.js')
|
||||||
echo -e ${ORANGE}"Warning: user.js was saved to temporary file ${tfile}"${NC}
|
mv $tfile "${tfile}.js"
|
||||||
open "$tfile"
|
echo -e ${ORANGE}"Warning: user.js was saved to temporary file ${tfile}.js"${NC}
|
||||||
|
open "${tfile}.js"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
\?)
|
\?)
|
||||||
|
|
Loading…
Add table
Reference in a new issue