iop: feeds_update: return 1 on failure and add -i to update index only

Handle failures correctly so that CI for example will terminate. Add
-i option to update index only and not heads.

Change-Id: Idabcd8c855eb513bf702c0808aff28b28262c9c7
This commit is contained in:
Erik Karlsson 2021-05-14 16:38:12 +02:00
parent 0975f022c5
commit 0e1ac637ac

View file

@ -1,15 +1,26 @@
#! /bin/bash
#!/bin/bash
function feeds_update {
heads=1
developer=0
override=1
start=$(date -u +'%s')
while getopts "n" opt; do
while getopts "inh" opt; do
case $opt in
i)
heads=0
;;
n)
override=0
;;
h|\?)
echo "Usage: ./iop feeds_update [-i] [-n] [-h]"
echo
echo "OPTIONS:"
echo " -i - Only update index. Do not change HEAD in feeds."
echo " -n - Do not replace core packages with iopsys versions."
echo " -h - Display this help message and exit."
exit 1
;;
esac
done
@ -17,17 +28,18 @@ function feeds_update {
cp .config .genconfig_config_bak
#if -d argument is passed, clone feeds with ssh instead of http
if [ $developer == 1 ]; then
./scripts/feeds update -g
else
./scripts/feeds update
if [ $heads == 1 ]; then
if [ $developer == 1 ]; then
./scripts/feeds update -g || exit 1
else
./scripts/feeds update || exit 1
fi
fi
./scripts/feeds update -ai
./scripts/feeds update -ai || exit 1
# replace core packages with iopsys versions
if [ $override == 1 ]; then
./scripts/feeds install -f -p openwrt_core -a
./scripts/feeds install -f -p openwrt_core -a || exit 1
fi
(
@ -38,20 +50,20 @@ function feeds_update {
# targets need to be installed explicitly
for target in $(ls ./feeds/targets); do
./scripts/feeds install -f -p targets $target
./scripts/feeds install -f -p targets $target || exit 1
done
# install all packages
./scripts/feeds install -a
./scripts/feeds install -a || exit 1
# remove broken symlinks ( for packages that are no longer in the feed )
find -L package/feeds -maxdepth 2 -type l -delete
find -L package/feeds -maxdepth 2 -type l -delete || exit 1
cp .genconfig_config_bak .config
make defconfig
make defconfig || exit 1
# record when we last run this script
touch tmp/.iop_bootstrap
touch tmp/.iop_bootstrap || exit 1
# always return true
exit 0