[scripts] move for loop into separate function, simplify fault-tolerance related code
This commit is contained in:
parent
8ca973baf5
commit
b2357eacc6
@ -9,39 +9,30 @@ if [ -d "/usr/portage/licenses" ]; then
|
||||
export ACCEPT_LICENSE="$(ls /usr/portage/licenses -1 | xargs)"
|
||||
fi
|
||||
|
||||
export FORCE_EAPI=2
|
||||
updated=0
|
||||
for ((i=0; i < 42; i++)); do
|
||||
equo update && {
|
||||
updated=1;
|
||||
break;
|
||||
}
|
||||
if [ ${i} -gt 6 ]; then
|
||||
sleep 3600 || exit 1
|
||||
else
|
||||
sleep 1200 || exit 1
|
||||
safe_run() {
|
||||
local updated=0
|
||||
for ((i=0; i < 42; i++)); do
|
||||
"${@}" && {
|
||||
updated=1;
|
||||
break;
|
||||
}
|
||||
if [ ${i} -gt 6 ]; then
|
||||
sleep 3600 || return 1
|
||||
else
|
||||
sleep 1200 || return 1
|
||||
fi
|
||||
done
|
||||
if [ "${updated}" = "0" ]; then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
if [ "${updated}" = "0" ]; then
|
||||
exit 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
export FORCE_EAPI=2
|
||||
safe_run equo update || exit 1
|
||||
|
||||
export ETP_NOINTERACTIVE=1
|
||||
updated=0
|
||||
for ((i=0; i < 42; i++)); do
|
||||
equo upgrade --fetch && {
|
||||
updated=1;
|
||||
break;
|
||||
}
|
||||
if [ ${i} -gt 6 ]; then
|
||||
sleep 3600 || exit 1
|
||||
else
|
||||
sleep 1200 || exit 1
|
||||
fi
|
||||
done
|
||||
if [ "${updated}" = "0" ]; then
|
||||
exit 1
|
||||
fi
|
||||
safe_run equo upgrade --fetch || exit 1
|
||||
equo upgrade || exit 1
|
||||
echo "-5" | equo conf update
|
||||
rm -rf /var/lib/entropy/client/packages
|
||||
|
Loading…
Reference in New Issue
Block a user