index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | mkarchroot.in | 17 |
diff --git a/mkarchroot.in b/mkarchroot.in index f86ae35..5165960 100644 --- a/mkarchroot.in +++ b/mkarchroot.in @@ -11,8 +11,7 @@ # GNU General Public License for more details. m4_include(lib/common.sh) - -CHROOT_VERSION='v3' +m4_include(lib/archroot.sh) working_dir='' @@ -30,8 +29,6 @@ usage() { exit 1 } -orig_argv=("$@") - while getopts 'hC:M:c:f:s' arg; do case "$arg" in C) pac_conf="$OPTARG" ;; @@ -43,19 +40,19 @@ while getopts 'hC:M:c:f:s' arg; do *) error "invalid argument '%s'" "$arg"; usage ;; esac done -shift $(($OPTIND - 1)) +shift $((OPTIND - 1)) (( $# < 2 )) && die 'You must specify a directory and one or more packages.' -check_root "$0" "${orig_argv[@]}" +check_root -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 "$cache_conf" 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g')) else cache_dirs=(${cache_dir}) fi @@ -68,7 +65,7 @@ mkdir -p "$working_dir" lock 9 "${working_dir}.lock" "Locking chroot" -if [[ $(stat -f -c %T "$working_dir") == btrfs ]]; then +if is_btrfs "$working_dir"; then rmdir "$working_dir" if ! btrfs subvolume create "$working_dir"; then die "Couldn't create subvolume for '%s'" "$working_dir" @@ -90,7 +87,7 @@ pacstrap -GMcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \ "${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages' printf '%s.UTF-8 UTF-8\n' en_US de_DE > "$working_dir/etc/locale.gen" -echo 'LANG=C' > "$working_dir/etc/locale.conf" +echo 'LANG=en_US.UTF-8' > "$working_dir/etc/locale.conf" echo "$CHROOT_VERSION" > "$working_dir/.arch-chroot" systemd-machine-id-setup --root="$working_dir" |