Commit f362dd31 authored by Guido Gunther's avatar Guido Gunther

Merge branch 'resize_systemd' into 'master'

base: Resize rootfs after it's mounted

See merge request !37
parents 997a82d6 da0b4c38
Pipeline #5231 passed with stages
in 4 minutes and 1 second
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://code.puri.sm/Librem5/librem5-evk-tools.git
Files: usr/*
Copyright: 2011 Scott Moser <scott.moser@canonical.com>
2019 Purism SPC
License: GPL-3+
Files: *
Copyright: 2018 Purism SPC
Copyright: 2018, 2019 Purism SPC
License: GPL-3+
License: GPL-3+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -19,3 +26,4 @@ License: GPL-3+
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
[Unit]
Description=Performs an online resize of an ext2,3,4 rootfs
After=-.mount
[Service]
Type=oneshot
ExecStart=/usr/bin/resize_rootfs
[Install]
WantedBy=local-fs.target
......@@ -6,6 +6,9 @@
override_dh_installudev:
dh_installudev --name=librem5_devkit
override_dh_installsystemd:
dh_installsystemd --no-start --name=resize_rootfs
override_dh_auto_test:
dh_auto_test
make check
#!/bin/sh
# Resize rootfs after booting. Based on growroot.sh and growroot from cloud-initramfs-tools
set -e
rootmnt="/"
msg() { echo "resize_rootfs:" "$@" ; }
fail() { [ $# -eq 0 ] || msg "$@"; exit 1; }
# if a file indicates we should do nothing, then just exit
for f in /etc/resize_rootfs-disabled \
/etc/resize_rootfs-resized; do
[ -f "${rootmnt}$f" ] && exit 0
done
# Get the root device, root filesystem and mount options
if ! out=$(awk '$2 == mt { print }' "mt=${rootmnt}" < /proc/mounts) ; then
fail "${out}"
return
fi
# Need to do it this way, can't use '<<< "${out}"' since dash doesn't
# seem to understand it
read rootdev _rootmnt _rootfs _opts unused <<EOF
${out}
EOF
set +e
out=$(resize2fs "${rootdev}" 2>&1)
set -e
ret=$?
case "$ret" in
0) msg "succeeded"; touch /etc/resize_rootfs-resized;;
*) fail "failed '$ret'" "${out}";;
esac
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment