Commit 70604528 authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Added common build-image target

parent 65d27c90
...@@ -354,6 +354,8 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin ...@@ -354,6 +354,8 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin
SECONDARY="${SECONDARY}" SECONDARY="${SECONDARY}"
export LC_ALL PATH SECONDARY HOSTTYPE export LC_ALL PATH SECONDARY HOSTTYPE
mount -o remount,rw /
mkdir /build mkdir /build
mount /dev/${SECONDARY}1 /build mount /dev/${SECONDARY}1 /build
make -C /build/packages/linux boot-${BOARD} make -C /build/packages/linux boot-${BOARD}
...@@ -407,6 +409,87 @@ rm /lib/systemd/system/build ...@@ -407,6 +409,87 @@ rm /lib/systemd/system/build
</exec> </exec>
</target> </target>
<target name="build-image">
<antcall target="mount"/>
<antcall target="setup-build"/>
<antcall target="unmount"/>
<antcall target="make-secondary"/>
<antcall target="mount-secondary"/>
<antcall target="fill-secondary"/>
<antcall target="unmount"/>
<antcall target="run-system-with-secondary-${BOARD}"/>
<antcall target="check-build-success"/>
</target>
<target name="setup-build">
<delete file="${sysdir}/.success"/>
<echo file="${sysdir}/lib/systemd/system/machine-id.service">[Unit]
Description=Setup /etc/machine-id
Before=systemd-networkd.service
After=local-fs.target
[Service]
Type=oneshot
StandardOutput=tty
ExecStart=/bin/systemd-machine-id-setup
[Install]
WantedBy=rescue.target
</echo>
<echo file="${sysdir}/lib/systemd/system/build.service">[Unit]
Description=Build ${ant.project.name}
After=network-online.target
Wants=systemd-networkd.service
Wants=systemd-resolved.service
[Service]
Type=oneshot
StandardOutput=tty
ExecStart=/lib/systemd/system/build
ExecStartPost=/sbin/poweroff
[Install]
WantedBy=rescue.target
</echo>
<echo file="${sysdir}/lib/systemd/system/build">#!/bin/sh
LC_ALL=POSIX
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PROJECT_NAME="${ant.project.name}"
ID="${ID}"
PRETTY_NAME="${PRETTY_NAME}"
HOSTNAME="${HOSTNAME}"
VERSION="${VERSION}"
BUILD_ID=${BUILD_ID}
ARTIFACT_NAME=${ARTIFACT_NAME}
DEVICE_TYPE=${DEVICE_TYPE}
CONSOLE="${CONSOLE}"
ROOT_DEVICE="${ROOT_DEVICE}"
DISK="${DISK}"
SECONDARY="${SECONDARY}"
export LC_ALL PATH PROJECT_NAME ID PRETTY_NAME HOSTNAME VERSION BUILD_ID ARTIFACT_NAME DEVICE_TYPE CONSOLE ROOT_DEVICE DISK SECONDARY HOSTTYPE
mount -o remount,rw /
mkdir /build
mount /dev/${SECONDARY}1 /build
make -C /build/packages
if [ $? -eq 0 ]; then
umount /dev/${SECONDARY}1
rm -rf /build
fi
rm -rf /etc/systemd/system/rescue.target.wants
rm /lib/systemd/system/machine-id.service
rm /lib/systemd/system/build.service
rm /lib/systemd/system/build
</echo>
<chmod file="${sysdir}/lib/systemd/system/build" perm="755"/>
<mkdir dir="${sysdir}/etc/systemd/system/rescue.target.wants"/>
<exec executable="ln" failonerror="true">
<arg line="-s /lib/systemd/system/build.service ${sysdir}/etc/systemd/system/rescue.target.wants/build.service"/>
</exec>
</target>
<target name="check-build-success"> <target name="check-build-success">
<antcall target="mount"/> <antcall target="mount"/>
<available file="${sysdir}/.success" property="success"/> <available file="${sysdir}/.success" property="success"/>
......
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