Skip to content

Instantly share code, notes, and snippets.

@stargieg
Last active March 15, 2021 05:34
Show Gist options
  • Save stargieg/22e99a85a79c4c6ea7878ec258a3d8b9 to your computer and use it in GitHub Desktop.
Save stargieg/22e99a85a79c4c6ea7878ec258a3d8b9 to your computer and use it in GitHub Desktop.
create ipkg feed for the imagebuilder
#!/bin/sh
#sudo apt install python2 python3 subversion build-essential libncurses5-dev zlib1g-dev gawk git ccache gettext libssl-dev xsltproc zip imagemagick
upd_out="luci2-ffwizard"
upd_path=$(pwd)
upd_targets="ath79 ar71xx x86 brcm2708"
upd_subtargets="generic 64 bcm2708 legacy mikrotik"
slots="snapshots 19.07.7"
gcc_vers="gcc-8.4.0_musl gcc-8.4.0_musl_eabi gcc-7.5.0_musl gcc-7.5.0_musl_eabi"
for slot in $slots;do
case $slot in
snapshots);;
*)
version=$slot
slot="releases/$version"
versioni="-$version"
;;
esac
rm -rf $upd_path/$upd_out/$slot
for upd_target in $upd_targets;do
for upd_subtarget in $upd_subtargets;do
for gcc_ver in $gcc_vers;do
cd $upd_path
sdk_name="openwrt-sdk$versioni-$upd_target-""$upd_subtarget""_$gcc_ver.Linux-x86_64"
mkdir -p dl
cd dl || continue
wget -q -N -c https://downloads.openwrt.org/$slot/targets/$upd_target/$upd_subtarget/$sdk_name.tar.xz 2>/dev/null
cd ..
[ -f dl/$sdk_name.tar.xz ] || continue
#rm -rf $sdk_name
tar -x -f dl/$sdk_name.tar.xz || continue
cd $sdk_name || continue
mkdir -p $upd_path/$upd_out
touch staging_dir/host/.prereq-build
>feeds.conf
#grep " base" feeds.conf.default >> feeds.conf
#grep " packages" feeds.conf.default >> feeds.conf
echo "src-git luci2_ffwizard https://github.com/stargieg/luci2-ffwizard.git" >> feeds.conf
#echo "src-link luci2_ffwizard $upd_path/luci2_ffwizard_git" >> feeds.conf
rm -rf feeds/*
rm -rf package/feeds/*
rm -rf bin/*
rm -rf build_dir/*
rm -rf tmp/*
rm -rf staging_dir/target-*
./scripts/feeds update -a >$upd_path/$upd_out/feed$versioni-$upd_target-$upd_subtarget.log 2>&1
./scripts/feeds install -a >>$upd_path/$upd_out/feed$versioni-$upd_target-$upd_subtarget.log 2>&1
echo "" > .config
echo "# CONFIG_ALL_NONSHARED is not set" >> .config
echo "# CONFIG_ALL_KMODS is not set" >> .config
echo "# CONFIG_ALL is not set" >> .config
echo "# CONFIG_SIGNED_PACKAGES is not set" >> .config
echo "CONFIG_CCACHE=y" >> .config
echo "CONFIG_AUTOREBUILD=n" >> .config
echo "CONFIG_AUTOREMOVE=n" >> .config
echo "CONFIG_DOWNLOAD_FOLDER=\"$upd_path/dl\"" >> .config
echo "CONFIG_PACKAGE_luci2-ffwizard=m" >> .config
echo "CONFIG_PACKAGE_luci2-ffwizard-lua=m" >> .config
echo "CONFIG_LUCI_APP_FFWIZARD_GEN_SRCDIET=y" >> .config
echo "CONFIG_PACKAGE_luci2-ffwizard-fw=m" >> .config
echo "CONFIG_PACKAGE_luci2-ffwizard-olsrd-ipv4=m" >> .config
echo "CONFIG_PACKAGE_luci2-ffwizard-olsrd-ipv6=m" >> .config
echo "CONFIG_PACKAGE_luci2-ffwizard-olsrv2-ipv6=m" >> .config
echo "CONFIG_PACKAGE_luci2-ffwizard-batadv=m" >> .config
echo "CONFIG_PACKAGE_luci2-ffwizard-kadnode=m" >> .config
echo "CONFIG_PACKAGE_luci-app-olsr2=m" >> .config
echo "CONFIG_LUCI_APP_OLSR2_SRCDIET=y" >> .config
echo "CONFIG_PACKAGE_luci-theme-material=m" >> .config
echo "CONFIG_PACKAGE_luci-app-olsr-public=m" >> .config
echo "CONFIG_PACKAGE_luci-app-statistics-public=m" >> .config
echo "CONFIG_PACKAGE_luci-mod-freifunk=m" >> .config
echo "CONFIG_PACKAGE_luci-mod-public=m" >> .config
echo "CONFIG_PACKAGE_luci-app-falter-owm=m" >> .config
echo "CONFIG_PACKAGE_luci-app-falter-owm-cmd=m" >> .config
echo "CONFIG_PACKAGE_luci-app-falter-owm-gui=m" >> .config
echo "CONFIG_PACKAGE_luci-app-falter-owm-ant=m" >> .config
make defconfig >$upd_path/$upd_out/config$versioni-$upd_target-$upd_subtarget.log 2>&1
eval $(grep ^CONFIG_TARGET_ARCH_PACKAGES .config)
upd_arch=$CONFIG_TARGET_ARCH_PACKAGES
if [ ! -d "$upd_path/$upd_out/$slot/packages/$upd_arch" ] ; then
echo "$sdk_name"
echo "upd_arch: $upd_path/$upd_out/$slot/packages/$upd_arch"
mkdir -p "$upd_path/$upd_out/$slot/packages/$upd_arch"
(
make OUTPUT_DIR="$upd_path/$upd_out/$slot" package/feeds/luci2_ffwizard/luci2-ffwizard/compile
make OUTPUT_DIR="$upd_path/$upd_out/$slot" package/feeds/luci2_ffwizard/luci-app-olsr2/compile
make OUTPUT_DIR="$upd_path/$upd_out/$slot" package/feeds/luci2_ffwizard/luci-theme-material/compile
make OUTPUT_DIR="$upd_path/$upd_out/$slot" package/feeds/luci2_ffwizard/luci-app-olsr-public/compile
make OUTPUT_DIR="$upd_path/$upd_out/$slot" package/feeds/luci2_ffwizard/luci-app-statistics-public/compile
make OUTPUT_DIR="$upd_path/$upd_out/$slot" package/feeds/luci2_ffwizard/luci-mod-freifunk/compile
make OUTPUT_DIR="$upd_path/$upd_out/$slot" package/feeds/luci2_ffwizard/luci-mod-public/compile
make OUTPUT_DIR="$upd_path/$upd_out/$slot" package/feeds/luci2_ffwizard/luci-app-falter-owm/compile
make OUTPUT_DIR="$upd_path/$upd_out/$slot" package/index >/dev/null 2>&1
rm -rf $upd_path/$upd_out/$slot/targets
echo "done"
) >>$upd_path/$upd_out/$upd_arch$versioni-$upd_target-$upd_subtarget.log 2>&1 &
PID=$!
echo "Build PID: $PID"
echo "tail -f $upd_path/$upd_out/$upd_arch$versioni-$upd_target-$upd_subtarget.log"
fi
done
done
done
done
echo "done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment