Skip to content

Commit

Permalink
Apply shellcheck fixes to blackhole logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jas14 committed Aug 23, 2024
1 parent 9053fcd commit aebf1e4
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,13 @@ done
# We wanted to `apt-get remove` preinstalled packages, but the root filesystem is read-only.
# The best we can do is basically make a verbose version of /bin/false, name it the same as the
# target binary, and have it come before the target binary in the PATH.
while read BLACKHOLE_LINE; do
BINARY_NAME=$(echo "$BLACKHOLE_LINE" | sed -e 's/^blackhole //')
while read -r BLACKHOLE_LINE; do
BINARY_NAME=${BLACKHOLE_LINE/#blackhole /}
topic "Blackholing $BINARY_NAME"
mkdir -p $BUILD_DIR/.apt/usr/bin
mkdir -p "$BUILD_DIR"/.apt/usr/bin
echo 'echo "THIS BINARY HAS BEEN BLACKHOLED"; exit 1' > "$BUILD_DIR/.apt/usr/bin/$BINARY_NAME"
chmod ugo=rx "$BUILD_DIR/.apt/usr/bin/$BINARY_NAME"
done < <(
cat $BUILD_DIR/Aptfile | grep -s -e '^blackhole '
)
done < <(grep -s -e '^blackhole ' "$BUILD_DIR"/Aptfile)
# END: blackhole packages

topic "Writing profile script"
Expand Down

0 comments on commit aebf1e4

Please sign in to comment.