summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2024-06-13 20:42:43 +0200
committerSimon Rettberg2024-06-13 20:42:43 +0200
commitd9d87ed89d53e93fbaf0e3c86e96cf11285dce80 (patch)
tree0d3c5da60c811091e6ab73c6e75c55fc87cac79c
parent[slx-dmsetup] Kill stray line (diff)
downloadsystemd-init-d9d87ed89d53e93fbaf0e3c86e96cf11285dce80.tar.gz
systemd-init-d9d87ed89d53e93fbaf0e3c86e96cf11285dce80.tar.xz
systemd-init-d9d87ed89d53e93fbaf0e3c86e96cf11285dce80.zip
[slx-dmsetup] Fix braindead mktemp call by removing it
-rwxr-xr-xmodules.d/slx-dmsetup/hooks/dmsetup-slx-device9
1 files changed, 5 insertions, 4 deletions
diff --git a/modules.d/slx-dmsetup/hooks/dmsetup-slx-device b/modules.d/slx-dmsetup/hooks/dmsetup-slx-device
index 0888e97c..4c41af4b 100755
--- a/modules.d/slx-dmsetup/hooks/dmsetup-slx-device
+++ b/modules.d/slx-dmsetup/hooks/dmsetup-slx-device
@@ -241,15 +241,16 @@ ramdisk_fallback() {
mkdir -p "$cow_tmpfs"
fi
if ! mount -t tmpfs cow-tmpfs -o size="$(( read_only_device_sz / 2 + 100 ))k" "$cow_tmpfs"; then
- echo "$0: Failed to mount tmpfs in '$cow_tmpfs' of size '$(( read_only_device_sz / 2 + 100 ))KiB'."
+ echo "$0: Failed to mount tmpfs in '$cow_tmpfs' of size '$(( read_only_device_sz / 2 + 100 ))KiB', trying to use regular /run tmpfs."
fi
# create sparse file there
- local file="$(mktemp -u -p "$cow_tmpfs" dnbd_cow.XXX)"
- if ! dd if=/dev/null of="$file" seek="$(( read_only_device_sz ))" bs=512 2> /dev/null; then
+ local file="$cow_tmpfs/thinpool.meta"
+ if ! truncate -s "$(( read_only_device_sz * 512 ))" "$file" \
+ && ! dd if=/dev/null of="$file" seek="$read_only_device_sz" bs=512 2> /dev/null; then
emergency_shell "Failed to allocate CoW file $file."
fi
- declare -rg writable_device="$(losetup --show --find "$file")"
+ declare -rg writable_device="$( losetup --show --find "$file" )"
local cow_device_candidate="root"
while [ -b "/dev/mapper/$cow_device_candidate" ]; do
cow_device_candidate="root.$RANDOM"