Clean up the code.

ubuntu-core-desktop
Łukasz 'sil2100' Zemczak 8 months ago
parent 05d123b27f
commit 498bc9aa2b

@ -86,19 +86,17 @@ fi
# Link output files somewhere launchpad-buildd will be able to find them. # Link output files somewhere launchpad-buildd will be able to find them.
PREFIX="livecd.$PROJECT${SUBARCH:+-$SUBARCH}" PREFIX="livecd.$PROJECT${SUBARCH:+-$SUBARCH}"
if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ] \
# Use ubuntu-image instead of live-build || [ "$PROJECT" = "ubuntu-core-desktop" ]; then
# Use ubuntu-image instead (or as part) of live-build
export SNAPPY_STORE_NO_CDN=1 export SNAPPY_STORE_NO_CDN=1
LB_UBUNTU_IMAGE_CHANNEL="${LB_UBUNTU_IMAGE_CHANNEL:-stable}" LB_UBUNTU_IMAGE_CHANNEL="${LB_UBUNTU_IMAGE_CHANNEL:-stable}"
snap install \ snap install \
--classic --channel="$LB_UBUNTU_IMAGE_CHANNEL" ubuntu-image --classic --channel="$LB_UBUNTU_IMAGE_CHANNEL" ubuntu-image
# TODO: eventually, this should be handled by a single ubuntu-image
# call without having to do a conditional on ubuntu-core/classic.
# We could already do that, but then we'd still have to do the
# compressing for the core images.
if [ "$PROJECT" = "ubuntu-core" ]; then if [ "$PROJECT" = "ubuntu-core" ]; then
# Ubuntu Core images
/snap/bin/ubuntu-image snap $UBUNTU_IMAGE_ARGS \ /snap/bin/ubuntu-image snap $UBUNTU_IMAGE_ARGS \
-O output "$PREFIX".model-assertion -O output "$PREFIX".model-assertion
# XXX: currently we only have one image generated, but really # XXX: currently we only have one image generated, but really
@ -107,8 +105,11 @@ if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then
mv output/*.img "$PREFIX".img mv output/*.img "$PREFIX".img
xz -0 -T4 "$PREFIX".img xz -0 -T4 "$PREFIX".img
mv output/seed.manifest "$PREFIX".manifest mv output/seed.manifest "$PREFIX".manifest
else
if [ "$PROJECT" = "ubuntu-core-desktop" ]; then # All the builds are finished now, exit
exit 0
elif [ "$PROJECT" = "ubuntu-core-desktop" ]; then
# Ubuntu Core Desktop payload image
# Special case for ubuntu-core-desktop - we need to call # Special case for ubuntu-core-desktop - we need to call
# ubuntu-image twice, once for the core image payload and # ubuntu-image twice, once for the core image payload and
# then for the actual image. # then for the actual image.
@ -119,20 +120,27 @@ if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then
mv output/*.img pc.img mv output/*.img pc.img
xz -0 -T4 pc.img xz -0 -T4 pc.img
rm -rf output/ rm -rf output/
# Prepare the source catalogue # Prepare the source catalogue
cat install-sources-in.yaml | sed "s/@SIZE@/$(stat -c%s pc.img.xz)/g" > install-sources.yaml cat install-sources-in.yaml | sed "s/@SIZE@/$(stat -c%s pc.img.xz)/g" > ../"$PREFIX".install-sources.yaml
# Now move all of the payload to the image-definitions directory,
# so that they can be used by the image-definition effectively.
mv install-sources.yaml pc.img.xz autoinstall.yaml 99-custom-networking.cfg casper* ../image-definitions/
cd ../
# Also, since we care about the model assertion to be presented, # We need to rename the image file so that it can be pulled
# let's provide the payload assertion here already. # by the builder.
mkdir -p output/ mv pc.img.xz ../"$PREFIX".img.xz
cp config/ubuntu-core-desktop*.model-assertion output/
echo "Image payload build completed, continuing" # We need to make sure the autoinstall file is also exported.
fi mv autoinstall.yaml ../"$PREFIX".autoinstall.yaml
# Useful to have the model-assertion exported as well.
mv ubuntu-core-desktop*.model-assertion ../"$PREFIX".model-assertion
# Important: return to the previous directory
cd ../
# Payload build finished, but now we need to build the rest with the
# usual live-build tools.
else
# Ubuntu classic preinstalled images
/snap/bin/ubuntu-image classic --verbose $UBUNTU_IMAGE_ARGS \ /snap/bin/ubuntu-image classic --verbose $UBUNTU_IMAGE_ARGS \
-O output "$IMAGE_DEFINITION" -O output "$IMAGE_DEFINITION"
# Since the output of the ubuntu-image call can vary based on what # Since the output of the ubuntu-image call can vary based on what
@ -150,10 +158,11 @@ if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then
mv $artifact "$PREFIX".$extension mv $artifact "$PREFIX".$extension
done done
[ -f $PREFIX.img ] && xz -0 -T4 "$PREFIX".img [ -f $PREFIX.img ] && xz -0 -T4 "$PREFIX".img
fi
# All the builds are finished now, exit
exit 0 exit 0
fi fi
fi
if [ "$PROJECT" = "ubuntu-core-desktop" ]; then if [ "$PROJECT" = "ubuntu-core-desktop" ]; then
export SNAPPY_STORE_NO_CDN=1 export SNAPPY_STORE_NO_CDN=1

@ -513,18 +513,6 @@ case $IMAGEFORMAT in
ubuntu-cpc) ubuntu-cpc)
IMAGE_PROJECT="ubuntu-server" IMAGE_PROJECT="ubuntu-server"
;; ;;
ubuntu-core-desktop)
# The ubuntu-core-desktop case is special as we need 2 ubuntu-image calls:
# one for the payload and one for the actual image
echo "Configuring for additional payload preparation"
UBUNTU_IMAGE_PAYLOAD_ARGS="--image-size 12G"
EXTRA_SNAPS="$EXTRA_SNAPS evince firefox gnome-calculator gnome-characters gnome-clocks gnome-font-viewer gnome-logs gnome-system-monitor gnome-text-editor gnome-weather loupe snapd-desktop-integration snap-store ubuntu-core-desktop-init workshops"
for snap in $EXTRA_SNAPS; do
UBUNTU_IMAGE_PAYLOAD_ARGS="$UBUNTU_IMAGE_PAYLOAD_ARGS --snap $snap"
done
echo "UBUNTU_IMAGE_PAYLOAD_ARGS=\"$UBUNTU_IMAGE_PAYLOAD_ARGS\"" >> config/common
cp -a /usr/share/livecd-rootfs/live-build/$PROJECT/* config/
;;
esac esac
LB_UBUNTU_IMAGES_REPO="${LB_UBUNTU_IMAGES_REPO:-git://git.launchpad.net/ubuntu-images}" LB_UBUNTU_IMAGES_REPO="${LB_UBUNTU_IMAGES_REPO:-git://git.launchpad.net/ubuntu-images}"

@ -1,3 +0,0 @@
#!/bin/sh
/usr/bin/systemctl enable casper

@ -1,43 +0,0 @@
#!/bin/sh
# Author: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
# Tollef Fog Heen <tfheen@canonical.com>
# Marco Amadori <marco.amadori@gmail.com>
#
PATH=/usr/sbin:/usr/bin:/sbin:/bin
do_stop ()
{
prompt=1
if grep -qs noprompt /proc/cmdline || [ -e /run/casper-no-prompt ]; then
prompt=
fi
# XXX - i18n
MSG="Please press ENTER then remove the installation medium: "
MSG_FALLBACK="Please remove the installation medium, then reboot."
if [ "$prompt" ]; then
if [ -x /bin/plymouth ] && plymouth --ping; then
chvt 63
plymouth message --text="$MSG"
clear > /dev/tty1
echo $MSG_FALLBACK > /dev/tty1
else
stty sane < /dev/console
echo $MSG > /dev/console
fi
fi
[ "$prompt" ] || return 0
if [ -x /bin/plymouth ] && plymouth --ping; then
plymouth watch-keystroke > /dev/null
else
read x < /dev/console
fi
}
do_stop

@ -1,16 +0,0 @@
[Unit]
Description=Shuts down the "live" preinstalled system cleanly
DefaultDependencies=no
Before=final.target
After=shutdown.target umount.target plymouth-halt.service plymouth-poweroff.service plymouth-reboot.service
[Service]
Type=oneshot
ExecStart=/sbin/casper-stop
StandardInput=tty-force
StandardOutput=inherit
StandardError=inherit
TTYReset=yes
[Install]
WantedBy=final.target
Loading…
Cancel
Save