Skip to content

Commit

Permalink
packagelists: introduce packagelists on falter-versions
Browse files Browse the repository at this point in the history
packagelists needs to be on Falter-versions instead of
OpenWrt-versions.
This fixes #97.

Applied `shftm -i4 -w build_falter` too. This reformats the
code partly.

Signed-off-by: Martin Hübner <[email protected]>
  • Loading branch information
Akira25 committed Mar 27, 2022
1 parent 73a1b63 commit f51b6e2
Show file tree
Hide file tree
Showing 10 changed files with 338 additions and 27 deletions.
82 changes: 55 additions & 27 deletions build_falter
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ while :; do
fi
;;

i*|-image-builder)
i* | -image-builder)
if [ "$2" ]; then
echo "Use Custom Imagebuilder at: $2"
IMAGE_BUILDER_PATH="$2"
Expand Down Expand Up @@ -213,11 +213,26 @@ while :; do
done

# check if we got all options we would need.
if [ -z "$PARSER_FALTER_VERSION" ]; then echo "Please specify a falter-version with '-v'."; OPTION_MISSING=1; fi
if [ -z "$PARSER_TARGET" ]; then echo "Please give a target with '-t'."; OPTION_MISSING=1; fi
if [ -z "$PARSER_SUBTARGET" ]; then echo "Please give a subtarget with option '-s'."; OPTION_MISSING=1; fi
if [ -z "$PARSER_PACKAGESET" ]; then echo "Please specify a packageset with option '-p'."; OPTION_MISSING=1; fi
if [ "$OPTION_MISSING" == 1 ]; then echo "Exiting..."; exit 1; fi
if [ -z "$PARSER_FALTER_VERSION" ]; then
echo "Please specify a falter-version with '-v'."
OPTION_MISSING=1
fi
if [ -z "$PARSER_TARGET" ]; then
echo "Please give a target with '-t'."
OPTION_MISSING=1
fi
if [ -z "$PARSER_SUBTARGET" ]; then
echo "Please give a subtarget with option '-s'."
OPTION_MISSING=1
fi
if [ -z "$PARSER_PACKAGESET" ]; then
echo "Please specify a packageset with option '-p'."
OPTION_MISSING=1
fi
if [ "$OPTION_MISSING" == 1 ]; then
echo "Exiting..."
exit 1
fi

# check for dependencies.
SCRIPT_DEPENDS="awk curl gawk grep git gettext python3 rsync sed unzip wget"
Expand Down Expand Up @@ -279,8 +294,8 @@ EOF
function patch_if_needed() {
# check if a patch has already been applied (i.e. it's been merged upstream (for some versions))
# and apply it only if it has not
patch -f -s -R --dry-run -p${2:-1} -i "$1" >/dev/null || \
patch -f -p${2:-1} -i "$1"
patch -f -s -R --dry-run -p${2:-1} -i "$1" >/dev/null ||
patch -f -p${2:-1} -i "$1"
}

