iup: only whitespace changes

This commit is contained in:
Ionuț-Alex Oprea 2018-04-25 16:22:40 +02:00
parent 072c2dc4ab
commit 96366e0226

View file

@ -71,8 +71,7 @@ reload ()
local pack local pack
pack=$(get_packages $1) pack=$(get_packages $1)
v "Calling ubus call uci commit for $pack" v "Calling ubus call uci commit for $pack"
for packname in $pack for packname in $pack ; do
do
ubus call uci commit '{"config":"'$packname'"}' ubus call uci commit '{"config":"'$packname'"}'
sleep 1 sleep 1
done done
@ -118,10 +117,12 @@ handle_provisioning() {
mkdir $IUPTEMP mkdir $IUPTEMP
fi fi
touch $IUPCONFFILES touch $IUPCONFFILES
config_get_bool enabled "$config" enabled "$default" config_get_bool enabled "$config" enabled "$default"
config_get_bool defaultreset "$config" defaultreset config_get_bool defaultreset "$config" defaultreset
config_get deckey "$config" deckey config_get deckey "$config" deckey
if [ "$enabled" -eq 1 ]; then
if [ "$enabled" -eq 1 ]; then
if [ "$config" == "iup" ]; then if [ "$config" == "iup" ]; then
v "Using url received in dhcp options" v "Using url received in dhcp options"
config_get url "$config" urliup config_get url "$config" urliup
@ -131,26 +132,25 @@ handle_provisioning() {
url=${url//\$MAC/$MAC} url=${url//\$MAC/$MAC}
v "Downloading from url \"$url\"" v "Downloading from url \"$url\""
while [ $retry -le $RETRYSTOP ] while [ $retry -le $RETRYSTOP ]; do
do if [ ${url%%:*} == "tftp" ]; then
if [ ${url%%:*} == "tftp" ]; then tftpfile=${url#*\/\/}
tftpfile=${url#*\/\/} host=${tftpfile%%\/*}
host=${tftpfile%%\/*} tftpfile=${tftpfile#*\/}
tftpfile=${tftpfile#*\/}
/usr/bin/tftp -l $IUPCONFFILES -r "$tftpfile" -g "$host" /usr/bin/tftp -l $IUPCONFFILES -r "$tftpfile" -g "$host"
else else
get_image "$url" "cat" > $IUPCONFFILES get_image "$url" "cat" > $IUPCONFFILES
fi fi
if [ -s $IUPCONFFILES ]; then if [ -s $IUPCONFFILES ]; then
v "Download finished" v "Download finished"
retry=$((RETRYSTOP + 1)) retry=$((RETRYSTOP + 1))
else else
v "Download failed, retrying in $incsleep seconds" v "Download failed, retrying in $incsleep seconds"
sleep $incsleep sleep $incsleep
incsleep=$((incsleep * retry + number)) incsleep=$((incsleep * retry + number))
retry=$((retry+1)) retry=$((retry+1))
fi fi
done done
fi fi
if [ ! -s "$IUPCONFFILES" ] && [ "$enabled" -eq 1 ]; then if [ ! -s "$IUPCONFFILES" ] && [ "$enabled" -eq 1 ]; then
@ -170,11 +170,11 @@ handle_Downloaded_file()
KEY=${DECKEY:-$DESKEY} KEY=${DECKEY:-$DESKEY}
local img_type local img_type
case "$(get_image_type "$IUPCONFFILES")" in case "$(get_image_type "$IUPCONFFILES")" in
"INTENO") img_type=2 ;; "INTENO") img_type=2 ;;
"CFE+FS") img_type=1 ;; "CFE+FS") img_type=1 ;;
"FS") img_type=0 ;; "FS") img_type=0 ;;
*) img_type="UNKNOWN";; *) img_type="UNKNOWN";;
esac esac
if [ "$img_type" == "UNKNOWN" ] ; then if [ "$img_type" == "UNKNOWN" ] ; then
case "$(hexdump -v -n 2 -e '1/1 "%02x"' $IUPCONFFILES)" in case "$(hexdump -v -n 2 -e '1/1 "%02x"' $IUPCONFFILES)" in
@ -192,15 +192,13 @@ handle_Downloaded_file()
save_usercfg save_usercfg
cd $IUPTEMP cd $IUPTEMP
tar xvzf $IUPCONFFILES tar xvzf $IUPCONFFILES
for f in $CONFILESLURP for f in $CONFILESLURP ; do
do
v "File to be applied $f and config $(cat $f)" v "File to be applied $f and config $(cat $f)"
uci -f $f import uci -f $f import
done done
pack=$(get_packages $CONFILESLURP) pack=$(get_packages $CONFILESLURP)
v "Packages to be commited: $pack" v "Packages to be commited: $pack"
for packname in $pack for packname in $pack ; do
do
uci commit $packname uci commit $packname
done done
apply_usercfg apply_usercfg
@ -239,7 +237,7 @@ handle_Downloaded_file()
v "Downloaded file is a firmware, will start reflashing" v "Downloaded file is a firmware, will start reflashing"
if [ "$defaultreset" -eq 1 ]; then if [ "$defaultreset" -eq 1 ]; then
v "Not saving configuration over reflash" v "Not saving configuration over reflash"
/sbin/sysupgrade -v -n $IUPCONFFILES /sbin/sysupgrade -v -n $IUPCONFFILES
else else
v "Saving configuration over reflash" v "Saving configuration over reflash"
/sbin/sysupgrade -v $IUPCONFFILES /sbin/sysupgrade -v $IUPCONFFILES
@ -290,14 +288,14 @@ change_to_vlan() {
# loop through the string, remove any word close to "base_dev". # loop through the string, remove any word close to "base_dev".
for word in ${wan_if}; do for word in ${wan_if}; do
#echo $word #echo $word
case $word in case $word in
${base_dev}*) # don't add if. ${base_dev}*) # don't add if.
;; ;;
*) new_wan_if=${word}' '${new_wan_if} # add if. *) new_wan_if=${word}' '${new_wan_if} # add if.
#new_wan_if+=" ${word}" # probably not working in ash. #new_wan_if+=" ${word}" # probably not working in ash.
;; ;;
esac esac
done done
# append new interface. # append new interface.
new_wan_if=${new_wan_if}${base_dev}.${1} new_wan_if=${new_wan_if}${base_dev}.${1}
@ -532,7 +530,6 @@ main()
touch $IUPMD5 touch $IUPMD5
fi fi
local iupurl local iupurl
local configurl local configurl
local software local software