Skip to content

Commit

Permalink
falter-berlin-bbbdigger: Apply shellcheck-fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Hübner <[email protected]>
  • Loading branch information
Akira25 committed Aug 29, 2022
1 parent 56ddd11 commit 14b90bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/falter-berlin-bbbdigger/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=falter-berlin-bbbdigger
PKG_VERSION:=0.0.3
PKG_RELEASE:=3
PKG_VERSION:=0.0.4
PKG_RELEASE:=4

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)

Expand Down
13 changes: 8 additions & 5 deletions packages/falter-berlin-bbbdigger/files/postinst.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#
# All other config sections are overwritten with current settings

# shellcheck disable=SC2034

# shellcheck source=/dev/null
. /lib/functions.sh

TUNNEL_SRV='_bbb-vpn._udp.berlin.freifunk.net'
Expand All @@ -21,15 +24,15 @@ if [ $? -eq 1 ]; then
# start with b6 for Berliner 6ackbone
MAC="b6"
for byte in 2 3 4 5 6; do
MAC=$MAC`dd if=/dev/urandom bs=1 count=1 2> /dev/null | hexdump -e '1/1 ":%02x"'`
MAC=$MAC$(dd if=/dev/urandom bs=1 count=1 2> /dev/null | hexdump -e '1/1 ":%02x"')
done
fi

UUID=$(uci -q get tunneldigger.${IFACE}.uuid)
if [ $? -eq 1 ]; then
UUID=$MAC
for byte in 7 8 9 10; do
UUID=$UUID`dd if=/dev/urandom bs=1 count=1 2> /dev/null | hexdump -e '1/1 ":%02x"'`
UUID=$UUID$(dd if=/dev/urandom bs=1 count=1 2> /dev/null | hexdump -e '1/1 ":%02x"')
done
fi

Expand All @@ -38,15 +41,15 @@ uci set tunneldigger.$IFACE=broker
# remove old address list in favor of srv
uci -q delete tunneldigger.$IFACE.address
uci set tunneldigger.$IFACE.srv=$TUNNEL_SRV
uci set tunneldigger.$IFACE.uuid=$UUID
uci set tunneldigger.$IFACE.uuid="$UUID"
uci set tunneldigger.$IFACE.interface=$IFACE
uci set tunneldigger.$IFACE.broker_selection=usage
uci set tunneldigger.$IFACE.bind_interface=$BIND
uci set tunneldigger.$IFACE.enabled=1

# network setup
uci set network.${IFACE}_dev=device
uci set network.${IFACE}_dev.macaddr=$MAC
uci set network.${IFACE}_dev.macaddr="$MAC"
uci set network.${IFACE}_dev.name=$IFACE

uci set network.$IFACE=interface
Expand All @@ -59,7 +62,7 @@ uci -q add_list firewall.zone_freifunk.network=$IFACE

# olsr setup (first remove it and add it again)
SECTION=$(uci show olsrd | grep ${IFACE} | cut -d . -f 1-2)
[ ! -z $SECTION ] && uci delete $SECTION
[ -n "$SECTION" ] && uci delete "$SECTION"
uci add olsrd Interface
uci set olsrd.@Interface[-1].ignore=0
uci set olsrd.@Interface[-1].interface=$IFACE
Expand Down

0 comments on commit 14b90bd

Please sign in to comment.