function patch_buildsystem() {
Expand All @@ -292,7 +307,7 @@ function patch_buildsystem() {
patch_if_needed ../../patches/workaround-kernel2minor-path-length-limitation.patch 2
}

function derive_packagelist_version {
function derive_underlying_openwrt_version {
# OpenWrt-Version from freifunk-release file could be something like
# '19.07-SNAPSHOT'. But we have only packagelists for 19.07... Solve that.
regex="^[0-9][0-9].[0-9][0-9]"
Expand Down Expand Up @@ -414,9 +429,9 @@ function start_build {
echo "$1"

if [ -n "$IMAGE_BUILDER_PATH" ]; then
IMAGE_BUILDER_URL=$IMAGE_BUILDER_PATH
IMAGE_BUILDER_URL=$IMAGE_BUILDER_PATH
else
IMAGE_BUILDER_URL="$1"
IMAGE_BUILDER_URL="$1"
fi

local TMP=$2 # slice packageset-name from path
Expand All @@ -433,16 +448,16 @@ function start_build {
echo "FILENAME $FILENAME FOLDERNAME $FOLDERNAME BRANCH $BRANCH PKG_SET $PKG_SET"

if [ -z $IMAGE_BUILDER_PATH ]; then
# store imagebuilders in cache. Reload, if there is a newer version avaiable
local CACHE="../imagebuilder_cache"
if [ ! -d $CACHE ]; then mkdir -p $CACHE; fi
cd $CACHE
wget -N --no-if-modified-since $IMAGE_BUILDER_URL
cd ../build
# pull imagebuilder from cache-dir
cp ../imagebuilder_cache/$FILENAME $FILENAME
# store imagebuilders in cache. Reload, if there is a newer version avaiable
local CACHE="../imagebuilder_cache"
if [ ! -d $CACHE ]; then mkdir -p $CACHE; fi
cd $CACHE
wget -N --no-if-modified-since $IMAGE_BUILDER_URL
cd ../build
# pull imagebuilder from cache-dir
cp ../imagebuilder_cache/$FILENAME $FILENAME
else
cp ../$IMAGE_BUILDER_PATH $FILENAME
cp ../$IMAGE_BUILDER_PATH $FILENAME
fi

echo $PWD
Expand Down Expand Up @@ -532,14 +547,27 @@ function start_build {
# MAIN #
##############

PARSER_OWT=$(derive_packagelist_version $FREIFUNK_OPENWRT_BASE)
PARSER_OWT=$(derive_underlying_openwrt_version $FREIFUNK_OPENWRT_BASE)

if [ "$PARSER_PACKAGESET" == "all" ]; then
# split off "-snapshot" for stable-release-snapshots, so we can use the designated stable-packagelist
if echo "$FREIFUNK_RELEASE" | grep "snapshot\|rc"; then
ff_release=$(echo "$FREIFUNK_RELEASE" | cut -d'-' -f1)
else
ff_release="$FREIFUNK_RELEASE"
fi

# build all imageflavours. For this, get paths of packagesets
# fetch paths of packagelists (depends on openwrt-version). If not unique, chose most recent version of possibilities.
PSET_PATHS=$(find packageset | sort | grep -e "/$PARSER_OWT" | grep .txt | tail -n3)
PSET_PATHS=$(find packageset | sort | grep -e "/$ff_release" | grep .txt | tail -n3)

if [ -z "$PSET_PATHS" ]; then
echo "There aren't packagesets defined for this version. Please give a packagelist explicitly!"
exit 1
fi

echo "Packagelists to be build:"
echo $PSET_PATHS
#exit
else
read_packageset "$PARSER_PACKAGESET"
fi
Expand Down Expand Up @@ -588,12 +616,12 @@ else
IMAGEBUILDER=$(fetch_subdirs "$TARGET_LIST" | grep imagebuilder)
if [ "$PSET_PATHS" ]; then
for PKG_SET in $PSET_PATHS; do
echo "building three packagelists..."
echo "-> building three packagelists..."
read_packageset "../$PKG_SET"
start_build "$TARGET_LIST$IMAGEBUILDER" $PKG_SET $CONF_DEVICE
done
else
echo "building one packagelist only..."
echo "-> building one packagelist only..."
# "targets" is on purpose there. Otherwise that positonal argument would be empty.
start_build "$TARGET_LIST$IMAGEBUILDER" targets $CONF_DEVICE
fi
Expand All @@ -604,12 +632,12 @@ else
imagebuilder=$(fetch_subdirs "$RELEASE_LINK$CONF_TARGET/$subtarget" | grep imagebuilder)
if [ "$PSET_PATHS" ]; then
for PKG_SET in $PSET_PATHS; do
echo "building three packagelists..."
echo "-> building three packagelists..."
read_packageset "../$PKG_SET"
start_build "$RELEASE_LINK$CONF_TARGET/$subtarget$imagebuilder" $PKG_SET
done
else
echo "building one packagelist only..."
echo "-> building one packagelist only..."
start_build "$RELEASE_LINK$CONF_TARGET/$subtarget$imagebuilder"
fi
done
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
98 changes: 98 additions & 0 deletions packageset/1.2.1/notunnel.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
-wpad-mini
#wpad

# Defaults
falter-berlin-dhcp-defaults
falter-berlin-firewall-defaults
falter-berlin-freifunk-defaults
falter-berlin-migration
falter-berlin-network-defaults
falter-berlin-olsrd-defaults
falter-berlin-statistics-defaults
falter-berlin-system-defaults
falter-berlin-uhttpd-defaults

# Common
mtr
ip
iperf3
tmux
vnstat
ethtool
#dnsmasq is already provided via dnsmasq-full
-dnsmasq
qos-scripts
firewall
iwinfo
libiwinfo-lua
tcpdump-mini

# falter Common
falter-common
falter-common-olsr
falter-policyrouting
falter-profiles
# allow upgrade from one type to another
falter-berlin-tunneldigger

# GUI-basics
uhttpd
uhttpd-mod-ubus
luci
luci-ssl
luci-app-ffwizard-falter
luci-mod-falter
luci-app-olsr
luci-app-opkg
luci-app-firewall
luci-app-olsr-services
luci-app-falter-owm
luci-app-falter-owm-ant
luci-app-falter-owm-cmd
luci-app-falter-owm-gui
luci-proto-ppp
luci-theme-bootstrap

# GUI translation stuff
luci-i18n-base-de
luci-i18n-base-en
luci-i18n-firewall-de
luci-i18n-firewall-en
luci-i18n-olsr-de
luci-i18n-olsr-en
luci-i18n-opkg-de
luci-i18n-opkg-en
luci-i18n-statistics-de
luci-i18n-statistics-en
luci-i18n-falter-de
luci-i18n-falter-en
luci-i18n-ffwizard-falter-de
luci-i18n-ffwizard-falter-en
luci-i18n-falter-policyrouting-de
luci-i18n-falter-policyrouting-en

# OLSR
olsrd
olsrd-utils
olsrd-mod-arprefresh
olsrd-mod-dyn-gw
olsrd-mod-jsoninfo
olsrd-mod-txtinfo
olsrd-mod-nameservice
kmod-ipip

# Uplink
falter-berlin-uplink-notunnel

# Statistics
luci-app-statistics
collectd
collectd-mod-dhcpleases
collectd-mod-interface
collectd-mod-iwinfo
collectd-mod-network
collectd-mod-olsrd
collectd-mod-rrdtool
collectd-mod-ping
collectd-mod-uptime
collectd-mod-memory
99 changes: 99 additions & 0 deletions packageset/1.2.1/tunneldigger.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#-wpad-mini
#wpad

# Defaults
falter-berlin-dhcp-defaults
falter-berlin-firewall-defaults
falter-berlin-freifunk-defaults
falter-berlin-migration
falter-berlin-network-defaults
falter-berlin-olsrd-defaults
falter-berlin-statistics-defaults
falter-berlin-system-defaults
falter-berlin-uhttpd-defaults
falter-profiles

# Common
mtr
ip
iperf3
tmux
vnstat
ethtool
#dnsmasq is already provided via dnsmasq-full
-dnsmasq
qos-scripts
firewall
iwinfo
libiwinfo-lua
tcpdump-mini

# falter Common
falter-common
falter-common-olsr
falter-policyrouting
falter-profiles

# GUI-basics
uhttpd
uhttpd-mod-ubus
luci
luci-ssl
luci-app-ffwizard-falter
luci-mod-falter
luci-app-olsr
luci-app-opkg
luci-app-firewall
luci-app-olsr-services
luci-app-falter-owm
luci-app-falter-owm-ant
luci-app-falter-owm-cmd
luci-app-falter-owm-gui
luci-proto-ppp
luci-theme-bootstrap

# GUI transaltion stuff
luci-i18n-base-de
luci-i18n-base-en
luci-i18n-firewall-de
luci-i18n-firewall-en
luci-i18n-olsr-de
luci-i18n-olsr-en
luci-i18n-opkg-de
luci-i18n-opkg-en
luci-i18n-statistics-de
luci-i18n-statistics-en
luci-i18n-falter-de
luci-i18n-falter-en
luci-i18n-ffwizard-falter-de
luci-i18n-ffwizard-falter-en
luci-i18n-falter-policyrouting-de
luci-i18n-falter-policyrouting-en

# OLSR
olsrd
olsrd-utils
olsrd-mod-arprefresh
olsrd-mod-dyn-gw
olsrd-mod-jsoninfo
olsrd-mod-txtinfo
olsrd-mod-nameservice
kmod-ipip

# Uplink
falter-berlin-uplink-tunnelberlin

# Statistics
luci-app-statistics
collectd
collectd-mod-cpu
collectd-mod-dhcpleases
collectd-mod-interface
collectd-mod-iwinfo
collectd-mod-load
collectd-mod-network
collectd-mod-olsrd
collectd-mod-rrdtool
collectd-mod-ping
collectd-mod-uptime
collectd-mod-memory
Loading

0 comments on commit f51b6e2

Please sign in to comment.