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"
|
die '%s is not a mountpoint!' "$newroot"
|
||||||
fi
|
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 obligatory directories
|
||||||
create_min_fs "$newroot"
|
create_min_fs "$newroot"
|
||||||
|
|
||||||
if [[ ! -e $newroot/etc/pacman-mirrors.conf ]]; then
|
if [[ ! -f $newroot/etc/pacman-mirrors.conf ]]; then
|
||||||
pacman-mirrors "${pm_args[@]}"
|
pacman-mirrors "${pm_args[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,9 @@ else
|
||||||
cache_dirs=(${cache_dir})
|
cache_dirs=(${cache_dir})
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
basestrap_args=(-GMcd ${pac_conf:+-C "$pac_conf"} -B "${branch}")
|
||||||
|
[[ -n ${mirror} ]] && basestrap_args+=(-U "${mirror}")
|
||||||
|
|
||||||
umask 0022
|
umask 0022
|
||||||
|
|
||||||
#[[ -e $working_dir ]] && die "Working directory '%s' already exists" "$working_dir"
|
#[[ -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"
|
cp "$file" "$working_dir$file"
|
||||||
done
|
done
|
||||||
|
|
||||||
basestrap_args=(-GMcd ${pac_conf:+-C "$pac_conf"} -B "${branch}")
|
|
||||||
|
|
||||||
[[ -n ${mirror} ]] && basestrap_args+=(-U "${mirror}")
|
|
||||||
|
|
||||||
_env=()
|
_env=()
|
||||||
while read -r varname; do
|
while read -r varname; do
|
||||||
_env+=("$varname=${!varname}")
|
_env+=("$varname=${!varname}")
|
||||||
|
@ -111,6 +110,8 @@ basestrap "${basestrap_args[@]}" "$working_dir" ${cache_dirs[@]/#/--cachedir=} "
|
||||||
|
|
||||||
echo "$version" > "$working_dir/.manjaro-tools"
|
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"})
|
chroot_args=(${pac_conf:+-C "$pac_conf"} ${makepkg_conf:+-M "$makepkg_conf"} ${cache_dir:+-c "$cache_dir"})
|
||||||
${nosetarch} && chroot_args+=(${nosetarch:+-s})
|
${nosetarch} && chroot_args+=(${nosetarch:+-s})
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,23 @@ subvolume_delete_recursive() {
|
||||||
return 0
|
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(){
|
create_chroot(){
|
||||||
local timer=$(get_timer)
|
local timer=$(get_timer)
|
||||||
setarch "${target_arch}" \
|
setarch "${target_arch}" \
|
||||||
|
|
|
@ -183,7 +183,6 @@ clean_iso_root(){
|
||||||
}
|
}
|
||||||
|
|
||||||
clean_up_image(){
|
clean_up_image(){
|
||||||
|
|
||||||
local path mnt="$1"
|
local path mnt="$1"
|
||||||
msg2 "Cleaning [%s]" "${mnt##*/}"
|
msg2 "Cleaning [%s]" "${mnt##*/}"
|
||||||
if [[ ${mnt##*/} == 'mhwdfs' ]];then
|
if [[ ${mnt##*/} == 'mhwdfs' ]];then
|
||||||
|
@ -196,8 +195,7 @@ clean_up_image(){
|
||||||
find "$path" -mindepth 0 -delete &> /dev/null
|
find "$path" -mindepth 0 -delete &> /dev/null
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
[[ -f "$mnt/etc/locale.gen.bak" ]] && mv "$mnt/etc/locale.gen.bak" "$mnt/etc/locale.gen"
|
reset_locale "$mnt"
|
||||||
[[ -f "$mnt/etc/locale.conf.bak" ]] && mv "$mnt/etc/locale.conf.bak" "$mnt/etc/locale.conf"
|
|
||||||
path=$mnt/boot
|
path=$mnt/boot
|
||||||
if [[ -d "$path" ]]; then
|
if [[ -d "$path" ]]; then
|
||||||
find "$path" -name 'initramfs*.img' -delete &> /dev/null
|
find "$path" -name 'initramfs*.img' -delete &> /dev/null
|
||||||
|
|
Loading…
Reference in a new issue