aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Buesch <m@bues.ch>2019-08-06 19:26:59 +0200
committerMichael Buesch <m@bues.ch>2019-08-06 21:26:30 +0200
commit006c070df317528d6c700e323165aec0d47a5a90 (patch)
treecf7edf1b66327553926303df940aeace32ef02d3
parent18454588011e0513aa7c25555a63dffdf37775d3 (diff)
downloadawlsim-006c070df317528d6c700e323165aec0d47a5a90.tar.xz
awlsim-006c070df317528d6c700e323165aec0d47a5a90.zip
pilc: Add auto-resize
Signed-off-by: Michael Buesch <m@bues.ch>
-rw-r--r--pilc/deb/pilc-system/debian/pilc-system.install1
-rw-r--r--pilc/deb/pilc-system/debian/pilc-system.pilc_resize_rootfs.service11
-rw-r--r--pilc/deb/pilc-system/debian/pilc-system.postinst2
-rwxr-xr-xpilc/deb/pilc-system/debian/rules3
-rw-r--r--pilc/deb/pilc-system/usr/sbin/pilc-resize-rootfs10
5 files changed, 27 insertions, 0 deletions
diff --git a/pilc/deb/pilc-system/debian/pilc-system.install b/pilc/deb/pilc-system/debian/pilc-system.install
index ee19d5d1..a75e2371 100644
--- a/pilc/deb/pilc-system/debian/pilc-system.install
+++ b/pilc/deb/pilc-system/debian/pilc-system.install
@@ -1 +1,2 @@
etc
+usr
diff --git a/pilc/deb/pilc-system/debian/pilc-system.pilc_resize_rootfs.service b/pilc/deb/pilc-system/debian/pilc-system.pilc_resize_rootfs.service
new file mode 100644
index 00000000..a5cad4b1
--- /dev/null
+++ b/pilc/deb/pilc-system/debian/pilc-system.pilc_resize_rootfs.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Resize rootfs once
+After=syslog.target local-fs.target
+Before=pilc_regenerate_ssh_host_keys.service
+
+[Service]
+Type=forking
+ExecStart=/bin/sh /usr/sbin/pilc-resize-rootfs
+
+[Install]
+WantedBy=multi-user.target
diff --git a/pilc/deb/pilc-system/debian/pilc-system.postinst b/pilc/deb/pilc-system/debian/pilc-system.postinst
index 00f72610..6187e2bc 100644
--- a/pilc/deb/pilc-system/debian/pilc-system.postinst
+++ b/pilc/deb/pilc-system/debian/pilc-system.postinst
@@ -31,6 +31,8 @@ case "$1" in
rm /etc/ssh/ssh_host_*_key*
fi
echo 1 > /etc/ssh/sshd_not_to_be_run
+
+ systemctl enable pilc_resize_rootfs.service
;;
abort-upgrade|abort-remove|abort-deconfigure)
diff --git a/pilc/deb/pilc-system/debian/rules b/pilc/deb/pilc-system/debian/rules
index cc5ec792..552345c4 100755
--- a/pilc/deb/pilc-system/debian/rules
+++ b/pilc/deb/pilc-system/debian/rules
@@ -19,9 +19,12 @@
override_dh_installinit:
dh_installinit --name=pilc_regenerate_ssh_host_keys --no-restart-on-upgrade --no-start
+ dh_installinit --name=pilc_resize_rootfs
override_dh_systemd_enable:
dh_systemd_enable --name=pilc_regenerate_ssh_host_keys --no-enable
+ dh_systemd_enable --name=pilc_resize_rootfs
override_dh_systemd_start:
dh_systemd_start --name=pilc_regenerate_ssh_host_keys --no-start
+ dh_systemd_start --name=pilc_resize_rootfs
diff --git a/pilc/deb/pilc-system/usr/sbin/pilc-resize-rootfs b/pilc/deb/pilc-system/usr/sbin/pilc-resize-rootfs
new file mode 100644
index 00000000..1b08bdbd
--- /dev/null
+++ b/pilc/deb/pilc-system/usr/sbin/pilc-resize-rootfs
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+/bin/echo "Resizing root filesystem..."
+/bin/echo "THE SYSTEM WILL REBOOT IN A FEW SECONDS"
+
+/usr/bin/raspi-config --expand-rootfs
+/bin/systemctl mask pilc_resize_rootfs.service
+/bin/systemctl reboot
+
+exit 0
bues.ch cgit interface