:: Re: [DNG] LXC template for Devuan
トップ ページ
このメッセージを削除
このメッセージに返信
著者: Greg Olsen
日付:  
To: dng
題目: Re: [DNG] LXC template for Devuan
On 2016-06-13 13:42, Rainer Weikusat wrote:
> The message means that using a certain locale has been requested by
> setting the LANGUAGE and LANG environment variables to its name but that
> it can't really be used because the compiled locale definitions for the
> requested locale aren't available. The two obvious ways to deal with
> that would be
>
>
>
> The source files used for these reside in /usr/share/i18n and the file
> containg the compiled equivalents is /usr/lib/locale/locale-archive. An
> LXC-container could use a read-only bind mount to get access to the
> locale-archive file of the host.


Rainer,

Thank very much for the info.

In this case is was a timing issue of when lxc-devuan configures the
locale. It needed to be configured before the /usr/sbin/update-rc.d
commands. It was happening after that.

I've since fixed by moving into a separate function and calling earlier:

configure_locale ()
{
     if [ -z "$LANG" ]; then
         cat >> $rootfs/etc/locale.gen << EOF
en_US.UTF-8 UTF-8
EOF
         chroot $rootfs locale-gen
         chroot $rootfs update-locale LANG=en_US.UTF-8
     else
         encoding=$(echo $LANG | cut -d. -f2)
         chroot $rootfs sed -e "s/^# \(${LANG} ${encoding}\)/\1/" \
             -i /etc/locale.gen 2> /dev/null
         if ! grep -q ^${LANG}\ ${encoding} /etc/locale.gen ; then
            cat >> $rootfs/etc/locale.gen << EOF
$LANG $encoding
EOF
         fi
         chroot $rootfs locale-gen
         chroot $rootfs update-locale LANG=$LANG
     fi
}



Greg