@@ -10,26 +10,31 @@ if [ -f /etc/alpine-release ]; then
1010 rc-service qemu-binfmt stop --ifstarted
1111fi
1212
13- mkdir -p /mnt/lima-rosetta
14-
15- # Check selinux is enabled by kernel
16- if [ -d /sys/fs/selinux ]; then
17- # #########################################################################################
18- # # When using vz & virtiofs, initially container_file_t selinux label
19- # # was considered which works perfectly for container work loads
20- # # but it might break for other work loads if the process is running with
21- # # different label. Also these are the remote mounts from the host machine,
22- # # so keeping the label as nfs_t fits right. Package container-selinux by
23- # # default adds rules for nfs_t context which allows container workloads to work as well.
24- # # https://github.com/lima-vm/lima/pull/1965
25- # #########################################################################################
26- mount -t virtiofs vz-rosetta /mnt/lima-rosetta -o context=" system_u:object_r:nfs_t:s0"
27- else
28- mount -t virtiofs vz-rosetta /mnt/lima-rosetta
13+ # Mount the rosetta volume for non cloud-init based images
14+ rosetta_interpreter=/mnt/lima-rosetta/rosetta
15+ if [ ! -f " $rosetta_interpreter " ]; then
16+ rosetta_mountpoint=$( dirname " $rosetta_interpreter " )
17+ mkdir -p " $rosetta_mountpoint "
18+
19+ # Check selinux is enabled by kernel
20+ if [ -d /sys/fs/selinux ]; then
21+ # #########################################################################################
22+ # # When using vz & virtiofs, initially container_file_t selinux label
23+ # # was considered which works perfectly for container work loads
24+ # # but it might break for other work loads if the process is running with
25+ # # different label. Also these are the remote mounts from the host machine,
26+ # # so keeping the label as nfs_t fits right. Package container-selinux by
27+ # # default adds rules for nfs_t context which allows container workloads to work as well.
28+ # # https://github.com/lima-vm/lima/pull/1965
29+ # #########################################################################################
30+ mount -t virtiofs vz-rosetta " $rosetta_mountpoint " -o context=" system_u:object_r:nfs_t:s0"
31+ else
32+ mount -t virtiofs vz-rosetta " $rosetta_mountpoint "
33+ fi
2934fi
3035
3136if [ " $LIMA_CIDATA_ROSETTA_BINFMT " = " true" ]; then
32- rosetta_binfmt=" :rosetta:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00:\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/mnt/lima-rosetta/rosetta :OCF"
37+ rosetta_binfmt=" :rosetta:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00:\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:$rosetta_interpreter :OCF"
3338
3439 # If rosetta is not registered in binfmt_misc, register it.
3540 [ -f /proc/sys/fs/binfmt_misc/rosetta ] || echo " $rosetta_binfmt " > /proc/sys/fs/binfmt_misc/register
0 commit comments