mirror of
https://github.com/arkenfox/user.js.git
synced 2025-02-23 02:43:56 +00:00
parent
2cfbba1472
commit
46bab27f94
14
updater.sh
14
updater.sh
@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
readonly CURRDIR=$(pwd)
|
readonly CURRDIR=$(pwd)
|
||||||
|
|
||||||
sfp=$(readlink -f "${BASH_SOURCE[0]}" 2>/dev/null || greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null)
|
SCRIPT_FILE=$(readlink -f "${BASH_SOURCE[0]}" 2>/dev/null || greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null)
|
||||||
[ -z "$sfp" ] && sfp=${BASH_SOURCE[0]}
|
[ -z "$SCRIPT_FILE" ] && SCRIPT_FILE=${BASH_SOURCE[0]}
|
||||||
readonly SCRIPT_DIR=$(dirname "${sfp}")
|
readonly SCRIPT_DIR=$(dirname "${SCRIPT_FILE}")
|
||||||
|
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
@ -198,7 +198,7 @@ update_updater () {
|
|||||||
declare -r tmpfile="$(download_file 'https://raw.githubusercontent.com/arkenfox/user.js/master/updater.sh')"
|
declare -r tmpfile="$(download_file 'https://raw.githubusercontent.com/arkenfox/user.js/master/updater.sh')"
|
||||||
[ -z "${tmpfile}" ] && echo -e "${RED}Error! Could not download updater.sh${NC}" && return 1 # check if download failed
|
[ -z "${tmpfile}" ] && echo -e "${RED}Error! Could not download updater.sh${NC}" && return 1 # check if download failed
|
||||||
|
|
||||||
if [[ $(get_updater_version "${SCRIPT_DIR}/updater.sh") < $(get_updater_version "${tmpfile}") ]]; then
|
if [[ $(get_updater_version "$SCRIPT_FILE") < $(get_updater_version "${tmpfile}") ]]; then
|
||||||
if [ $UPDATE = 'check' ]; then
|
if [ $UPDATE = 'check' ]; then
|
||||||
echo -e "There is a newer version of updater.sh available. ${RED}Update and execute Y/N?${NC}"
|
echo -e "There is a newer version of updater.sh available. ${RED}Update and execute Y/N?${NC}"
|
||||||
read -p "" -n 1 -r
|
read -p "" -n 1 -r
|
||||||
@ -208,9 +208,9 @@ update_updater () {
|
|||||||
else
|
else
|
||||||
return 0 # No update available
|
return 0 # No update available
|
||||||
fi
|
fi
|
||||||
mv "${tmpfile}" "${SCRIPT_DIR}/updater.sh"
|
mv "${tmpfile}" "$SCRIPT_FILE"
|
||||||
chmod u+x "${SCRIPT_DIR}/updater.sh"
|
chmod u+x "$SCRIPT_FILE"
|
||||||
"${SCRIPT_DIR}/updater.sh" "$@" -d
|
"$SCRIPT_FILE" "$@" -d
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user