Make it so upgrade_system does not treat exit code 2 from fwupdmgr as an actual bad exit code

This commit is contained in:
Tony Blyler 2022-06-14 09:31:30 -04:00
parent 53d6febd20
commit e784dc571b

View file

@ -42,8 +42,24 @@ upgrade_system() {
fi
if command -v fwupdmgr &> /dev/null; then
fwupdmgr refresh
fwupdmgr upgrade
(
# 2 is a valid exit code for the fwupdmgr where
# the operation was successful but did not require
# action
set +e
fwupdmgr refresh
STATUS=$?
if [ $STATUS -ne 0 ] && [ $STATUS -ne 2 ]; then
exit $STATUS
fi
fwupdmgr upgrade
STATUS=$?
if [ $STATUS -ne 0 ] && [ $STATUS -ne 2 ]; then
exit $STATUS
fi
)
fi
)
}