iopsys-feed/iop/scripts/feeds_update.sh
Erik Karlsson 792e3ad20d iop: feeds_update: add option for hard failure
Add -F option for hard failure on unsuccessful clone/fetch of feed.
2023-11-13 14:56:10 +00:00

88 lines
2.1 KiB
Bash
Executable file

#!/bin/bash
function feeds_update {
heads=1
developer=0
override=1
force=1
function update_failure {
if [ $force == 1 ]; then
echo "WARNING: Failed to update feed(s). Forced update, proceeding anyway." >&2
else
echo "ERROR: Failed to update feed(s). Omit -F to proceed anyway." >&2
exit 1
fi
}
while getopts "inFh" opt; do
case $opt in
i)
heads=0
;;
n)
override=0
;;
F)
force=0
;;
h|\?)
echo "Usage: ./iop feeds_update [-i] [-n] [-F] [-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 " -F - Do not force update if there are inaccessible feeds."
echo " -h - Display this help message and exit."
exit 1
;;
esac
done
git remote -v | grep -qE '(git@|ssh://)' && developer=1
cp .config .genconfig_config_bak
if [ $heads == 1 ]; then
if [ $developer == 1 ]; then
./scripts/feeds update -g || update_failure
else
./scripts/feeds update || update_failure
fi
fi
./scripts/feeds update -ai || exit 1
# replace core packages with iopsys versions
if [ $override == 1 ]; then
./scripts/feeds install -f -p openwrt_core -a || exit 1
./scripts/feeds install -f -p qualcomm -a || exit 1
fi
(
echo '# DO NOT EDIT. Autogenerated file by ./iop feeds_update'
echo 'FEED_DEVICES_DIRS:='
find feeds -type f -name .is-feed-devices-dir -printf 'FEED_DEVICES_DIRS+=$(TOPDIR)/%h'
) > target/linux/feed-devices/feed-devices-list.mk || exit 1
# targets need to be installed explicitly
for target in $(ls ./feeds/targets); do
./scripts/feeds install -f -p targets $target || exit 1
done
# install all packages
./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 || exit 1
cp .genconfig_config_bak .config
make defconfig || exit 1
# record when we last run this script
touch tmp/.iop_bootstrap || exit 1
# always return true
exit 0
}
register_command "feeds_update" "Update feeds to point to commit hashes from feeds.conf"