xrestricted: add --yes flag for non-interactive use
This commit is contained in:
parent
81d73d6363
commit
6345cbdb09
|
@ -20,7 +20,9 @@ if [[ ! -d $PACKAGES_DIR ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
zparseopts -D -E h=help -help=help j:=jobs -jobs:=jobs b:=branch -branch:=branch
|
zparseopts -D -E h=help -help=help j:=jobs -jobs:=jobs b:=branch -branch:=branch y=yes -yes=yes
|
||||||
|
|
||||||
|
if [[ $yes ]]; then echo "auto mode: $yes"; fi
|
||||||
|
|
||||||
if [[ $help ]]; then
|
if [[ $help ]]; then
|
||||||
<<-HELP
|
<<-HELP
|
||||||
|
@ -70,7 +72,7 @@ install_restricted() {
|
||||||
else
|
else
|
||||||
echo "Package already built for version $2 ($existing), installing..."
|
echo "Package already built for version $2 ($existing), installing..."
|
||||||
fi
|
fi
|
||||||
xi $1
|
xi $yes $1
|
||||||
}
|
}
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
|
@ -99,8 +101,8 @@ case $1 in
|
||||||
fi
|
fi
|
||||||
|
|
||||||
awk '{ printf "\x1b[34m%s\x1b[0m: %s → \x1b[92m%s\x1b[0m\n", $1, $2, $3 }' <<<"$possible_updates"
|
awk '{ printf "\x1b[34m%s\x1b[0m: %s → \x1b[92m%s\x1b[0m\n", $1, $2, $3 }' <<<"$possible_updates"
|
||||||
printf "Run updates? [y/N] "
|
[[ -z $yes ]] && printf "Run updates? [y/N] "
|
||||||
if read -q; then
|
if [[ $yes ]] || read -q; then
|
||||||
echo
|
echo
|
||||||
for pkg ver in $(cut -d' ' -f 1,3 <<<"$possible_updates"); do
|
for pkg ver in $(cut -d' ' -f 1,3 <<<"$possible_updates"); do
|
||||||
install_restricted $pkg $ver
|
install_restricted $pkg $ver
|
||||||
|
|
Loading…
Reference in a new issue