]>
git.ipfire.org Git - thirdparty/util-linux.git/blob - tests/ts/swapon/fixsig
3 TS_TOPDIR
="${0%/*}/../.."
4 TS_DESC
="fix signature"
6 .
$TS_TOPDIR/functions.sh
9 ts_check_test_command
"$TS_CMD_MKSWAP"
10 ts_check_test_command
"$TS_CMD_SWAPON"
11 ts_check_test_command
"$TS_CMD_SWAPOFF"
12 ts_check_test_command
"$TS_HELPER_SYSINFO"
17 PAGESIZE
=$
($TS_HELPER_SYSINFO pagesize
)
25 $TS_CMD_MKSWAP $DEVICE > /dev
/null
2>> $TS_OUTPUT \
26 || ts_die
"Cannot make swap $DEVICE"
28 ts_device_has
"TYPE" "swap" $DEVICE || ts_die
"Cannot find swap on $DEVICE"
31 # Rewrite signature to swsuspend
33 echo "S2SUSPEND " > $TS_OUTPUT.signature
34 dd if=$TS_OUTPUT.signature of
=$DEVICE \
35 seek
=$
(( $PAGESIZE - 10 )) count
=10 bs
=1 conv
=notrunc
&> /dev
/null
37 ts_device_has
"TYPE" "swsuspend" $DEVICE || ts_die
"Cannot find swsuspend on $DEVICE"
42 $TS_CMD_SWAPON $DEVICE &> /dev
/null
44 grep -q "^$DEVICE\b" /proc
/swaps || ts_die
"Cannot find $DEVICE in /proc/swaps"
46 $TS_CMD_SWAPOFF $DEVICE
48 # swapon/mkswap warns if system sets different permissions for loop devices
49 sed --in-place '/insecure permissions .*, 0660 suggested/d' $TS_OUTPUT