Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

allow turning off --noconfirm

use -i (interactive) to allow for choosing packages from groups

[dave: alter option description]
  • Loading branch information...
commit d195e48981c4545a1bb0a9ba99f5ed2b44346755 1 parent 93b3298
@gtmanfred gtmanfred authored committed
Showing with 15 additions and 6 deletions.
  1. +10 −2 pacstrap.in
  2. +5 −4 zsh-completion
View
12 pacstrap.in
@@ -22,6 +22,7 @@ usage: ${0##*/} [options] root [packages...]
Options:
-c Use the package cache on the host, rather than the target
-d Allow installation to a non-mountpoint directory
+ -i Avoid auto-confirmation of package selections
pacstrap installs packages to the specified new root directory. If no packages
are given, pacstrap defaults to the "base" group.
@@ -36,7 +37,7 @@ fi
(( EUID == 0 )) || die 'This script must be run with root privileges'
-while getopts ':cd' flag; do
+while getopts ':cdi' flag; do
case $flag in
d)
directory=1
@@ -44,6 +45,9 @@ while getopts ':cd' flag; do
c)
hostcache=1
;;
+ i)
+ interactive=1
+ ;;
:)
die '%s: option requires an argument -- '\''%s'\' "${0##*/}" "$OPTARG"
;;
@@ -62,6 +66,10 @@ if (( ! hostcache )); then
pacman_args+=(--cachedir="$newroot/var/cache/pacman/pkg")
fi
+if (( ! interactive )); then
+ pacman_args+=(--noconfirm)
+fi
+
[[ -d $newroot ]] || die "%s is not a directory" "$newroot"
if ! mountpoint -q "$newroot" && (( ! directory )); then
die '%s is not a mountpoint!' "$newroot"
@@ -78,7 +86,7 @@ trap 'api_fs_umount "$newroot" 2>/dev/null' EXIT
api_fs_mount "$newroot" || die "failed to setup API filesystems in new root"
msg 'Installing packages to %s' "$newroot"
-if ! pacman -r "$newroot" -Sy --noconfirm "${pacman_args[@]}"; then
+if ! pacman -r "$newroot" -Sy "${pacman_args[@]}"; then
die 'Failed to install packages to new root'
fi
View
9 zsh-completion
@@ -7,6 +7,7 @@ _pacstrap_args=(
_pacstrap_args_nonh=(
'(-h --help)-c[Use the package cache on the host, rather than the target]'
'(-h --help)-d[Allow installation to a non-mountpoint directory]'
+ '(--help -h)-i[Avoid auto-confirmation of package selections]'
)
@@ -67,11 +68,11 @@ _longopts=( '--help[display help]' )
_pacstrap(){
if [[ -z ${(M)words:#--help} && -z ${(M)words:#-h} ]]; then
case $words[CURRENT] in
- -c*|-d*)
- _arguments -s -w "$_pacstrap_args_nonh[@]"
+ -c*|-d*|-i*)
+ _arguments -s "$_pacstrap_args_nonh[@]"
;;
-*)
- _arguments -s -w : \
+ _arguments -s : \
"$_pacstrap_args[@]" \
"$_pacstrap_args_nonh[@]" \
"$_longopts[@]"
@@ -81,7 +82,7 @@ _pacstrap(){
"$_longopts[@]"
;;
*)
- _arguments -s -w : \
+ _arguments -s : \
"$_pacstrap_args[@]" \
"$_pacstrap_args_nonh[@]" \
"$_longopts[@]" \

0 comments on commit d195e48

Please sign in to comment.
Something went wrong with that request. Please try again.