From e5ccc397ce85c9ee395c36c62d6e64cc3007eab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alfonso=20S=C3=A1nchez-Beato?= Date: Tue, 10 Dec 2024 14:35:54 -0500 Subject: [PATCH] core-initrd: fix spelling and shellcheck warnings --- core-initrd/24.04/debian/control | 2 +- .../24.04/debian/generate-x86-microcode | 2 +- core-initrd/README.md | 24 ++++++++----------- core-initrd/latest/ARCHITECTURE.md | 2 +- core-initrd/latest/bin/ubuntu-core-initramfs | 2 +- core-initrd/latest/debian/control | 2 +- .../latest/debian/generate-x86-microcode | 2 +- .../lib/recovery-chooser-trigger-switch-root | 2 +- .../latest/factory/usr/libexec/core/get-arg | 2 +- .../latest/postinst.d/ubuntu-core-initramfs | 10 ++++---- 10 files changed, 23 insertions(+), 27 deletions(-) diff --git a/core-initrd/24.04/debian/control b/core-initrd/24.04/debian/control index e96e746d9f1..17821633c2a 100644 --- a/core-initrd/24.04/debian/control +++ b/core-initrd/24.04/debian/control @@ -47,4 +47,4 @@ Depends: ${python3:Depends}, ${misc:Depends}, dracut-core (>= 051-1), util-linux Description: standard embedded initrd Standard embedded initrd implementation to be used with Ubuntu Core - systems. Currently targetting creating BLS Type2 like binaries. + systems. Currently targeting creating BLS Type2 like binaries. diff --git a/core-initrd/24.04/debian/generate-x86-microcode b/core-initrd/24.04/debian/generate-x86-microcode index c7eee61edfd..a00ae50f765 100755 --- a/core-initrd/24.04/debian/generate-x86-microcode +++ b/core-initrd/24.04/debian/generate-x86-microcode @@ -8,7 +8,7 @@ set -e # Generates a copy of the minimal microcode for all AMD processors # and installs it to the early initramfs -EFWE=$(realpath $1) +EFWE=$(realpath "$1") EFWD=$(mktemp -d "${TMPDIR:-/var/tmp}/mkinitramfs-EFW_XXXXXXXXXX") EFWCD="${EFWD}/d/kernel/x86/microcode" # note: to build a reproducible early initramfs, we force diff --git a/core-initrd/README.md b/core-initrd/README.md index c52f55fb23a..d401be4493f 100644 --- a/core-initrd/README.md +++ b/core-initrd/README.md @@ -6,9 +6,13 @@ originally in https://github.com/canonical/core-initrd. This contains subfolders, each of them for a currently supported Ubuntu release. Each subfolder contains the sources for a debian package. The `latest` -subdir contains the sources for the most recent Ubuntu release. To -build source packages that can later be built by Launchpad, checkout -the matching snapd release and run from this folder: +subdir contains the sources for the most recent Ubuntu release. When +releasing, first checkout the desired snapd release. Then `dch -i` +should be run for each package to update version and changelog, and +this should be committed to the snapd release and master branches. + +To finally create source packages that can later be built by +Launchpad, run from this folder: ``` ./build-source-pkgs.sh @@ -16,23 +20,15 @@ the matching snapd release and run from this folder: This will pull the sources to build `snap-bootstrap` from the snapd tree and copy duplicated files from the `latest` folder to older -releases. At this point `dch -i` should be run for each release to -update version and changelog, and this should be commited to the snapd -release and master branches. To build the source packages, run - -``` -gbp buildpackage -S -sa -d --git-ignore-branch -``` - -in each release subfolder. Then it is recommended to compare the -sources with the previous versions in the snappy-de PPA: +releases. Then it is recommended to compare the source packages with +the previous versions in the snappy-dev PPA: ``` dget https://launchpad.net/~snappy-dev/+archive/ubuntu/image/+sourcefiles/ubuntu-core-initramfs//ubuntu-core-initramfs_.dsc debdiff ubuntu-core-initramfs_.dsc ubuntu-core-initramfs_.dsc > diff.txt ``` -And to finally upload with: +And finally upload with: ``` dput ppa:snappy-dev/image ubuntu-core-initramfs__source.changes diff --git a/core-initrd/latest/ARCHITECTURE.md b/core-initrd/latest/ARCHITECTURE.md index df35720ec06..8aa4ccf580e 100644 --- a/core-initrd/latest/ARCHITECTURE.md +++ b/core-initrd/latest/ARCHITECTURE.md @@ -73,7 +73,7 @@ package auto-import repo. To do that: $ git subtree pull --prefix vendor/systemd/ https://git.launchpad.net/ubuntu/+source/systemd ubuntu/ --squash Where release could be focal, jammy, etc. Note that when a development -version is released we will probably wnat `ubuntu/-updates` +version is released we will probably want `ubuntu/-updates` branch instead. When moving to a newer Ubuntu release, the way to update is to remove diff --git a/core-initrd/latest/bin/ubuntu-core-initramfs b/core-initrd/latest/bin/ubuntu-core-initramfs index da33837a5c5..984214e4d1d 100755 --- a/core-initrd/latest/bin/ubuntu-core-initramfs +++ b/core-initrd/latest/bin/ubuntu-core-initramfs @@ -889,7 +889,7 @@ def main(): "--initrd", help="path to initramfs", default="/boot/ubuntu-core-initramfs.img" ) efi_parser.add_argument( - "--cmdline", help="commandline to embed (can be overriden with LoadOptions)" + "--cmdline", help="commandline to embed (can be overridden with LoadOptions)" ) efi_parser.add_argument( "--unsigned", help="do not sign efi app", default=False, action="store_true" diff --git a/core-initrd/latest/debian/control b/core-initrd/latest/debian/control index 08b514b3cb4..809ffb955f7 100644 --- a/core-initrd/latest/debian/control +++ b/core-initrd/latest/debian/control @@ -50,4 +50,4 @@ Depends: ${python3:Depends}, ${misc:Depends}, dracut-core (>= 051-1), dh-dlopenlibdeps Description: standard embedded initrd Standard embedded initrd implementation to be used with Ubuntu Core - systems. Currently targetting creating BLS Type2 like binaries. + systems. Currently targeting creating BLS Type2 like binaries. diff --git a/core-initrd/latest/debian/generate-x86-microcode b/core-initrd/latest/debian/generate-x86-microcode index c7eee61edfd..a00ae50f765 100755 --- a/core-initrd/latest/debian/generate-x86-microcode +++ b/core-initrd/latest/debian/generate-x86-microcode @@ -8,7 +8,7 @@ set -e # Generates a copy of the minimal microcode for all AMD processors # and installs it to the early initramfs -EFWE=$(realpath $1) +EFWE=$(realpath "$1") EFWD=$(mktemp -d "${TMPDIR:-/var/tmp}/mkinitramfs-EFW_XXXXXXXXXX") EFWCD="${EFWD}/d/kernel/x86/microcode" # note: to build a reproducible early initramfs, we force diff --git a/core-initrd/latest/factory/usr/lib/recovery-chooser-trigger-switch-root b/core-initrd/latest/factory/usr/lib/recovery-chooser-trigger-switch-root index 49a15be15d1..e0418d92d1c 100755 --- a/core-initrd/latest/factory/usr/lib/recovery-chooser-trigger-switch-root +++ b/core-initrd/latest/factory/usr/lib/recovery-chooser-trigger-switch-root @@ -2,4 +2,4 @@ set -eux -kill -USR1 $(systemctl show --property MainPID --value snapd.recovery-chooser-trigger.service) +kill -USR1 "$(systemctl show --property MainPID --value snapd.recovery-chooser-trigger.service)" diff --git a/core-initrd/latest/factory/usr/libexec/core/get-arg b/core-initrd/latest/factory/usr/libexec/core/get-arg index 9fde0b442a2..8e20c2cf4a2 100755 --- a/core-initrd/latest/factory/usr/libexec/core/get-arg +++ b/core-initrd/latest/factory/usr/libexec/core/get-arg @@ -39,7 +39,7 @@ while [ -n "${current}" ]; do # We cannot use subtring parameter expansion # (e.g. ${cmdline:$i:1}) in busybox-initramfs suffix="${current#?}" - char="${current%${suffix}}" + char="${current%"${suffix}"}" current="${suffix}" case "${char}" in ["${whitespaces}"]) diff --git a/core-initrd/latest/postinst.d/ubuntu-core-initramfs b/core-initrd/latest/postinst.d/ubuntu-core-initramfs index 411fd34a920..31b392f9b15 100755 --- a/core-initrd/latest/postinst.d/ubuntu-core-initramfs +++ b/core-initrd/latest/postinst.d/ubuntu-core-initramfs @@ -13,21 +13,21 @@ if [ -n "$DEB_MAINT_PARAMS" ]; then fi # do not clobber pre-signed .efi -if [ -e /boot/kernel.efi-$version ]; then +if [ -e /boot/kernel.efi-"$version" ]; then exit 0 fi -ubuntu-core-initramfs create-initrd --kernelver $version +ubuntu-core-initramfs create-initrd --kernelver "$version" -case `dpkg --print-architecture` in +case $(dpkg --print-architecture) in amd64|arm64) case $version in *-azure) # Currently nullboot doesn't seal cmdline, thus it must be baked in for azure - ubuntu-core-initramfs create-efi --unsigned --kernelver $version --cmdline "snapd_recovery_mode=cloudimg-rootfs console=tty1 console=ttyS0 earlyprintk=ttyS0" + ubuntu-core-initramfs create-efi --unsigned --kernelver "$version" --cmdline "snapd_recovery_mode=cloudimg-rootfs console=tty1 console=ttyS0 earlyprintk=ttyS0" ;; *) - ubuntu-core-initramfs create-efi --unsigned --kernelver $version + ubuntu-core-initramfs create-efi --unsigned --kernelver "$version" ;; esac esac