File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
pkg/cidata/cidata.TEMPLATE.d/boot Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -eux -o pipefail
4
+
5
+ # Check if mount type is virtiofs
6
+ if [ " ${LIMA_CIDATA_MOUNTTYPE} " != " virtiofs" ]; then
7
+ exit 0
8
+ fi
9
+
10
+ # Update fstab entries and unmount/remount the volumes with secontext options
11
+ # when selinux is enabled in kernel
12
+ if [ -d /sys/fs/selinux ]; then
13
+ # shellcheck disable=SC2013
14
+ for line in $( grep -n virtiofs < /etc/fstab | cut -d' :' -f1) ; do
15
+ OPTIONS=$( awk -v line=" $line " ' NR==line {print $4}' /etc/fstab)
16
+ if [[ ${OPTIONS} != * " context" * ]]; then
17
+ sed -i -e " $line " " s/comment=cloudconfig/comment=cloudconfig,context=\" system_u:object_r:container_file_t:s0\" /g" /etc/fstab
18
+ TAG=$( awk -v line=" $line " ' NR==line {print $1}' /etc/fstab)
19
+ MOUNT_POINT=$( awk -v line=" $line " ' NR==line {print $2}' /etc/fstab)
20
+ OPTIONS=$( awk -v line=" $line " ' NR==line {print $4}' /etc/fstab)
21
+ umount " ${TAG} "
22
+ mount -t virtiofs " ${TAG} " " ${MOUNT_POINT} " -o " ${OPTIONS} "
23
+ fi
24
+ done
25
+ fi
You can’t perform that action at this time.
0 commit comments