From c54e7349870abfbe1646ae08f581134fb2d4bace Mon Sep 17 00:00:00 2001 From: Kron4ek Date: Sat, 10 Jun 2023 15:38:07 +0500 Subject: [PATCH] Make the mount command more readable --- conty-start.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/conty-start.sh b/conty-start.sh index bc5f8fe..7f6851c 100755 --- a/conty-start.sh +++ b/conty-start.sh @@ -794,14 +794,26 @@ if [ -f "${nvidia_drivers_dir}"/lock ] && [ ! "$(ls "${working_dir}"/running_* 2 rm -f "${nvidia_drivers_dir}"/lock fi +if [ "${dwarfs_image}" = 1 ]; then + mount_command=("${mount_tool}" \ + "${script}" "${mount_point}" \ + -o offset="${offset}" \ + -o debuglevel=error \ + -o workers="${dwarfs_num_workers}" \ + -o mlock=try \ + -o no_cache_image \ + -o cache_files \ + -o cachesize="${dwarfs_cache_size}") +else + mount_command=("${mount_tool}" \ + -o offset="${offset}",ro \ + "${script}" "${mount_point}") +fi + # Mount the image mkdir -p "${mount_point}" -if [ "$(ls "${mount_point}" 2>/dev/null)" ] || \ - ( [ "${dwarfs_image}" != 1 ] && launch_wrapper "${mount_tool}" -o offset="${offset}",ro "${script}" "${mount_point}" ) || \ - launch_wrapper "${mount_tool}" "${script}" "${mount_point}" -o offset="${offset}" -o debuglevel=error -o workers="${dwarfs_num_workers}" \ - -o mlock=try -o no_cache_image -o cache_files -o cachesize="${dwarfs_cache_size}"; then - +if [ "$(ls "${mount_point}" 2>/dev/null)" ] || launch_wrapper "${mount_command[@]}"; then if [ "$1" = "-m" ] && [ -z "${script_is_symlink}" ]; then if [ ! -f "${working_dir}"/running_mount ]; then echo 1 > "${working_dir}"/running_mount