Skip to content

Commit

Permalink
DLPX-86532 CIS: /tmp filesystem and mount options
Browse files Browse the repository at this point in the history
  • Loading branch information
bharath-delphix committed Jan 4, 2024
1 parent a1b7edf commit 1b8cb64
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions live-build/config/hooks/vm-artifacts/90-raw-disk-image.binary
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ zfs create \
-o mountpoint=legacy \
"$FSNAME/ROOT/$FSNAME/log"

if [[ "$APPLIANCE_VARIANT" == "external-"* ]]; then
zfs create \
-o mountpoint=legacy \
"$FSNAME/ROOT/$FSNAME/tmp"
fi

#
# Initialize the grub dataset. This dataset will be used to contain all
# of the grub-specific files; this includes the "grub.cfg" file, along
Expand Down Expand Up @@ -273,6 +279,11 @@ mount -t zfs "$FSNAME/ROOT/$FSNAME/log" "$DIRECTORY/var/log"
mkdir -p "/var/crash"
mount -t zfs "$FSNAME/crashdump" "/var/crash"

if [[ "$APPLIANCE_VARIANT" == "external-"* ]]; then
mkdir -p "/tmp"
mount -t zfs "$FSNAME/ROOT/$FSNAME/tmp" "/tmp"
fi

#
# Populate the root filesystem with the contents of the "binary" directory
# that (we assume) was previously generated by live-build.
Expand All @@ -298,6 +309,12 @@ cat <<-EOF >"$DIRECTORY/etc/fstab"
rpool/crashdump /var/crash zfs defaults,x-systemd.before=zfs-import-cache.service,x-systemd.before=kdump-tools.service 0 0
EOF

if [[ "$APPLIANCE_VARIANT" == "external-"* ]]; then
cat <<-EOF >"$DIRECTORY/etc/fstab"
rpool/ROOT/$FSNAME/tmp /tmp zfs defaults,nosuid,nodev,noexec,x-systemd.before=zfs-import-cache.service 0 0
EOF
fi
#
# Now we need to install the bootloader. In order to do that, we'll chroot
# into the newly populated root filesystem, so that we use the grub-install
Expand Down

0 comments on commit 1b8cb64

Please sign in to comment.