summaryrefslogtreecommitdiffstats
path: root/modules.d
diff options
context:
space:
mode:
authorSimon Rettberg2020-10-09 09:23:09 +0200
committerSimon Rettberg2020-10-09 09:26:43 +0200
commitdf8ff1f761cf37a3968f4709b5bb7f543a8f258b (patch)
treecb7cbd9563afe5e9c819ea1cf564360dafe32e6c /modules.d
parent[slx-network] SLX_PXE_NETIF -> /run/network.conf (diff)
downloadsystemd-init-df8ff1f761cf37a3968f4709b5bb7f543a8f258b.tar.gz
systemd-init-df8ff1f761cf37a3968f4709b5bb7f543a8f258b.tar.xz
systemd-init-df8ff1f761cf37a3968f4709b5bb7f543a8f258b.zip
[slx-dmsetup] Minor cleanup
Diffstat (limited to 'modules.d')
-rwxr-xr-xmodules.d/slx-dmsetup/scripts/dmsetup-slx-device7
1 files changed, 3 insertions, 4 deletions
diff --git a/modules.d/slx-dmsetup/scripts/dmsetup-slx-device b/modules.d/slx-dmsetup/scripts/dmsetup-slx-device
index dffc203c..9926951f 100755
--- a/modules.d/slx-dmsetup/scripts/dmsetup-slx-device
+++ b/modules.d/slx-dmsetup/scripts/dmsetup-slx-device
@@ -135,6 +135,7 @@ dmsetup_create_noudevsync() {
# encrypt_device <dev_path> <encrypted_name> [<size>]
encrypt_device() {
+ # TODO: Send key back to us, demand ransom
modprobe dm-crypt || echo "$0: dm-crypt loading failed, maybe builtin?"
[ -b "$1" ] || return 1
[ -n "$2" ] || return 1
@@ -169,7 +170,7 @@ ramdisk_fallback() {
echo "$0: Falling back to regular dm-snapshot on a RAMdisk."
# RAM size in kb, note that this is equal to half
- # of the entire RAM in 512-bytes sectors.
+ # of the entire RAM when interpreted as 512-bytes sectors.
local ram_cow_sz="$(awk '/^MemTotal:/ { printf("%d\n", $2 ); exit }' /proc/meminfo)"
# try to prepare the zero extension device
@@ -177,10 +178,9 @@ ramdisk_fallback() {
(
set -e
lsmod | grep -q dm-zero || modprobe dm-zero
- dmsetup_create_noudevsync zero "0 $ram_cow_sz zero"
dmsetup_create_noudevsync "${extended_device##*/}" \
"0 $read_only_device_sz linear $read_only_device 0
- $read_only_device_sz $ram_cow_sz linear /dev/mapper/zero 0"
+ $read_only_device_sz $ram_cow_sz zero"
)
if [ "$?" -eq 0 ]; then
read_only_device="$extended_device"
@@ -330,7 +330,6 @@ declare -g scratch_device="$writable_device"
declare -gi scratch_device_sz=0
if (( min <= writable_device_sz )); then
scratch_device_sz="$max"
- (( scratch_device_sz < min )) && scratch_device_sz="$min"
(( scratch_device_sz > writable_device_sz )) && scratch_device_sz="$writable_device_sz"
else
# minimum snapshot size is bigger than physical device size