mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-03-19 07:32:20 +00:00
Clean up the code.
This commit is contained in:
parent
05d123b27f
commit
498bc9aa2b
@ -86,19 +86,17 @@ fi
|
||||
# Link output files somewhere launchpad-buildd will be able to find them.
|
||||
PREFIX="livecd.$PROJECT${SUBARCH:+-$SUBARCH}"
|
||||
|
||||
if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then
|
||||
# Use ubuntu-image instead of live-build
|
||||
if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ] \
|
||||
|| [ "$PROJECT" = "ubuntu-core-desktop" ]; then
|
||||
# Use ubuntu-image instead (or as part) of live-build
|
||||
|
||||
export SNAPPY_STORE_NO_CDN=1
|
||||
LB_UBUNTU_IMAGE_CHANNEL="${LB_UBUNTU_IMAGE_CHANNEL:-stable}"
|
||||
snap install \
|
||||
--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
|
||||
# Ubuntu Core images
|
||||
/snap/bin/ubuntu-image snap $UBUNTU_IMAGE_ARGS \
|
||||
-O output "$PREFIX".model-assertion
|
||||
# XXX: currently we only have one image generated, but really
|
||||
@ -107,32 +105,42 @@ if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then
|
||||
mv output/*.img "$PREFIX".img
|
||||
xz -0 -T4 "$PREFIX".img
|
||||
mv output/seed.manifest "$PREFIX".manifest
|
||||
|
||||
# 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
|
||||
# ubuntu-image twice, once for the core image payload and
|
||||
# then for the actual image.
|
||||
echo "Building the core image payload"
|
||||
cd config/
|
||||
/snap/bin/ubuntu-image snap $UBUNTU_IMAGE_PAYLOAD_ARGS \
|
||||
-O output ubuntu-core-desktop*.model-assertion
|
||||
mv output/*.img pc.img
|
||||
xz -0 -T4 pc.img
|
||||
rm -rf output/
|
||||
|
||||
# Prepare the source catalogue
|
||||
cat install-sources-in.yaml | sed "s/@SIZE@/$(stat -c%s pc.img.xz)/g" > ../"$PREFIX".install-sources.yaml
|
||||
|
||||
# We need to rename the image file so that it can be pulled
|
||||
# by the builder.
|
||||
mv pc.img.xz ../"$PREFIX".img.xz
|
||||
|
||||
# We need to make sure the autoinstall file is also exported.
|
||||
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
|
||||
if [ "$PROJECT" = "ubuntu-core-desktop" ]; then
|
||||
# Special case for ubuntu-core-desktop - we need to call
|
||||
# ubuntu-image twice, once for the core image payload and
|
||||
# then for the actual image.
|
||||
echo "Building the core image payload"
|
||||
cd config/
|
||||
/snap/bin/ubuntu-image snap $UBUNTU_IMAGE_PAYLOAD_ARGS \
|
||||
-O output ubuntu-core-desktop*.model-assertion
|
||||
mv output/*.img pc.img
|
||||
xz -0 -T4 pc.img
|
||||
rm -rf output/
|
||||
# Prepare the source catalogue
|
||||
cat install-sources-in.yaml | sed "s/@SIZE@/$(stat -c%s pc.img.xz)/g" > 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,
|
||||
# let's provide the payload assertion here already.
|
||||
mkdir -p output/
|
||||
cp config/ubuntu-core-desktop*.model-assertion output/
|
||||
|
||||
echo "Image payload build completed, continuing"
|
||||
fi
|
||||
# Ubuntu classic preinstalled images
|
||||
/snap/bin/ubuntu-image classic --verbose $UBUNTU_IMAGE_ARGS \
|
||||
-O output "$IMAGE_DEFINITION"
|
||||
# Since the output of the ubuntu-image call can vary based on what
|
||||
@ -150,9 +158,10 @@ if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then
|
||||
mv $artifact "$PREFIX".$extension
|
||||
done
|
||||
[ -f $PREFIX.img ] && xz -0 -T4 "$PREFIX".img
|
||||
fi
|
||||
|
||||
exit 0
|
||||
# All the builds are finished now, exit
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$PROJECT" = "ubuntu-core-desktop" ]; then
|
||||
|
@ -513,18 +513,6 @@ case $IMAGEFORMAT in
|
||||
ubuntu-cpc)
|
||||
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
|
||||
|
||||
LB_UBUNTU_IMAGES_REPO="${LB_UBUNTU_IMAGES_REPO:-git://git.launchpad.net/ubuntu-images}"
|
||||
|
@ -1 +0,0 @@
|
||||
network: {config: disabled}
|
@ -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…
x
Reference in New Issue
Block a user