treewide: add "exit 0" for uci-defaults files

uci-defaults scripts are supposed to be run once after firstboot
and then removed. However, the removal only takes place if the
subshell created for the sourced scripts returns exit code 0.

For some of the files, the last command returned a different exit
code, though, leading to the script remaining in its location and
being executed for every boot.

To prevent cases like the latter, this adds an "exit 0" to all
uci-defaults files in our package store. While at it, remove the
shebang for all these files since they are sourced (and not
executed).

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
This commit is contained in:
Adrian Schmutzler 2020-04-22 16:32:46 +02:00 committed by Fabian Bläse
parent 961c4da648
commit 776cfe9f86
20 changed files with 29 additions and 36 deletions

View File

@ -1,6 +1,5 @@
#!/bin/sh
uci -q set "alfred.alfred.mode=master"
uci -q commit alfred
exit 0

View File

@ -1,5 +1,3 @@
#!/bin/sh
>/etc/config/alfred
uci batch <<EOF
@ -10,3 +8,5 @@ uci batch <<EOF
set alfred.alfred.start_vis='0'
set alfred.alfred.run_facters='0'
EOF
exit 0

View File

@ -1,3 +1,3 @@
#!/bin/sh
echo "10 fff" >> /etc/iproute2/rt_tables
exit 0

View File

@ -1,5 +1,3 @@
#!/bin/sh
uci batch <<EOF
add network rule
set network.@rule[0].src='10.50.0.0/16'
@ -41,6 +39,6 @@ uci batch <<EOF
set network.@rule6[2].priority='31'
EOF
uci commit
uci commit network
exit 0

View File

@ -1,5 +1,3 @@
#!/bin/sh
uci batch <<EOF
set network.bat0=interface
set network.bat0.proto=batadv

View File

@ -1,5 +1,3 @@
#!/bin/sh
BOARD=$(cat /var/sysinfo/board_name)
case "$BOARD" in
@ -73,3 +71,5 @@ esac
uci set board.model.name=$BOARD
uci commit board
exit 0

View File

@ -1,5 +1,3 @@
#!/bin/sh
if [ ! -s /etc/config/fff ] ; then
UPGRADE_hostname=$(uci -q get "system.@system[0].hostname")
@ -25,3 +23,5 @@ if [ ! -s /etc/config/fff ] ; then
uci -q commit fff
fi
exit 0

View File

@ -1,4 +1,3 @@
#!/bin/sh
# Copyright 2017 Adrian Schmutzler
# License GPLv3
@ -20,3 +19,5 @@ poe_passthrough=$(uci -q get "fff.poe_passthrough.active")
if [ "$poe_passthrough" = "1" ] && [ -s /usr/lib/fff-support/activate_poe_passthrough.sh ] ; then
/usr/lib/fff-support/activate_poe_passthrough.sh
fi
exit 0

View File

@ -1,5 +1,3 @@
#!/bin/sh
uci batch <<EOF
delete dhcp.@dnsmasq[0]
delete dhcp.lan

View File

@ -1,5 +1,3 @@
#!/bin/sh
/etc/init.d/fastd disable
>/etc/config/fastd
@ -32,3 +30,5 @@ echo "#!/bin/sh" > /etc/fastd/fff/up.sh
echo "ip link set up dev fffVPN" >> /etc/fastd/fff/up.sh
echo "batctl if add fffVPN" >> /etc/fastd/fff/up.sh
chmod +x /etc/fastd/fff/up.sh
exit 0

View File

@ -1,6 +1,6 @@
#!/bin/sh
if ! grep -q u32 /etc/iproute2/ematch_map;
then
echo "3 u32" > /etc/iproute2/ematch_map
fi
exit 0

View File

@ -1,5 +1,3 @@
#!/bin/sh
uci batch <<EOF
set dhcp.mesh=dhcp
set dhcp.mesh.interface='mesh'

View File

@ -1,5 +1,3 @@
#!/bin/sh
traffic_enabled=$(uci -q get "fff.trafficcontrol.enabled")
traffic_in=$(uci -q get "fff.trafficcontrol.limit_in")
traffic_out=$(uci -q get "fff.trafficcontrol.limit_out")
@ -10,3 +8,5 @@ uci set "simple-tc.example.limit_ingress=${traffic_in}"
uci set "simple-tc.example.limit_egress=${traffic_out}"
uci commit simple-tc
exit 0

View File

@ -1,4 +1,3 @@
#!/bin/sh
# Copyright 2018 Adrian Schmutzler
# License GPLv3
@ -7,3 +6,5 @@
echo "" >> /etc/banner
echo "> $(cat /tmp/sysinfo/model 2>/dev/null) @ $FIRMWARE_VERSION" >> /etc/banner
echo "" >> /etc/banner
exit 0

View File

@ -1,4 +1,3 @@
#!/bin/sh
# Copyright 2017 Tim Niemeyer
# License GPLv3
@ -12,3 +11,5 @@ cat > /etc/sysupgrade.conf <<-__EOF__
/etc/config/gateway
/etc/hoodfile
__EOF__
exit 0

View File

@ -1,5 +1,3 @@
#!/bin/sh
. /lib/functions/fff/timeserver
# No initialization here, this is done in configurehood
@ -7,3 +5,5 @@
uci -q set "system.@system[0].timezone=CET-1CEST,M3.5.0,M10.5.0/3"
uci -q commit system
exit 0

View File

@ -1,5 +1,3 @@
#!/bin/sh
. /lib/functions/fff/keyxchange
ln -s "$hoodfilewww" /www/hood/keyxchangev2data
@ -46,4 +44,5 @@ uci batch <<EOF
EOF
uci commit uhttpd
exit 0

View File

@ -1,5 +1,3 @@
#!/bin/sh
uci batch <<EOF
set network.wireguard_main=rule6
set network.wireguard_main.mark='0xc8'

View File

@ -1,4 +1,3 @@
#!/bin/sh
# Copyright 2016 Tim Niemeyer
# Copyright 2019 Adrian Schmutzler
# License GPLv3
@ -81,4 +80,6 @@ config_foreach configWifiDevice wifi-device
uci commit network
uci commit wireless
exit 0
# vim: set noexpandtab:tabstop=4

View File

@ -1,4 +1,3 @@
#!/bin/sh
# Copyright 2018 Adrian Schmutzler
# License GPLv3
@ -39,3 +38,5 @@ esac
# rssileds: always disable if package is installed
[ -x "/etc/init.d/rssileds" ] && /etc/init.d/rssileds disable
exit 0