Imported 2.821

No reason for CPC update specified.
This commit is contained in:
CloudBuilder 2023-04-08 02:48:12 +00:00
parent d3fa5efeea
commit dcb48eae8d
29 changed files with 550 additions and 41 deletions

22
debian/changelog vendored
View File

@ -1,3 +1,25 @@
livecd-rootfs (2.821) lunar; urgency=medium
[ Chad Smith ]
* desktop livecd: allow cloud-init to write netplan config instead of
directly to /etc/NetworkManager because ubuntu-desktop-installer
will write netplan config in ephemeral boot stage when
autoinstall.network is provided. This allows ubuntu-desktop-installer
to control all netplan config written and apply to the ephemeral boot
as generated from /etc/netplan/*. (LP: #2015605)
[ Dan Bungert ]
* d/control: fix uninstallability of livecd-rootfs due to rsync not being on
i386.
-- Dan Bungert <daniel.bungert@canonical.com> Fri, 07 Apr 2023 17:24:28 -0600
livecd-rootfs (2.820) lunar; urgency=medium
* Initial implementation of canary image builds for 23.04.
-- Łukasz 'sil2100' Zemczak <lukasz.zemczak@ubuntu.com> Wed, 05 Apr 2023 20:50:35 +0200
livecd-rootfs (2.819) lunar; urgency=medium livecd-rootfs (2.819) lunar; urgency=medium
[ Heinrich Schuchardt ] [ Heinrich Schuchardt ]

1
debian/control vendored
View File

@ -34,6 +34,7 @@ Depends: ${misc:Depends},
python3-launchpadlib [!i386], python3-launchpadlib [!i386],
python3-yaml, python3-yaml,
qemu-utils [!i386], qemu-utils [!i386],
rsync [!i386],
snapd (>= 2.39) [!i386], snapd (>= 2.39) [!i386],
squashfs-tools (>= 1:3.3-1), squashfs-tools (>= 1:3.3-1),
sudo, sudo,

View File

@ -95,6 +95,13 @@ _register_pass () {
PASSES="$PASSES $1" PASSES="$PASSES $1"
} }
add_pass ()
{
local pass="$1"
_check_immutable_passes_to_layers
_register_pass "$pass"
}
add_task () add_task ()
{ {
local pass="$1" local pass="$1"
@ -731,6 +738,60 @@ case $PROJECT in
;; ;;
esac esac
;; ;;
canary)
PASSES_TO_LAYERS="true"
# the minimal layer, for minimal installs
add_task minimal minimal standard ubuntu-desktop-minimal ubuntu-desktop-minimal-default-languages
add_package minimal cloud-init
# the standard layer, contains all base common packages for later layers (we're splitting out the snaps)
add_task minimal.standard ubuntu-desktop ubuntu-desktop-default-languages
# the classic layer, basically only contains snaps from the standard tasks
add_pass minimal.standard.classic
mv config/package-lists/livecd-rootfs.snaplist.chroot_minimal.standard.full \
config/package-lists/livecd-rootfs.snaplist.chroot_minimal.standard.classic.full
# the live layer, contains all packages for the live session installer
# TODO: we should probably add the kernel per KERNEL_FLAVOURS
add_package minimal.standard.live linux-generic casper lvm2 mdadm
remove_package minimal.standard.live ubiquity-frontend-gtk
# the enhanced-secureboot layer, contains all packages for the enhanced secureboot install
add_package minimal.standard.enhanced-secureboot cryptsetup
# now let's create the neccessary catalog files
# TODO: make sure that we handle locale_support: langpack correctly
cat <<-EOF > config/minimal.catalog-in.yaml
name: "Ubuntu Desktop (minimized)"
description: >-
A minimal but usable Ubuntu Desktop.
id: ubuntu-desktop-minimal
type: fsimage-layered
variant: desktop
locale_support: none
EOF
cat <<-EOF > config/minimal.standard.catalog-in.yaml
name: "Ubuntu Desktop"
description: >-
A full featured Ubuntu Desktop.
id: ubuntu-desktop
type: fsimage-layered
variant: desktop
locale_support: none
default: yes
EOF
cat <<-EOF > config/minimal.standard.classic.catalog-in.yaml
id: ubuntu-desktop
variations:
classic:
path: minimal.standard.squashfs
EOF
cat <<-EOF > config/minimal.standard.enhanced-secureboot.catalog-in.yaml
id: ubuntu-desktop
variations:
enhanced-secureboot:
path: minimal.standard.enhanced-secureboot.squashfs
snapd_system_label: enhanced-secureboot-desktop
EOF
/usr/share/livecd-rootfs/checkout-translations-branch \
https://git.launchpad.net/subiquity po config/catalog-translations
;;
*) *)
touch config/universe-enabled touch config/universe-enabled
PASSES_TO_LAYERS="true" PASSES_TO_LAYERS="true"
@ -1189,7 +1250,7 @@ case "$ARCH${SUBARCH:++$SUBARCH}" in
esac esac
case $PROJECT:${SUBPROJECT:-} in case $PROJECT:${SUBPROJECT:-} in
ubuntu-server:*|ubuntu-base:*|ubuntu-oci:*) ubuntu-server:*|ubuntu-base:*|ubuntu-oci:*|ubuntu:canary)
OPTS="${OPTS:+$OPTS }--linux-packages=none --initramfs=none" OPTS="${OPTS:+$OPTS }--linux-packages=none --initramfs=none"
KERNEL_FLAVOURS=none KERNEL_FLAVOURS=none
BINARY_REMOVE_LINUX=false BINARY_REMOVE_LINUX=false
@ -1433,7 +1494,7 @@ EOF
fi fi
;; ;;
ubuntu-cpc:*|ubuntu-server:live|ubuntu:desktop-preinstalled|ubuntu-wsl:*|ubuntu-mini-iso:*) ubuntu-cpc:*|ubuntu-server:live|ubuntu:desktop-preinstalled|ubuntu-wsl:*|ubuntu-mini-iso:*|ubuntu:canary)
# Ensure that most things e.g. includes.chroot are copied as is # Ensure that most things e.g. includes.chroot are copied as is
for entry in /usr/share/livecd-rootfs/live-build/${PROJECT}/*; do for entry in /usr/share/livecd-rootfs/live-build/${PROJECT}/*; do
case $entry in case $entry in

View File

@ -1008,17 +1008,18 @@ network:
version: 2 version: 2
renderer: NetworkManager renderer: NetworkManager
EOF EOF
# Do not limit cloud-init renderers to network-manager as suggested
# in LP: #1982855 because subiquity needs to render full networking
# in ephemeral boot time when autoinstall.network is provided.
# Neither subiquity nor netplan is aware of /etc/NetworkManager config
# artifacts emmitted by cloud-init. It's best if cloud-init reports
# network config directly to /etc/netplan with the configured netplan
# backend: NetworkManager per 01-network-manager-all.yaml above.
# inform cloud-init of the same (LP: #1982855) # cloud-init's default renderer discovery will prefer netplan.
mkdir -p chroot/etc/cloud/cloud.cfg.d # Any time subiquity needs to write and apply network config
cat <<EOF > chroot/etc/cloud/cloud.cfg.d/99-installer-use-networkmanager.cfg # it disables all previous network config in /etc/netplan so
${AUTOMATION_HEADER} # any previous 50-cloud-init.yaml will be rendered inert.
# Let NetworkManager manage all devices on this system
system_info:
network:
renderers: ['network-manager']
activators: ['network-manager']
EOF
# Position cloud-init.service After=NetworkManager.service. # Position cloud-init.service After=NetworkManager.service.
# (LP: #2008952). # (LP: #2008952).

View File

@ -116,7 +116,9 @@ build_layered_squashfs () {
create_manifest "chroot" "${squashfs_f_manifest}.full" create_manifest "chroot" "${squashfs_f_manifest}.full"
# Delta manifest # Delta manifest
diff -NU0 ${PWD}/livecd.${PROJECT_FULL}.$(get_parent_pass $pass).manifest.full ${squashfs_f_manifest}.full|grep -v ^@ > $squashfs_f_manifest diff -NU0 ${PWD}/livecd.${PROJECT_FULL}.$(get_parent_pass $pass).manifest.full ${squashfs_f_manifest}.full|grep -v ^@ > $squashfs_f_manifest || true
echo "Delta manifest:"
cat $squashfs_f_manifest
squashfs_f_size="${base}.size" squashfs_f_size="${base}.size"
du -B 1 -s "overlay.${pass}/" | cut -f1 > "${squashfs_f_size}" du -B 1 -s "overlay.${pass}/" | cut -f1 > "${squashfs_f_size}"

View File

@ -9,7 +9,11 @@ case $ARCH in
;; ;;
esac esac
case ${PROJECT:-} in case ${PROJECT:-}:${SUBPROJECT:-} in
*:canary)
echo "We don't create EFI images for canary."
exit 0
;;
ubuntu) ubuntu)
IMAGE_STR="# DESKTOP_IMG: This file was created/modified by the Desktop Image build process" IMAGE_STR="# DESKTOP_IMG: This file was created/modified by the Desktop Image build process"
FS_LABEL="desktop-rootfs" FS_LABEL="desktop-rootfs"

View File

@ -0,0 +1,116 @@
#! /bin/sh
set -eux
case $PASS in
minimal.standard.enhanced-secureboot)
;;
*)
exit 0
;;
esac
case ${SUBPROJECT:-} in
canary)
;;
*)
echo "We don't run canary hooks for this project."
exit 0
;;
esac
/usr/lib/snapd/snap-preseed --reset $(realpath "chroot")
rm -rf chroot/var/lib/snapd/seed/*
# env SNAPPY_STORE_NO_CDN=1 snap known --remote model series=16 brand-id=canonical model=ubuntu-classic-2304-amd64 > config/classic-model.model
cat <<EOF > config/classic-model.model
type: model
authority-id: canonical
series: 16
brand-id: canonical
model: ubuntu-classic-2304-amd64
architecture: amd64
base: core22
classic: true
distribution: ubuntu
grade: signed
snaps:
-
default-channel: classic-23.04/stable
id: UqFziVZDHLSyO3TqSWgNBoAdHbLI4dAH
name: pc
type: gadget
-
default-channel: 24-hwe/stable
id: pYVQrBcKmBa0mZ4CCN7ExT6jH8rY1hza
name: pc-kernel
type: kernel
-
default-channel: latest/stable
id: amcUKQILKXHHTlmSa7NMdnXSx02dNeeT
name: core22
type: base
-
default-channel: latest/stable
id: PMrrV4ml8uWuEUDBT8dSGnKUYbevVhc4
name: snapd
type: snapd
-
default-channel: latest/stable
id: DLqre5XGLbDqg9jPtiAhRRjDuPVa5X1q
name: core20
type: base
-
default-channel: latest/stable
id: EISPgh06mRh1vordZY9OZ34QHdd7OrdR
name: bare
type: base
-
default-channel: latest/stable
id: 3wdHCAVyZEmYsCMFDE9qt92UV8rC8Wdk
name: firefox
type: app
-
default-channel: latest/stable
id: rw36mkAjdIKl13dzfwyxP87cejpyIcct
name: gnome-3-38-2004
type: app
-
default-channel: latest/stable
id: lATO8HzwVvrAPrlZRAWpfyrJKlAJrZS3
name: gnome-42-2204
type: app
-
default-channel: latest/stable
id: jZLfBRzf1cYlYysIjD2bwSzNtngY0qit
name: gtk-common-themes
type: app
-
default-channel: latest/stable
id: gjf3IPXoRiipCu9K0kVu52f0H56fIksg
name: snap-store
type: app
-
default-channel: latest/stable
id: IrwRHakqtzhFRHJOOPxKVPU0Kk7Erhcu
name: snapd-desktop-integration
type: app
timestamp: 2023-03-19T12:00:00.0Z
sign-key-sha3-384: 9tydnLa6MTJ-jaQTFUXEwHl1yRx7ZS4K5cyFDhYDcPzhS7uyEkDxdUjg9g08BtNn
AcLBXAQAAQoABgUCZC4CDgAKCRDgT5vottzAEiFvEACU9KsUFmAcShhpIz+NRGVP6d1Z+bW1FcUf
Cxl2UParnXR7Kv12htnw5u837MZjI3gG8kti2L2SxRcg/fy3iJLkTRBEaR/q6rY4O0fkasJUKxHh
z6xx2jaNhsUqnplU5gba9xmmaI5AQp4yf1ktF71HAeM4OzUFrCkjXNTbf7xfkKENxuAOfsPetu5c
6Xc8UtQymtYnjsyvtaLNoXl9vVN59nqk/sxWkwJRtYrFX+Fjt1R/ft4Fo1U7x/OeUX1qpFHSEgnR
NPxzJQ0uzaCamXY1qu1iq6R925eah22auOQM2m/CTzOMdI3IuRAqnLsrk9HpGXz2gWKLS/UEfAlr
OMOoV64DHnQ6k8pwjiYt4K9zNxNKK1MB9hnUBOWYb69pgqoQ2djo6codlxknANN4g3zsUH8KDHb8
9wNEu7WuYS8JIDpdrNGB5XKo+N5+WswfqX0Oh1mtPMw+DqIA8GkxJFC452Afv7+VDQUZs5wIe7OX
oQ5Q/u5X7WyKpqTdRi0J4/Eq61HidYOOW26Vc8MNArn1u0eabZBtHrxMOHCxu0hmsLHaXQSBljdr
Ekm0W8qT4AT0GSk5CY8kx+UvCn6FLxMuv8xjWoX3OLcQx31yO6Uy6c2LN6nSlovDghKP5V1KvlKl
WiXM9CPKCZv/Es3uOp/ke0wWL7v0MZhzUJ+QhOtTNg==
EOF
env SNAPPY_STORE_NO_CDN=1 snap prepare-image --classic config/classic-model.model chroot
mv chroot/system-seed/systems/* chroot/system-seed/systems/classic
rsync -a chroot/system-seed/ chroot/var/lib/snapd/seed
rm -rf chroot/system-seed/

View File

@ -0,0 +1,96 @@
#! /bin/sh
set -eux
case $PASS in
minimal.standard.live)
;;
*)
exit 0
;;
esac
case ${SUBPROJECT:-} in
canary)
;;
*)
echo "We don't run canary hooks for this project."
exit 0
;;
esac
# env SNAPPY_STORE_NO_CDN=1 snap known --remote model series=16 brand-id=canonical model=ubuntu-server-installer-classic-2304-amd64 > config/classic-model-installer.model
cat <<EOF > config/classic-model-installer.model
type: model
authority-id: canonical
series: 16
brand-id: canonical
model: ubuntu-server-installer-classic-2304-amd64
architecture: amd64
base: core22
classic: true
distribution: ubuntu
grade: signed
snaps:
-
default-channel: latest/stable
id: amcUKQILKXHHTlmSa7NMdnXSx02dNeeT
name: core22
type: base
-
default-channel: latest/stable
id: PMrrV4ml8uWuEUDBT8dSGnKUYbevVhc4
name: snapd
type: snapd
-
classic: true
default-channel: latest/stable/canary-23.04
id: ba2aj8guta0zSRlT3QM5aJNAUXPlBtf9
name: subiquity
type: app
timestamp: 2023-03-19T12:00:00.0Z
sign-key-sha3-384: 9tydnLa6MTJ-jaQTFUXEwHl1yRx7ZS4K5cyFDhYDcPzhS7uyEkDxdUjg9g08BtNn
AcLBXAQAAQoABgUCZCT4iAAKCRDgT5vottzAEkmPD/46nms8edTFkoiiH/SjAdyo8MW2FhR3tW03
CyH1NQwrNJtHiqb7EcWQHDPexM3Wxvwj2iPN04IWlGugge7Fw12AmhVsYYCnCjYjDL8uBa9ixBj3
kghOsFlVbDBk+f5tLmNGNncQfPbV6TvywK9a+2zgVEdRdLlmNeorX3b7P0woCIWg9wEikX+vcLi/
q1GvWtI4Gb/rAIN+/OaD4DFgbJSUdSaayGX90hbNtvsZc0K7KPTeNlF0IGKg72yvqBGDX/0m2IDb
6HozMxGg7xcq+WwHU3hucBNqw6kWKKDd1gzZJICrJf9kLEZ7GoGa8Oj9eET+bp2KYVHzjNzHvQbd
v4odCG3Wn7m5ogpPmt/mUoTOhVtY/RNGnk46eHAFHuFcPAjR1BnIfLLmh4EmEnkIboTrlBKFgHMW
ddFSOFYonboYu7R9Gad3J+9VD5IyyNqJNpCrEqLfw81QaFz1+KM00XD+wns2+ZqnI90a6olXcmUH
t1Fv0QIDNCG0x8Lf+My/gJycNCEbUj+TA6xOL9NH0EFU6myKyR74sC5tlMZPMN2RKdZglOZUnkyC
lpuhRVI3fcNZL2sVGwmvoKUDj7QaLrETpCUqDXMzNw73NOS3zA8+gQr/X438KpEFscszS1g+FtJ4
LVOcgLrDw/S61ciBuOBeOaskqZdZ4xYmm1wKMzecXg==
EOF
env SNAPPY_STORE_NO_CDN=1 snap prepare-image --classic config/classic-model-installer.model chroot
mv chroot/system-seed/systems/* chroot/system-seed/systems/classic-installer
rsync -a chroot/system-seed/ chroot/var/lib/snapd/seed
rm -rf chroot/system-seed/
cat <<EOF > chroot/var/lib/snapd/modeenv
mode=run
recovery_system=classic-installer
EOF
# Temporary while we still use the subiquity TUI for the live system
cat > chroot/usr/lib/systemd/user/subiquity-tui.service << EOF
[Unit]
Description=subiquity tui
PartOf=graphical-session.target
After=graphical-session.target
# Never run in GDM
Conflicts=gnome-session@gnome-login.target
[Service]
Type=simple
ExecStart=/usr/bin/gnome-terminal --wait -- sudo sh -c 'echo waiting for snapd; snap wait system seed.loaded; sleep 5; snap run subiquity'
Restart=no
EOF
mkdir chroot/etc/systemd/user/graphical-session.target.wants/
ln -vs /usr/lib/systemd/user/subiquity-tui.service chroot/etc/systemd/user/graphical-session.target.wants/
mv chroot/boot/initrd.img-* ${PWD}/livecd.${PROJECT}.initrd-generic
mv chroot/boot/vmlinu?-* ${PWD}/livecd.${PROJECT}.kernel-generic
chmod a+r ${PWD}/livecd.${PROJECT}.initrd-generic ${PWD}/livecd.${PROJECT}.kernel-generic

View File

@ -0,0 +1,21 @@
#! /bin/sh
set -eu
case $PASS in
minimal.standard.live)
;;
*)
exit 0
;;
esac
# TODO: Make sure this is only executed for canary builds
cat <<EOF > /etc/initramfs-tools/conf.d/casperize.conf
export CASPER_GENERATE_UUID=1
EOF
cat <<EOF > /etc/initramfs-tools/conf.d/default-layer.conf
LAYERFS_PATH=${PASS}.squashfs
EOF

View File

@ -3,7 +3,7 @@
echo "Creating Hyper-V image with Desktop..." echo "Creating Hyper-V image with Desktop..."
case ${SUBPROJECT:-} in case ${SUBPROJECT:-} in
minimized) minimized|canary)
echo "We don't create minimized images for $0." echo "We don't create minimized images for $0."
exit 0 exit 0
;; ;;

View File

@ -0,0 +1,117 @@
# The top level settings are used as module
# and system configuration.
# A set of users which may be applied and/or used by various modules
# when a 'default' entry is found it will reference the 'default_user'
# from the distro configuration specified below
users:
- default
# If this is set, 'root' will not be able to ssh in and they
# will get a message to login instead as the default $user
disable_root: true
# This will cause the set+update hostname module to not operate (if true)
preserve_hostname: true
ssh_pwauth: yes
chpasswd:
expire: false
# This is the initial network config.
# It can be overwritten by cloud-init or subiquity.
network:
version: 2
ethernets:
zz-all-en:
match:
name: "en*"
dhcp4: true
zz-all-eth:
match:
name: "eth*"
dhcp4: true
# We used to have a custom final_message here. Just use the default instead.
# Example datasource config
# datasource:
# Ec2:
# metadata_urls: [ 'blah.com' ]
# timeout: 5 # (defaults to 50 seconds)
# max_wait: 10 # (defaults to 120 seconds)
# The modules that run in the 'init' stage
cloud_init_modules:
- bootcmd
- write-files
- ca-certs
- rsyslog
- users-groups
- ssh
# The modules that run in the 'config' stage
cloud_config_modules:
# Emit the cloud config ready event
# this can be used by upstart jobs for 'start on cloud-config'.
- ssh-import-id
- set-passwords
- timezone
- disable-ec2-metadata
- runcmd
# The modules that run in the 'final' stage
cloud_final_modules:
- scripts-per-once
- scripts-user
- ssh-authkey-fingerprints
- keys-to-console
- phone-home
- final-message
# System and/or distro specific settings
# (not accessible to handlers/transforms)
system_info:
# This will affect which distro class gets used
distro: ubuntu
# Default user name + that default users groups (if added/used)
default_user:
name: installer
lock_passwd: false
gecos: Ubuntu
groups: [adm, audio, cdrom, dialout, dip, floppy, lxd, netdev, plugdev, sudo, video]
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
shell: /usr/bin/subiquity-shell
# Automatically discover the best ntp_client
ntp_client: auto
# Other config here will be given to the distro class and/or path classes
paths:
cloud_dir: /var/lib/cloud/
templates_dir: /etc/cloud/templates/
upstart_dir: /etc/init/
package_mirrors:
- arches: [i386, amd64]
failsafe:
primary: http://archive.ubuntu.com/ubuntu
security: http://security.ubuntu.com/ubuntu
search:
primary:
- http://%(ec2_region)s.ec2.archive.ubuntu.com/ubuntu/
- http://%(availability_zone)s.clouds.archive.ubuntu.com/ubuntu/
- http://%(region)s.clouds.archive.ubuntu.com/ubuntu/
security: []
- arches: [arm64, armel, armhf]
failsafe:
primary: http://ports.ubuntu.com/ubuntu-ports
security: http://ports.ubuntu.com/ubuntu-ports
search:
primary:
- http://%(ec2_region)s.ec2.ports.ubuntu.com/ubuntu-ports/
- http://%(availability_zone)s.clouds.ports.ubuntu.com/ubuntu-ports/
- http://%(region)s.clouds.ports.ubuntu.com/ubuntu-ports/
security: []
- arches: [default]
failsafe:
primary: http://ports.ubuntu.com/ubuntu-ports
security: http://ports.ubuntu.com/ubuntu-ports
ssh_svcname: ssh

View File

@ -0,0 +1,4 @@
output: {all: '>> /var/log/cloud-init-output.log'}
no_ssh_fingerprints: true
ssh:
emit_keys_to_console: false

View File

@ -0,0 +1,2 @@
[Journal]
RateLimitIntervalSec=0

View File

@ -0,0 +1,4 @@
# systemd in 23.04+ uses a newer "compact" format by default which is not
# understood by the systemd libraries from jammy used in the subiquity snap.
[Service]
Environment="SYSTEMD_JOURNAL_COMPACT=0"

View File

@ -0,0 +1,4 @@
# systemd in 22.04+ uses "hash table hardening" by default which is not
# understood by the systemd libraries from focal used in the subiquity snap.
[Service]
Environment="SYSTEMD_JOURNAL_KEYED_HASH=0"

View File

@ -0,0 +1,3 @@
#!/bin/sh
exec sudo snap run subiquity

View File

@ -0,0 +1,3 @@
[Service]
ExecStart=
ExecStart=-/sbin/agetty --noclear -n --autologin ubuntu-server %I $TERM

View File

@ -0,0 +1,9 @@
[Unit]
Description=Subiquity, the installer for Ubuntu Server %I
After=snapd.seeded.service
StartLimitInterval=0
[Service]
Environment=SNAP_REEXEC=0
ExecStart=
ExecStart=/usr/bin/snap run subiquity.subiquity-service %I

View File

@ -0,0 +1,4 @@
[Service]
StandardOutput=tty
ExecStart=
ExecStart=/usr/bin/snap run subiquity --ssh

View File

@ -0,0 +1,14 @@
[Unit]
IgnoreOnIsolate=yes
After=systemd-user-sessions.service plymouth-quit-wait.service snap.seeded.service
[Service]
Environment=SNAP_REEXEC=0
UtmpIdentifier=tty1
TTYPath=/dev/tty1
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
KillMode=process
IgnoreSIGPIPE=no
SendSIGHUP=yes

View File

@ -0,0 +1,2 @@
[Service]
Environment=SNAP_REEXEC=0

View File

@ -0,0 +1,4 @@
[Mount]
What=/dev/disk/by-uuid/00c629d6-06ab-4dfd-b21e-c3186f34105d
Where=/subiquity_config
Type=ext4

View File

@ -28,45 +28,54 @@ with open(opts.template) as fp:
template = yaml.safe_load(fp) template = yaml.safe_load(fp)
template['size'] = int(opts.size) id = template['id']
template['path'] = opts.squashfs for entry in output:
# First, look if this source catalogue template id is already present.
# If so, use the template to extend the existing entry with additional
# variations.
if entry['id'] == id:
if 'variations' not in template:
print("Non unique id in source catalog but no variations!")
sys.exit(1)
for k, variation in template['variations'].items():
variation['size'] = int(opts.size)
entry.setdefault('variations', {}).update(template['variations'])
break
else:
# No entry with this id found, so add a new one.
template['size'] = int(opts.size)
template['path'] = opts.squashfs
en_name = template['name'] en_name = template['name']
en_description = template['description'] en_description = template['description']
template['name'] = {'en': en_name} template['name'] = {'en': en_name}
template['description'] = {'en': en_description} template['description'] = {'en': en_description}
for mo in glob.glob(os.path.join(opts.translations, '*.mo')): for mo in glob.glob(os.path.join(opts.translations, '*.mo')):
with open(mo, 'rb') as fp: with open(mo, 'rb') as fp:
t = gettext.GNUTranslations(fp=fp) t = gettext.GNUTranslations(fp=fp)
t_name = t.gettext(en_name) t_name = t.gettext(en_name)
if t_name != en_name: if t_name != en_name:
lang = os.path.splitext(os.path.basename(mo))[0] lang = os.path.splitext(os.path.basename(mo))[0]
template['name'][lang] = t_name template['name'][lang] = t_name
t_description = t.gettext(en_description) t_description = t.gettext(en_description)
if t_description != en_description: if t_description != en_description:
lang = os.path.splitext(os.path.basedescription(mo))[0] lang = os.path.splitext(os.path.basedescription(mo))[0]
template['description'][lang] = t_description template['description'][lang] = t_description
if opts.langs is not None: if opts.langs is not None:
template['preinstalled_langs'] = opts.langs.split(',') template['preinstalled_langs'] = opts.langs.split(',')
output.append(template) output.append(template)
default_count = 0 default_count = 0
ids = set()
for entry in output: for entry in output:
if entry.get('default', False): if entry.get('default', False):
default_count += 1 default_count += 1
ids.add(entry['id'])
if default_count > 1: if default_count > 1:
print("Too many defaults in source catalog!") print("Too many defaults in source catalog!")
sys.exit(1) sys.exit(1)
if len(ids) != len(output):
print("Non unique ids in %s!" % output)
with open(opts.output, 'w') as fp: with open(opts.output, 'w') as fp:
yaml.dump(output, fp) yaml.dump(output, fp)