mirror of
https://github.com/arkenfox/user.js.git
synced 2025-05-01 22:43:38 +02:00
Downloads Thunderbird version on -t
and fixes one more exit code error
This commit is contained in:
parent
4d34d2e755
commit
82a04a1734
1 changed files with 18 additions and 6 deletions
24
updater.sh
24
updater.sh
|
@ -38,7 +38,9 @@ SKIPOVERRIDE=false
|
||||||
VIEW=false
|
VIEW=false
|
||||||
PROFILE_PATH=false
|
PROFILE_PATH=false
|
||||||
ESR=false
|
ESR=false
|
||||||
|
DOWNLOAD_ONLY=false
|
||||||
APPNAME='firefox'
|
APPNAME='firefox'
|
||||||
|
USERJS_URL='https://raw.githubusercontent.com/ghacksuserjs/ghacks-user.js/master/user.js'
|
||||||
|
|
||||||
# Download method priority: curl -> wget
|
# Download method priority: curl -> wget
|
||||||
DOWNLOAD_METHOD=''
|
DOWNLOAD_METHOD=''
|
||||||
|
@ -138,6 +140,7 @@ open_file () { #expects one argument: file_path
|
||||||
xdg-open "$1"
|
xdg-open "$1"
|
||||||
else
|
else
|
||||||
echo -e "${RED}Error: Sorry, opening files is not supported for your OS.${NC}"
|
echo -e "${RED}Error: Sorry, opening files is not supported for your OS.${NC}"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,9 +282,17 @@ remove_comments () { # expects 2 arguments: from-file and to-file
|
||||||
sed -e 's/^[[:space:]]*\/\/.*$//' -e '/^\/\*/,/\*\//d' -e '/^[[:space:]]*$/d' -e 's/);[[:space:]]*\/\/.*/);/' "$1" > "$2"
|
sed -e 's/^[[:space:]]*\/\/.*$//' -e '/^\/\*/,/\*\//d' -e '/^[[:space:]]*$/d' -e 's/);[[:space:]]*\/\/.*/);/' "$1" > "$2"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Downloads latest version of user.js and (try to) open it
|
||||||
|
download_and_open_userjs () {
|
||||||
|
tfile=$(download_file "${USERJS_URL}")
|
||||||
|
mv "$tfile" "${tfile}.js"
|
||||||
|
echo -e "${ORANGE}Warning: user.js was saved to temporary file ${tfile}.js${NC}"
|
||||||
|
open_file "${tfile}.js"
|
||||||
|
}
|
||||||
|
|
||||||
# Applies latest version of user.js and any custom overrides
|
# Applies latest version of user.js and any custom overrides
|
||||||
update_userjs () {
|
update_userjs () {
|
||||||
declare -r newfile=$(download_file 'https://raw.githubusercontent.com/ghacksuserjs/ghacks-user.js/master/user.js')
|
declare -r newfile=$(download_file ${USERJS_URL})
|
||||||
|
|
||||||
echo 'Please observe the following information:'
|
echo 'Please observe the following information:'
|
||||||
echo -e "\t${APPNAME^} profile: ${ORANGE}$(pwd)${NC}"
|
echo -e "\t${APPNAME^} profile: ${ORANGE}$(pwd)${NC}"
|
||||||
|
@ -410,13 +421,10 @@ if [ $# != 0 ]; then
|
||||||
;;
|
;;
|
||||||
t)
|
t)
|
||||||
APPNAME='thunderbird'
|
APPNAME='thunderbird'
|
||||||
|
USERJS_URL='https://raw.githubusercontent.com/HorlogeSkynet/thunderbird-user.js/master/user.js'
|
||||||
;;
|
;;
|
||||||
r)
|
r)
|
||||||
tfile=$(download_file 'https://raw.githubusercontent.com/ghacksuserjs/ghacks-user.js/master/user.js')
|
DOWNLOAD_ONLY=true
|
||||||
mv $tfile "${tfile}.js"
|
|
||||||
echo -e "${ORANGE}Warning: user.js was saved to temporary file ${tfile}.js${NC}"
|
|
||||||
open_file "${tfile}.js"
|
|
||||||
exit 0
|
|
||||||
;;
|
;;
|
||||||
\?)
|
\?)
|
||||||
echo -e "${RED}\n Error! Invalid option: -$OPTARG${NC}" >&2
|
echo -e "${RED}\n Error! Invalid option: -$OPTARG${NC}" >&2
|
||||||
|
@ -434,6 +442,10 @@ fi
|
||||||
show_banner
|
show_banner
|
||||||
update_updater $@
|
update_updater $@
|
||||||
|
|
||||||
|
if [[ "$DOWNLOAD_ONLY" = true ]]; then
|
||||||
|
download_and_open_userjs
|
||||||
|
fi
|
||||||
|
|
||||||
getProfilePath # updates PROFILE_PATH or exits on error
|
getProfilePath # updates PROFILE_PATH or exits on error
|
||||||
cd "$PROFILE_PATH" && update_userjs
|
cd "$PROFILE_PATH" && update_userjs
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue