init-storage: Use a static path as mount point
There's no particular reason why the directory used as the temporary mount point for the data volume needs to be random. Using a static name, on the other hand, makes it easier for the SELinux policy to apply the correct type transition and ensure the directory is labelled correctly.master
parent
c97c7f565b
commit
5939fb525c
|
@ -15,8 +15,8 @@ copy_var() {
|
||||||
dev="$1"
|
dev="$1"
|
||||||
|
|
||||||
echo 'Copying /var contents to data volume'
|
echo 'Copying /var contents to data volume'
|
||||||
mount -o subvol=var "${dev}" "${tmpdir}"
|
mount -o subvol=var "${dev}" "${tmpdir}" || exit
|
||||||
cp -auv /var/. "${tmpdir}"
|
cp -auv /var/. "${tmpdir}" || exit
|
||||||
umount "${tmpdir}"
|
umount "${tmpdir}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,8 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
trap cleanup INT TERM QUIT EXIT
|
trap cleanup INT TERM QUIT EXIT
|
||||||
tmpdir=$(mktemp -d -p /run storinit.XXXXXX)
|
tmpdir=/run/storinit
|
||||||
|
mkdir -p "${tmpdir}"
|
||||||
|
|
||||||
if ! has_fs "${datapart}"; then
|
if ! has_fs "${datapart}"; then
|
||||||
format_dev "${datapart}"
|
format_dev "${datapart}"
|
||||||
|
|
Loading…
Reference in New Issue