mirror of
https://github.com/arkenfox/user.js.git
synced 2025-11-23 13:17:53 -05:00
Merge 3caa549eab into 0f14e030b3
This commit is contained in:
commit
db51135e6f
1 changed files with 19 additions and 6 deletions
19
updater.sh
19
updater.sh
|
|
@ -100,7 +100,8 @@ Optional Arguments:
|
||||||
-n Do not append any overrides, even if user-overrides.js exists.
|
-n Do not append any overrides, even if user-overrides.js exists.
|
||||||
-v Open the resulting user.js file.
|
-v Open the resulting user.js file.
|
||||||
-r Only download user.js to a temporary file and open it.
|
-r Only download user.js to a temporary file and open it.
|
||||||
-e Activate ESR related preferences."
|
-e Activate ESR related preferences.
|
||||||
|
-f PATH Use this path in the local disk for user.js instead of downloading it."
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
@ -247,8 +248,12 @@ remove_comments() { # expects 2 arguments: from-file and to-file
|
||||||
|
|
||||||
# Applies latest version of user.js and any custom overrides
|
# Applies latest version of user.js and any custom overrides
|
||||||
update_userjs() {
|
update_userjs() {
|
||||||
|
if [ -z "${USERJS_LOCAL_PATH}" ]; then
|
||||||
declare -r newfile="$(download_file 'https://raw.githubusercontent.com/arkenfox/user.js/master/user.js')"
|
declare -r newfile="$(download_file 'https://raw.githubusercontent.com/arkenfox/user.js/master/user.js')"
|
||||||
[ -z "${newfile}" ] && echo -e "${RED}Error! Could not download user.js${NC}" && return 1 # check if download failed
|
[ -z "${newfile}" ] && echo -e "${RED}Error! Could not download user.js${NC}" && return 1 # check if download failed
|
||||||
|
else
|
||||||
|
declare -r newfile="${USERJS_LOCAL_PATH}"
|
||||||
|
fi
|
||||||
|
|
||||||
echo -e "Please observe the following information:
|
echo -e "Please observe the following information:
|
||||||
Firefox profile: ${ORANGE}$(pwd)${NC}
|
Firefox profile: ${ORANGE}$(pwd)${NC}
|
||||||
|
|
@ -261,7 +266,7 @@ update_userjs() {
|
||||||
echo -e "\n"
|
echo -e "\n"
|
||||||
if ! [[ $REPLY =~ ^[Yy]$ ]]; then
|
if ! [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||||
echo -e "${RED}Process aborted${NC}"
|
echo -e "${RED}Process aborted${NC}"
|
||||||
rm "$newfile"
|
[ -z "${USERJS_LOCAL_PATH}" ] && rm "$newfile"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
@ -278,7 +283,12 @@ update_userjs() {
|
||||||
[ "$BACKUP" = 'single' ] && bakname='userjs_backups/user.js.backup'
|
[ "$BACKUP" = 'single' ] && bakname='userjs_backups/user.js.backup'
|
||||||
cp user.js "$bakname" &>/dev/null
|
cp user.js "$bakname" &>/dev/null
|
||||||
|
|
||||||
|
if [ -z "${USERJS_LOCAL_PATH}" ]; then
|
||||||
mv "${newfile}" user.js
|
mv "${newfile}" user.js
|
||||||
|
else
|
||||||
|
cp -p "${USERJS_LOCAL_PATH}" user.js
|
||||||
|
fi
|
||||||
|
|
||||||
echo -e "Status: ${GREEN}user.js has been backed up and replaced with the latest version!${NC}"
|
echo -e "Status: ${GREEN}user.js has been backed up and replaced with the latest version!${NC}"
|
||||||
|
|
||||||
if [ "$ESR" = true ]; then
|
if [ "$ESR" = true ]; then
|
||||||
|
|
@ -328,7 +338,7 @@ if [ $# != 0 ]; then
|
||||||
if [ "$1" = '--help' ] || [ "$1" = '-help' ]; then
|
if [ "$1" = '--help' ] || [ "$1" = '-help' ]; then
|
||||||
usage
|
usage
|
||||||
else
|
else
|
||||||
while getopts ":hp:ludsno:bcvre" opt; do
|
while getopts ":hp:ludsnof:bcvre" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
h)
|
h)
|
||||||
usage
|
usage
|
||||||
|
|
@ -366,6 +376,9 @@ if [ $# != 0 ]; then
|
||||||
e)
|
e)
|
||||||
ESR=true
|
ESR=true
|
||||||
;;
|
;;
|
||||||
|
f)
|
||||||
|
USERJS_LOCAL_PATH=${OPTARG}
|
||||||
|
;;
|
||||||
r)
|
r)
|
||||||
tfile="$(download_file 'https://raw.githubusercontent.com/arkenfox/user.js/master/user.js')"
|
tfile="$(download_file 'https://raw.githubusercontent.com/arkenfox/user.js/master/user.js')"
|
||||||
[ -z "${tfile}" ] && echo -e "${RED}Error! Could not download user.js${NC}" && exit 1 # check if download failed
|
[ -z "${tfile}" ] && echo -e "${RED}Error! Could not download user.js${NC}" && exit 1 # check if download failed
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue