use loop for option handling

This commit is contained in:
layman 2022-08-31 07:47:07 +02:00
parent b279399927
commit 9c5ca97ecc

View file

@ -39,15 +39,27 @@ if [ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]; then
CHROOTED=1
fi
if [[ ${1} == "--no-sync" || ${2} == "--no-sync" ]] ; then
echo "not syncing"
SYNC_COMMAND=""
fi
if [[ ${1} == "--full" || ${2} == "--full" ]] ; then
echo "Do a full upgrade including build dependencies"
PORTAGE_UPGRADE_OPTIONS+=("--with-bdeps=y")
fi
while [[ $# -gt 0 ]]; do
case $1 in
--no-sync)
echo "not syncing"
SYNC_COMMAND=""
shift
;;
--full)
echo "Do a full upgrade including build dependencies"
PORTAGE_UPGRADE_OPTIONS+=("--with-bdeps=y")
shift
;;
--*)
echo "Unknown option $1"
shift
;;
*)
echo "Positional arguments aren't supported"
;;
esac
done
if [[ $CHROOTED == 1 ]] ; then
SYNC_COMMAND="layman -S"