forked from mirrored-repos/manjaro-tools
mkchroot: always set default en_us locales
This commit is contained in:
parent
332c7815db
commit
a3e686473d
4 changed files with 24 additions and 14 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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})
|
||||
|
||||
|
|
|
@ -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}" \
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue