71dc3ed1d95dfe246004018c2ca85156fc73c146Lennart Poettering# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
71dc3ed1d95dfe246004018c2ca85156fc73c146Lennart Poettering# ex: ts=8 sw=4 sts=4 et filetype=sh
71dc3ed1d95dfe246004018c2ca85156fc73c146Lennart PoetteringTEST_DESCRIPTION="cryptsetup systemd setup"
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier [[ -f $TESTDIR/root/failed ]] && cp -a $TESTDIR/root/failed $TESTDIR
71dc3ed1d95dfe246004018c2ca85156fc73c146Lennart Poettering cryptsetup luksOpen ${LOOPDEV}p2 varcrypt <$TESTDIR/keyfile
71dc3ed1d95dfe246004018c2ca85156fc73c146Lennart Poettering mount /dev/mapper/varcrypt $TESTDIR/root/var
278d5115470919319c514ea37d7b14e3f7d0580bEvgeny Vereshchagin cp -a $TESTDIR/root/var/log/journal $TESTDIR
71dc3ed1d95dfe246004018c2ca85156fc73c146Lennart Poettering cryptsetup luksClose /dev/mapper/varcrypt
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier [[ -f $TESTDIR/failed ]] && cat $TESTDIR/failed
71dc3ed1d95dfe246004018c2ca85156fc73c146Lennart Poettering test -s $TESTDIR/failed && ret=$(($ret+1))
71dc3ed1d95dfe246004018c2ca85156fc73c146Lennart Poettering cryptsetup -q luksFormat ${LOOPDEV}p2 $TESTDIR/keyfile
71dc3ed1d95dfe246004018c2ca85156fc73c146Lennart Poettering cryptsetup luksOpen ${LOOPDEV}p2 varcrypt <$TESTDIR/keyfile
71dc3ed1d95dfe246004018c2ca85156fc73c146Lennart Poettering mount /dev/mapper/varcrypt $TESTDIR/root/var
71dc3ed1d95dfe246004018c2ca85156fc73c146Lennart Poettering # Create what will eventually be our root filesystem onto an overlay
71dc3ed1d95dfe246004018c2ca85156fc73c146Lennart Poettering eval $(udevadm info --export --query=env --name=/dev/mapper/varcrypt)
71dc3ed1d95dfe246004018c2ca85156fc73c146Lennart Poettering eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
71dc3ed1d95dfe246004018c2ca85156fc73c146Lennart Poettering cat >$initdir/etc/systemd/system/testsuite.service <<EOF
71dc3ed1d95dfe246004018c2ca85156fc73c146Lennart PoetteringDescription=Testsuite service
71dc3ed1d95dfe246004018c2ca85156fc73c146Lennart PoetteringAfter=multi-user.target
5c404f1ab8e96efedb983806443ca982a1b2a372Evgeny VereshchaginExecStart=/bin/sh -x -c 'systemctl --failed --no-legend --no-pager > /failed ; echo OK > /testok'
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier$DM_NAME UUID=$ID_FS_UUID /etc/varkey
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier echo -n test > $initdir/etc/varkey
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier/dev/mapper/varcrypt /var ext3 defaults 0 1
71dc3ed1d95dfe246004018c2ca85156fc73c146Lennart Poettering cryptsetup luksClose /dev/mapper/varcrypt