diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-09-26 16:23:32 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-09-26 16:23:32 -0400 |
commit | 67bcecbbe42c727936d825363fbd1e2173bab574 (patch) | |
tree | 4443427102b172f3963f98a6e32c76e7b1da4b1a /arch-nspawn.in | |
parent | 46e8d5b656945179d7dc79c6d5c93034f1495367 (diff) | |
parent | 9c85d116f0425817b4a631e7a693dc5c948e2470 (diff) | |
download | devtools32-67bcecbbe42c727936d825363fbd1e2173bab574.tar.xz |
Merge branch 'devtools' (early part)
Conflicts:
arch-nspawn.in
This effectively reverts my machine_name patch; I took a simpler route to
dealing with a working_dir with funny characters in it, using a different
scheme for the machine_name. This fixes the problems devtools' original
scheme had, so I'm going back to that.
Diffstat (limited to 'arch-nspawn.in')
-rw-r--r-- | arch-nspawn.in | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/arch-nspawn.in b/arch-nspawn.in index ec9b2d3..bde77b6 100644 --- a/arch-nspawn.in +++ b/arch-nspawn.in @@ -40,15 +40,15 @@ shift $(($OPTIND - 1)) (( $EUID != 0 )) && die 'This script must be run as root.' (( $# < 1 )) && die 'You must specify a directory.' -working_dir="$(readlink -f $1)" +working_dir=$(readlink -f "$1") shift 1 [[ -z $working_dir ]] && die 'Please specify a working directory.' if [[ -z $cache_dir ]]; then - cache_dirs=($(pacman -v $cache_conf 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g')) + cache_dirs=($(pacman -v 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g')) else - cache_dirs=(${cache_dir}) + cache_dirs=("$cache_dir") fi host_mirror=$(pacman -Sddp extra/devtools 2>/dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#') @@ -56,31 +56,27 @@ host_mirror=$(pacman -Sddp extra/devtools 2>/dev/null | sed -r 's#(.*/)extra/os/ # {{{ functions build_mount_args() { - local p declare -g mount_args=() if [[ -n $host_mirror_path ]]; then - printf -v p '%q' "$host_mirror_path" - mount_args+=(--bind-ro="$p") + mount_args+=(--bind-ro="$host_mirror_path") fi - printf -v p '%q' "${cache_dirs[0]}" - mount_args+=(--bind="$p") + mount_args+=(--bind="${cache_dirs[0]}") for cache_dir in ${cache_dirs[@]:1}; do - printf -v p '%q' "$cache_dir" - mount_args+=(--bind-ro="$p") + mount_args+=(--bind-ro="$cache_dir") done } copy_hostconf () { cp -a /etc/pacman.d/gnupg "$working_dir/etc/pacman.d" - echo "Server = $host_mirror" > $working_dir/etc/pacman.d/mirrorlist + echo "Server = $host_mirror" >"$working_dir/etc/pacman.d/mirrorlist" - [[ -n $pac_conf ]] && cp $pac_conf $working_dir/etc/pacman.conf - [[ -n $makepkg_conf ]] && cp $makepkg_conf $working_dir/etc/makepkg.conf + [[ -n $pac_conf ]] && cp $pac_conf "$working_dir/etc/pacman.conf" + [[ -n $makepkg_conf ]] && cp $makepkg_conf "$working_dir/etc/makepkg.conf" - sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${cache_dirs[@]})|g" -i $working_dir/etc/pacman.conf + sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${cache_dirs[@]})|g" -i "$working_dir/etc/pacman.conf" } # }}} @@ -98,8 +94,8 @@ copy_hostconf eval $(grep '^CARCH=' "$working_dir/etc/makepkg.conf") -machine_name="${working_dir##*/}" -machine_name="${machine_name//\./-}" +machine_name="${working_dir//[![:alnum:]_-]/-}" +machine_name="${machine_name#-}" exec ${CARCH:+setarch "$CARCH"} systemd-nspawn \ -D "$working_dir" \ |