Commit 320eebfb authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

We should reduce locales as a separate build step as locale-archive may be in use during system run

parent 2b61c1d3
......@@ -449,6 +449,62 @@ rm /lib/systemd/system/build
</exec>
</target>
<target name="reduce-locales">
<fail unless="BOARD" message="Correct machine type must be specified"/>
<antcall target="copy-to-secondary"/>
<antcall target="mount"/>
<antcall target="setup-reduce-locales"/>
<antcall target="unmount"/>
<antcall target="run-system-with-secondary-${BOARD}"/>
<antcall target="check-reduce-locales-success"/>
<antcall target="copy-back"/>
</target>
<target name="setup-reduce-locales">
<antcall target="setup-reduce-locales-ab"/>
</target>
<target name="setup-reduce-locales-ab" if="ABstart">
<delete file="${sysdir}/.success"/>
<echo file="${sysdir}/lib/systemd/system/reduce-locales.service">[Unit]
Description=Reduce locales
[Service]
Type=oneshot
StandardOutput=tty
ExecStart=/lib/systemd/system/reduce-locales
ExecStartPost=/sbin/poweroff
[Install]
WantedBy=rescue.target
</echo>
<echo file="${sysdir}/lib/systemd/system/reduce-locales">#!/bin/sh
/sbin/fsck -yf /dev/${SECONDARY}2
/bin/mount -o discard /dev/${SECONDARY}2 /mnt
rm /mnt/usr/lib/locale/locale-archive
chroot mnt localedef -i en_GB -f UTF-8 en_GB.UTF-8
/bin/umount /dev/${SECONDARY}2
/bin/mount -o remount,rw /
/usr/bin/touch /.success
/bin/rm -rf /etc/systemd/system/rescue.target.wants
/bin/rm /lib/systemd/system/reduce-locales.service
/bin/rm /lib/systemd/system/reduce-locales
</echo>
<chmod file="${sysdir}/lib/systemd/system/reduce-locales" perm="755"/>
<mkdir dir="${sysdir}/etc/systemd/system/rescue.target.wants"/>
<exec executable="ln" failonerror="true">
<arg line="-s /lib/systemd/system/reduce-locales.service ${sysdir}/etc/systemd/system/rescue.target.wants/reduce-locales.service"/>
</exec>
</target>
<target name="check-reduce-locales-success">
<antcall target="mount"/>
<available file="${sysdir}/.success" property="success"/>
<delete file="${sysdir}/.success"/>
<antcall target="unmount"/>
<fail message="Locale reduction has failed" unless="success"/>
</target>
<target name="build-image">
<fail unless="BOARD" message="Correct machine type must be specified"/>
<antcall target="mount"/>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment