mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-06-02 05:32:14 +00:00
Tidy up fstab mods on preinstalled desktop images
The UNCONFIGURED FSTAB warning was being left in the result, the discard option wasn't included, and the fsck flag was 0 (all in marked contrast to the preinstalled server images).
This commit is contained in:
parent
990b7c8a38
commit
4a4e2924c8
@ -17,9 +17,40 @@ if [ "$IMAGEFORMAT" == "none" ]; then
|
|||||||
/usr/sbin/oem-config-prepare --quiet
|
/usr/sbin/oem-config-prepare --quiet
|
||||||
touch "/var/lib/oem-config/run"
|
touch "/var/lib/oem-config/run"
|
||||||
|
|
||||||
# Make the writable partition grow
|
# Update the fstab to include the "discard" option, and
|
||||||
echo "LABEL=writable / ext4 defaults,x-systemd.growfs 0 0" >>/etc/fstab
|
# "x-systemd.growfs" to ensure the root partition is expanded on first
|
||||||
|
# boot
|
||||||
|
awk \
|
||||||
|
-v root_fs_label="writable" \
|
||||||
|
-v root_fs_options="discard,x-systemd.growfs" \
|
||||||
|
'
|
||||||
|
BEGIN { OFS="\t"; count=0; }
|
||||||
|
|
||||||
|
# Omit the "UNCONFIGURED" warning if it is still present
|
||||||
|
/^# UNCONFIGURED FSTAB/ { next; }
|
||||||
|
|
||||||
|
# Only modify the first non-comment line where the second field is the
|
||||||
|
# root and omit multiple root definitions
|
||||||
|
/^[^#]/ && $2 == "/" {
|
||||||
|
if (!count) {
|
||||||
|
$1="LABEL=" root_fs_label;
|
||||||
|
$4=root_fs_options;
|
||||||
|
$6="1";
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
if (count > 1) next;
|
||||||
|
}
|
||||||
|
|
||||||
|
{ print; }
|
||||||
|
|
||||||
|
# If we reach the end without seeing a root mount line, add one
|
||||||
|
END {
|
||||||
|
if (!count) {
|
||||||
|
print "LABEL=" root_fs_label, "/", "ext4", root_fs_options, "0", "1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
' /etc/fstab > /etc/fstab.new
|
||||||
|
mv /etc/fstab.new /etc/fstab
|
||||||
|
|
||||||
# Add units for a 1GiB swapfile, generated on first boot
|
# Add units for a 1GiB swapfile, generated on first boot
|
||||||
cat << EOF > /lib/systemd/system/mkswap.service
|
cat << EOF > /lib/systemd/system/mkswap.service
|
||||||
|
Loading…
x
Reference in New Issue
Block a user