updater.sh - allow non-js files if passed to -o

This commit is contained in:
overdodactyl 2018-11-21 10:38:06 -07:00
parent 315bd08267
commit 1830a5037c

View file

@ -54,7 +54,7 @@ usage() {
echo -e "\t\t\t\t\t Ex: -o \"override folder\" " echo -e "\t\t\t\t\t Ex: -o \"override folder\" "
echo -e "\t-n,\t\t Do not append any overrides, even if user-overrides.js exists." echo -e "\t-n,\t\t Do not append any overrides, even if user-overrides.js exists."
echo -e echo -e
echo -e "Deprecated Arguments:" echo -e "Deprecated Arguments (they still work for now):"
echo -e "\t-donotupdate,\t Use instead -d" echo -e "\t-donotupdate,\t Use instead -d"
echo -e "\t-update,\t Use instead -u" echo -e "\t-update,\t Use instead -u"
echo -e echo -e
@ -86,7 +86,7 @@ if [ $# != 0 ]; then
UPDATE="yes" UPDATE="yes"
legacy_argument $1 legacy_argument $1
else else
while getopts ":hudso:nb" opt; do while getopts ":hudsno:b" opt; do
case $opt in case $opt in
h) h)
usage usage
@ -100,12 +100,12 @@ if [ $# != 0 ]; then
s) s)
CONFIRM="no" CONFIRM="no"
;; ;;
o)
OVERRIDE=${OPTARG}
;;
n) n)
OVERRIDE="none" OVERRIDE="none"
;; ;;
o)
OVERRIDE=${OPTARG}
;;
b) b)
BACKUP="single" BACKUP="single"
;; ;;
@ -277,15 +277,13 @@ get_userjs_version () {
add_override () { add_override () {
input=$1 input=$1
if [ -f "$input" ]; then if [ -f "$input" ]; then
if [[ "$input" == *.js ]]; then echo "" >> user.js
echo "" >> user.js cat "$input" >> user.js
cat "$input" >> user.js echo -e "Status: ${GREEN}Override file appended:${NC} ${input}"
echo -e "Status: ${GREEN}Override file appended:${NC} ${input}"
fi
elif [ -d "$input" ]; then elif [ -d "$input" ]; then
FSAVEIFS=$IFS FSAVEIFS=$IFS
IFS=$(echo -en "\n\b") # Set IFS IFS=$(echo -en "\n\b") # Set IFS
FILES="${input}"/* FILES="${input}"/*.js
for f in $FILES for f in $FILES
do do
add_override "$f" add_override "$f"