Skip to content

Commit 45eef8f

Browse files
authored
init: fix runtime sync fallback (#1622)
Example: distrobox create -i ubuntu:18.04 -n ubuntu18
1 parent d644bd3 commit 45eef8f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

distrobox-init

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,8 +1779,9 @@ for host_mount_ro in ${HOST_MOUNTS_RO}; do
17791779
printf "Warning: %s integration with the host failed, runtime sync for %s disabled.\n" "${host_mount_ro}" "${host_mount_ro}"
17801780
# Fallback options for files, we do a hard copy of it
17811781
if [ -f /run/host"${host_mount_ro}" ]; then
1782-
rm -f "${host_mount_ro}"
1783-
cp -f /run/host"${host_mount_ro}" "${host_mount_ro}"
1782+
if ! (rm -f "${host_mount_ro}" && cp -f /run/host"${host_mount_ro}" "${host_mount_ro}"); then
1783+
printf "Warning: Hard copy failed. Error: %s\n" "$(cp -f /run/host"${host_mount_ro}" "${host_mount_ro}" 2>&1)"
1784+
fi
17841785
fi
17851786
fi
17861787
done

0 commit comments

Comments
 (0)