Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init: separate 'mount --rbind -o rslave ...' into 'mount --rbind ...'… #1583

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions distrobox-init
Original file line number Diff line number Diff line change
Expand Up @@ -388,12 +388,18 @@ mount_bind()
fi

# Add mountflags if needed, if no are specified, use rslave as default.
if [ "${mount_flags}" = "" ]; then
mount_flags="rslave"
fi
# bind mount source_dir to target_dir, return error if not successful
if ! mount --rbind -o "${mount_flags}" "${source_dir}" "${target_dir}"; then
printf "Warning: failed to bind mount %s to %s\n" "${source_dir}" "${target_dir}"
if [ "${mount_flags}" = "" ]; then
if ! mount --rbind "${source_dir}" "${target_dir}"; then
printf "Warning: failed to bind mount %s to %s\n" "${source_dir}" "${target_dir}"
return 1
fi
if ! mount --make-rslave "${target_dir}"; then
printf "Warning: failed to make rslave to %s\n" "${target_dir}"
return 1
fi
elif ! mount --rbind -o "${mount_flags}" "${source_dir}" "${target_dir}"; then
printf "Warning: failed to bind mount %s to %s using option %s\n" "${source_dir}" "${target_dir}" "${mount_flags}"
return 1
fi

Expand Down
Loading