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

Destroy script unmounting too much #30

Closed
douglas-raillard-arm opened this issue Oct 1, 2021 · 0 comments · May be fixed by #33
Closed

Destroy script unmounting too much #30

douglas-raillard-arm opened this issue Oct 1, 2021 · 0 comments · May be fixed by #33

Comments

@douglas-raillard-arm
Copy link
Contributor

The destroy script lists too many mount points:

		cat /proc/mounts | cut -d' ' -f2 | grep "^$SCRIPT_DIR" | sort -r

If $SCRIPT_DIR has itself been mounted (e.g. a bind mount, a USB drive, an overlayfs, etc), then it will be part of the list and unmounted by destroy, even though this is outside of the scope of alpine-chroot-install tooling. Instead, it should list the mount points that start with SCRIPT_DIR but are not equal to SCRIPT_DIR:

		cat /proc/mounts | cut -d' ' -f2 | grep "^$SCRIPT_DIR" | grep -v "^$SCRIPT_DIR$" | sort -r

Or alternatively, trying to match an extra char in the path with .:

		cat /proc/mounts | cut -d' ' -f2 | grep "^$SCRIPT_DIR." | sort -r
douglas-raillard-arm added a commit to douglas-raillard-arm/alpine-chroot-install that referenced this issue Oct 12, 2021
Only unmount mount points starting but not equal to the root.

Fix alpinelinux#30
@jirutka jirutka closed this as completed in 8f12e62 Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant