Merge ~waveform/ubuntu/+source/ubuntu-settings:growroot-almost into ~ubuntu-desktop/ubuntu/+source/ubuntu-settings:master

Proposed by Dave Jones
Status: Merged
Merged at revision: 4b10fc4690401bb6aeb7cef014543df42daef138
Proposed branch: ~waveform/ubuntu/+source/ubuntu-settings:growroot-almost
Merge into: ~ubuntu-desktop/ubuntu/+source/ubuntu-settings:master
Diff against target: 299 lines (+203/-1)
12 files modified
data/raspberrypi/01-use-network-manager.yaml (+4/-0)
data/raspberrypi/growroot-almost (+74/-0)
data/raspberrypi/growroot-almost.service (+16/-0)
data/raspberrypi/meson.build (+11/-0)
data/raspberrypi/mkswap.service (+16/-0)
data/raspberrypi/swapfile.swap (+8/-0)
debian/changelog (+17/-0)
debian/control (+1/-1)
debian/rules (+5/-0)
debian/ubuntu-raspi-settings-desktop.install (+5/-0)
debian/ubuntu-raspi-settings-desktop.lintian-overrides (+14/-0)
debian/ubuntu-raspi-settings-desktop.postinst (+32/-0)
Reviewer Review Type Date Requested Status
Ubuntu Desktop Pending
Review via email: mp+439835@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Dave Jones (waveform) wrote :

Please see associated bug; it should link to both relevant merge requests

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/data/raspberrypi/01-use-network-manager.yaml b/data/raspberrypi/01-use-network-manager.yaml
0new file mode 1006440new file mode 100644
index 0000000..4a8fd08
--- /dev/null
+++ b/data/raspberrypi/01-use-network-manager.yaml
@@ -0,0 +1,4 @@
1# Let NetworkManager manage all devices on this system
2network:
3 version: 2
4 renderer: NetworkManager
diff --git a/data/raspberrypi/growroot-almost b/data/raspberrypi/growroot-almost
0new file mode 1007555new file mode 100755
index 0000000..9b13e3e
--- /dev/null
+++ b/data/raspberrypi/growroot-almost
@@ -0,0 +1,74 @@
1#!/bin/sh
2
3set -eu
4
5MYNAME=${0##*/}
6
7usage() {
8 echo "Usage: $MYNAME [ -u | --unused SECTORS ] MOUNT-POINT"
9}
10
11help() {
12 usage
13 cat << EOF
14
15Resizes the ext2/3/4 file-system at the specified MOUNT-POINT to the size of
16the underlying block device, optionally leaving the specified number of
17512-byte sectors unused at the end of the device. This is intended to make
18later encapsulation of the file-system in LUKS easier to manage.
19
20Typically this tool must be run as root.
21EOF
22}
23
24main() {
25 if ! parsed_args=$(getopt -n "$MYNAME" -o hu: --long help,unused: -- "$@"); then
26 usage
27 exit 1
28 fi
29
30 unused=0
31 eval set -- "$parsed_args"
32 while :; do
33 case "$1" in
34 -s | --unused)
35 unused="$2"
36 shift 2
37 ;;
38 -h | --help)
39 help
40 exit 0
41 ;;
42 --)
43 shift
44 break
45 ;;
46 *)
47 echo "Internal error: $1 unknown" >&2
48 exit 63
49 ;;
50 esac
51 done
52 if [ "$#" -ne 1 ]; then
53 usage
54 exit 1
55 fi
56
57 mount_point="$1"
58 fstype=$(findmnt --output FSTYPE --noheadings "$mount_point")
59 case "$fstype" in
60 ext2|ext3|ext4)
61 device=$(findmnt --output SOURCE --noheadings "$mount_point")
62
63 old_size=$(blockdev --getsz "$device") # sectors
64 new_size=$((old_size - unused))
65 resize2fs "$device" "$new_size"s
66 ;;
67 *)
68 echo "Specified mount is not an ext file-system" >&2
69 exit 1
70 ;;
71 esac
72}
73
74main "$@"
diff --git a/data/raspberrypi/growroot-almost.service b/data/raspberrypi/growroot-almost.service
0new file mode 10064475new file mode 100644
index 0000000..478fdff
--- /dev/null
+++ b/data/raspberrypi/growroot-almost.service
@@ -0,0 +1,16 @@
1[Unit]
2Description=Grow the root file-system, leaving 16MB space for LUKS headers
3DefaultDependencies=no
4Requires=local-fs.target
5After=local-fs.target
6Before=mkswap.service
7ConditionPathExists=!/etc/growroot-grown
8
9[Service]
10Type=oneshot
11# 32768 512-sectors is 16MB
12ExecStart=/usr/sbin/growroot-almost --unused 32768 /
13ExecStartPost=touch /etc/growroot-grown
14
15[Install]
16WantedBy=swap.target
diff --git a/data/raspberrypi/meson.build b/data/raspberrypi/meson.build
index a390c5e..5a0daeb 100644
--- a/data/raspberrypi/meson.build
+++ b/data/raspberrypi/meson.build
@@ -1,6 +1,7 @@
1etc = get_option('sysconfdir')1etc = get_option('sysconfdir')
2var_lib = get_option('sharedstatedir')2var_lib = get_option('sharedstatedir')
3usr_share = get_option('datadir')3usr_share = get_option('datadir')
4sbin = get_option('sbindir')
45
5install_data('10-raspi-eth0.link',6install_data('10-raspi-eth0.link',
6 install_dir: 'lib/systemd/network')7 install_dir: 'lib/systemd/network')
@@ -16,3 +17,13 @@ install_data('raspi-zswap.conf',
16 install_dir: usr_share / 'initramfs-tools/modules.d')17 install_dir: usr_share / 'initramfs-tools/modules.d')
17install_data('99-fake-cloud.cfg',18install_data('99-fake-cloud.cfg',
18 install_dir: etc / 'cloud/cloud.cfg.d')19 install_dir: etc / 'cloud/cloud.cfg.d')
20install_data('mkswap.service',
21 install_dir: '/lib/systemd/system')
22install_data('swapfile.swap',
23 install_dir: '/lib/systemd/system')
24install_data('01-use-network-manager.yaml',
25 install_dir: etc / 'netplan')
26install_data('growroot-almost',
27 install_dir: sbin)
28install_data('growroot-almost.service',
29 install_dir: '/lib/systemd/system')
diff --git a/data/raspberrypi/mkswap.service b/data/raspberrypi/mkswap.service
19new file mode 10064430new file mode 100644
index 0000000..6fc4829
--- /dev/null
+++ b/data/raspberrypi/mkswap.service
@@ -0,0 +1,16 @@
1[Unit]
2Description=Create the default swapfile
3DefaultDependencies=no
4Requires=local-fs.target
5After=local-fs.target
6Before=swapfile.swap
7ConditionPathExists=!/swapfile
8
9[Service]
10Type=oneshot
11ExecStartPre=fallocate -l 1GiB /swapfile
12ExecStartPre=chmod 600 /swapfile
13ExecStart=mkswap /swapfile
14
15[Install]
16WantedBy=swap.target
diff --git a/data/raspberrypi/swapfile.swap b/data/raspberrypi/swapfile.swap
0new file mode 10064417new file mode 100644
index 0000000..d52a3f6
--- /dev/null
+++ b/data/raspberrypi/swapfile.swap
@@ -0,0 +1,8 @@
1[Unit]
2Description=The default swapfile
3
4[Swap]
5What=/swapfile
6
7[Install]
8WantedBy=swap.target
diff --git a/debian/changelog b/debian/changelog
index 27c9fa0..416d831 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,20 @@
1ubuntu-settings (23.04.4) UNRELEASED; urgency=medium
2
3 [ Dave Jones ]
4 * ubuntu-raspi-settings-desktop: migrated livecd-rootfs hacks that
5 introduce mkswap.service and swapfile.swap (LP: #2004430)
6 * ubuntu-raspi-settings-desktop: migrated netplan network-manager
7 configuration (LP: #2004430)
8 * ubuntu-raspi-settings-desktop: add growroot-almost service to expand
9 root fs leaving 16MB slack for potential LUKS encapsulation (LP: #2013080)
10 * Bump standards version to current (4.6.2)
11
12 [ William 'jawn-smith' Wilson ]
13 * Add oem-config-setup to ubuntu-raspi-settings-desktop.postinst
14 (LP: #2011722)
15
16 -- Dave Jones <dave.jones@canonical.com> Tue, 28 Mar 2023 13:48:22 +0100
17
1ubuntu-settings (23.04.3) lunar; urgency=medium18ubuntu-settings (23.04.3) lunar; urgency=medium
219
3 * gnome-initial-setup.desktop: Set StartupWMClass to fix app name & icon20 * gnome-initial-setup.desktop: Set StartupWMClass to fix app name & icon
diff --git a/debian/control b/debian/control
index 5735844..18486e5 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: x11
3Priority: optional3Priority: optional
4Maintainer: Ubuntu Desktop Team <ubuntu-desktop@lists.ubuntu.com>4Maintainer: Ubuntu Desktop Team <ubuntu-desktop@lists.ubuntu.com>
5Build-Depends: debhelper-compat (= 12), meson (>= 0.40.1), dh-translations5Build-Depends: debhelper-compat (= 12), meson (>= 0.40.1), dh-translations
6Standards-Version: 4.6.0.16Standards-Version: 4.6.2
7Vcs-Browser: https://git.launchpad.net/~ubuntu-desktop/ubuntu/+source/ubuntu-settings7Vcs-Browser: https://git.launchpad.net/~ubuntu-desktop/ubuntu/+source/ubuntu-settings
8Vcs-Git: https://git.launchpad.net/~ubuntu-desktop/ubuntu/+source/ubuntu-settings8Vcs-Git: https://git.launchpad.net/~ubuntu-desktop/ubuntu/+source/ubuntu-settings
99
diff --git a/debian/rules b/debian/rules
index 6c33aaa..2e1de50 100755
--- a/debian/rules
+++ b/debian/rules
@@ -6,6 +6,11 @@
6override_dh_missing:6override_dh_missing:
7 dh_missing --fail-missing7 dh_missing --fail-missing
88
9override_dh_installsystemd:
10 dh_installsystemd -pubuntu-raspi-settings-desktop --name=mkswap mkswap.service
11 dh_installsystemd -pubuntu-raspi-settings-desktop --name=swapfile swapfile.swap
12 dh_installsystemd -pubuntu-raspi-settings-desktop --name=growroot-almost growroot-almost.service
13
9override_dh_installgsettings:14override_dh_installgsettings:
10 dh_installgsettings -pubuntu-raspi-settings --priority 1515 dh_installgsettings -pubuntu-raspi-settings --priority 15
11 dh_installgsettings --remaining-packages16 dh_installgsettings --remaining-packages
diff --git a/debian/ubuntu-raspi-settings-desktop.install b/debian/ubuntu-raspi-settings-desktop.install
index 6e4a375..6ec0480 100644
--- a/debian/ubuntu-raspi-settings-desktop.install
+++ b/debian/ubuntu-raspi-settings-desktop.install
@@ -1,3 +1,8 @@
1usr/share/initramfs-tools/modules.d/raspi-zswap.conf1usr/share/initramfs-tools/modules.d/raspi-zswap.conf
2var/lib/polkit-1/localauthority/10-vendor.d/disable-suspend.pkla2var/lib/polkit-1/localauthority/10-vendor.d/disable-suspend.pkla
3usr/lib/NetworkManager/conf.d/ZZraspi-wifi-powersave-off.conf3usr/lib/NetworkManager/conf.d/ZZraspi-wifi-powersave-off.conf
4lib/systemd/system/mkswap.service
5lib/systemd/system/swapfile.swap
6etc/netplan/01-use-network-manager.yaml
7usr/sbin/growroot-almost
8lib/systemd/system/growroot-almost.service
diff --git a/debian/ubuntu-raspi-settings-desktop.lintian-overrides b/debian/ubuntu-raspi-settings-desktop.lintian-overrides
4new file mode 1006449new file mode 100644
index 0000000..a8b9ee3
--- /dev/null
+++ b/debian/ubuntu-raspi-settings-desktop.lintian-overrides
@@ -0,0 +1,14 @@
1# Yes, we actually want swap.target for the swap file, and for growing the
2# root fs that contains the swap file...
3systemd-service-file-refers-to-unusual-wantedby-target swap.target [lib/systemd/system/mkswap.service]
4systemd-service-file-refers-to-unusual-wantedby-target swap.target [lib/systemd/system/growroot-almost.service]
5
6# We don't support any init-system other than systemd, and mkswap is a trivial
7# oneshot service
8package-supports-alternative-init-but-no-init.d-script [lib/systemd/system/mkswap.service]
9systemd-service-file-missing-documentation-key [lib/systemd/system/mkswap.service]
10
11# growroot-almost is also an utterly trivial script (and service) that should
12# only be run once
13no-manual-page [usr/sbin/growroot-almost]
14systemd-service-file-missing-documentation-key [lib/systemd/system/growroot-almost.service]
diff --git a/debian/ubuntu-raspi-settings-desktop.postinst b/debian/ubuntu-raspi-settings-desktop.postinst
0new file mode 10064415new file mode 100644
index 0000000..afe9b1b
--- /dev/null
+++ b/debian/ubuntu-raspi-settings-desktop.postinst
@@ -0,0 +1,32 @@
1#!/bin/sh
2
3set -e
4
5case "$1" in
6 configure)
7 # Unconditionally remove the obsolete (unpackaged) links activating the
8 # (previously unpackaged) mkswap.service and swapfile.swap units. These
9 # will instead be activated by dh_installsystemd creating links in
10 # /etc/systemd/system/swap.target.wants (which is where they should be
11 # rather than under /lib)
12 rm -f \
13 /lib/systemd/system/swap.target.wants/mkswap.service \
14 /lib/systemd/system/swap.target.wants/swapfile.swap
15 # Unconditionally remove the obsolete (unpackaged) netplan config file.
16 # This isn't done with rm_conffile or conffiles because those both
17 # refuse to work except on upgrade. We can't do it on upgrade to
18 # another package (e.g. ubuntu-raspi-settings) either because the
19 # "proper" methods both demand the prior version actually owned the
20 # file being removed. So...
21 rm -f /etc/netplan/01-network-manager-all.yaml
22 # Set up oem-config to run on firstboot if and only if it hasn't
23 # already run
24 if [ ! -f "/var/log/oem-config.log" ] && ! id oem 2>/dev/null ; then
25 useradd -d /home/oem -G adm,sudo -m -N -u 29999 oem
26 oem-config-prepare --quiet
27 touch "/var/lib/oem-config/run"
28 fi
29 ;;
30esac
31
32#DEBHELPER#

Subscribers

People subscribed via source and target branches

to all changes: