diff --git a/bin/basestrap.in b/bin/basestrap.in index 0a090db..6389b38 100644 --- a/bin/basestrap.in +++ b/bin/basestrap.in @@ -93,16 +93,10 @@ if ! mountpoint -q "$newroot" && ! ${directory}; then die '%s is not a mountpoint!' "$newroot" fi -mv "$newroot/etc/locale.gen" "$newroot/etc/locale.gen.bak" -mv "$newroot/etc/locale.conf" "$newroot/etc/locale.conf.bak" -printf '%s.UTF-8 UTF-8\n' en_US > "$newroot/etc/locale.gen" -printf 'LANG=%s.UTF-8\n' en_US > "$newroot/etc/locale.conf" -printf 'LC_MESSAGES=C\n' >> "$newroot/etc/locale.conf" - # create obligatory directories create_min_fs "$newroot" -if [[ ! -e $newroot/etc/pacman-mirrors.conf ]]; then +if [[ ! -f $newroot/etc/pacman-mirrors.conf ]]; then pacman-mirrors "${pm_args[@]}" fi diff --git a/bin/mkchroot.in b/bin/mkchroot.in index 3d550d6..ab75765 100644 --- a/bin/mkchroot.in +++ b/bin/mkchroot.in @@ -75,6 +75,9 @@ else cache_dirs=(${cache_dir}) fi +basestrap_args=(-GMcd ${pac_conf:+-C "$pac_conf"} -B "${branch}") +[[ -n ${mirror} ]] && basestrap_args+=(-U "${mirror}") + umask 0022 #[[ -e $working_dir ]] && die "Working directory '%s' already exists" "$working_dir" @@ -98,10 +101,6 @@ for file in "${files[@]}"; do cp "$file" "$working_dir$file" done -basestrap_args=(-GMcd ${pac_conf:+-C "$pac_conf"} -B "${branch}") - -[[ -n ${mirror} ]] && basestrap_args+=(-U "${mirror}") - _env=() while read -r varname; do _env+=("$varname=${!varname}") @@ -111,6 +110,8 @@ basestrap "${basestrap_args[@]}" "$working_dir" ${cache_dirs[@]/#/--cachedir=} " echo "$version" > "$working_dir/.manjaro-tools" +set_locale "$working_dir" + chroot_args=(${pac_conf:+-C "$pac_conf"} ${makepkg_conf:+-M "$makepkg_conf"} ${cache_dir:+-c "$cache_dir"}) ${nosetarch} && chroot_args+=(${nosetarch:+-s}) diff --git a/lib/util-chroot.sh b/lib/util-chroot.sh index fe82b40..e6903bc 100644 --- a/lib/util-chroot.sh +++ b/lib/util-chroot.sh @@ -45,6 +45,23 @@ subvolume_delete_recursive() { return 0 } +set_locale(){ + local mnt="$1" + if [[ ! -f "$mnt/etc/locale.gen.bak" ]] && [[ ! -f "$mnt/etc/locale.conf.bak" ]];then + mv "$mnt/etc/locale.gen" "$mnt/etc/locale.gen.bak" + mv "$mnt/etc/locale.conf" "$mnt/etc/locale.conf.bak" + printf '%s.UTF-8 UTF-8\n' en_US > "$mnt/etc/locale.gen" + printf 'LANG=%s.UTF-8\n' en_US > "$mnt/etc/locale.conf" + printf 'LC_MESSAGES=C\n' >> "$mnt/etc/locale.conf" + fi +} + +reset_locale(){ + local mnt="$1" + [[ -f "$mnt/etc/locale.gen.bak" ]] && mv "$mnt/etc/locale.gen.bak" "$mnt/etc/locale.gen" + [[ -f "$mnt/etc/locale.conf.bak" ]] && mv "$mnt/etc/locale.conf.bak" "$mnt/etc/locale.conf" +} + create_chroot(){ local timer=$(get_timer) setarch "${target_arch}" \ diff --git a/lib/util-iso-chroot.sh b/lib/util-iso-chroot.sh index a8e20ea..1680ea2 100644 --- a/lib/util-iso-chroot.sh +++ b/lib/util-iso-chroot.sh @@ -183,7 +183,6 @@ clean_iso_root(){ } clean_up_image(){ - local path mnt="$1" msg2 "Cleaning [%s]" "${mnt##*/}" if [[ ${mnt##*/} == 'mhwdfs' ]];then @@ -196,8 +195,7 @@ clean_up_image(){ find "$path" -mindepth 0 -delete &> /dev/null fi else - [[ -f "$mnt/etc/locale.gen.bak" ]] && mv "$mnt/etc/locale.gen.bak" "$mnt/etc/locale.gen" - [[ -f "$mnt/etc/locale.conf.bak" ]] && mv "$mnt/etc/locale.conf.bak" "$mnt/etc/locale.conf" + reset_locale "$mnt" path=$mnt/boot if [[ -d "$path" ]]; then find "$path" -name 'initramfs*.img' -delete &> /dev/null