Skip to content

Commit

Permalink
set correct permission for root dir, and remove symlink after unshare
Browse files Browse the repository at this point in the history
  • Loading branch information
ezrizhu committed Feb 20, 2024
1 parent bde4b44 commit f235a75
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions try
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ try() {
## because we have already checked if it valid.
export SANDBOX_DIR
mkdir -p "$SANDBOX_DIR/upperdir" "$SANDBOX_DIR/workdir" "$SANDBOX_DIR/temproot"
chmod 755 "$SANDBOX_DIR/temproot"

## Find all the directories and mounts that need to be mounted
DIRS_AND_MOUNTS="$(mktemp)"
Expand Down Expand Up @@ -282,6 +283,15 @@ EOF
unshare --mount --map-root-user --user --pid --fork $EXTRA_NS "$mount_and_execute"
TRY_EXIT_STATUS=$?

# remove symlink
while IFS="" read -r mountpoint
do
if [ -L "$mountpoint" ]
then
rm "${SANDBOX_DIR}/temproot/${mountpoint}"
fi
done <"$DIRS_AND_MOUNTS"

################################################################################
# commit?

Expand Down

0 comments on commit f235a75

Please sign in to comment.