blob: 8dce2224947efbcc0dd3ead8dbbf68322c6078dc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/bin/bash
# Test unlock --transient
set -xeuo pipefail
. ${KOLA_EXT_DATA}/libinsttest.sh
testfile=/usr/share/writable-usr-test
case "${AUTOPKGTEST_REBOOT_MARK:-}" in
"")
require_writable_sysroot
assert_not_has_file "${testfile}"
ostree admin unlock --transient
# It's still read-only
if touch ${testfile}; then
fatal "modified /usr"
fi
# But, we can affect it in a new mount namespace
unshare -m -- /bin/sh -c 'mount -o remount,rw /usr && echo hello from transient unlock >'"${testfile}"
assert_file_has_content "${testfile}" "hello from transient unlock"
# Still can't write to it from the outer namespace
if touch ${testfile} || rm -v "${testfile}" 2>/dev/null; then
fatal "modified ${testfile}"
fi
/tmp/autopkgtest-reboot 2
;;
"2")
if test -f "${testfile}"; then
fatal "${testfile} persisted across reboot?"
fi
echo "ok unlock transient"
;;
*) fatal "Unexpected boot mark ${AUTOPKGTEST_REBOOT_MARK}"
esac
|