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

export: cancel export when trying to delete #1340

Merged
merged 1 commit into from
May 1, 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
8 changes: 6 additions & 2 deletions distrobox-export
Original file line number Diff line number Diff line change
Expand Up @@ -371,15 +371,19 @@ export_binary() {
mkdir -p "${dest_path}"

# If we're deleting it, just do it and exit
if [ "${exported_delete}" -ne 0 ] &&
if [ "${exported_delete}" -ne 0 ]; then
# ensure it's a distrobox exported binary
grep -q "distrobox_binary" "${dest_file}"; then
if ! grep -q "distrobox_binary" "${dest_file}"; then
printf >&2 "Error: %s is not exported.\n" "${exported_bin}"
return 1
fi

if rm -f "${dest_file}"; then
printf "%s from %s removed successfully from %s.\nOK!\n" \
"${exported_bin}" "${container_name}" "${dest_path}"
return 0
fi
return 1
fi

# test if we have writing rights on the file
Expand Down