Skip to content

Commit

Permalink
fixup! feat: use largest writable tmpfs that allows executables
Browse files Browse the repository at this point in the history
  • Loading branch information
hugojosefson committed Mar 31, 2024
1 parent d9809a6 commit 5b42559
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 27 deletions.
1 change: 1 addition & 0 deletions example
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ ensure_command_installed() {
fi
}

DENO_VERSION_RANGE_URL_ENCODED="$(printf "%s" "${DENO_VERSION_RANGE}" | xxd -p | tr -d '\n' | sed 's/\(..\)/%\1/g')"
DENO_VERSION_RANGE_URL_ENCODED="$(printf "%s" "${DENO_VERSION_RANGE}" | xxd -p | tr -d '\n' | sed 's/\(..\)/%\1/g')"
DEFAULT_DENO="$(command -v deno || true)"

Expand Down
12 changes: 3 additions & 9 deletions example-piped
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,14 @@ ensure_command_installed() {
fi
}

DENO_VERSION_RANGE_URL_ENCODED="$(printf '%s' "${DENO_VERSION_RANGE}" | xxd -p | tr -d '\n' | sed 's/\(..\)/%\1/g')"
DENO_VERSION_RANGE_URL_ENCODED="$(printf "%s" "${DENO_VERSION_RANGE}" | xxd -p | tr -d '\n' | sed 's/\(..\)/%\1/g')"
DEFAULT_DENO="$(command -v deno || true)"

get_largest_usable_tmpfs() {
mount \
| grep '\btype tmpfs\b' \
| grep -v '\bnoexec\b' \
| grep -v '\bro\b' \
| cut -d' ' -f3 \
| xargs df --output=avail,target \
| tail -n+2 \
findmnt -Ononoexec,noro -ttmpfs -nboAVAIL,TARGET \
| sort -rn \
| head -n1 \
| cut -d' ' -f2
| cut -d\ -f2
}

get_tmp_dir() {
Expand Down
12 changes: 3 additions & 9 deletions example-piped.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,14 @@ ensure_command_installed() {
fi
}

DENO_VERSION_RANGE_URL_ENCODED="$(printf '%s' "${DENO_VERSION_RANGE}" | xxd -p | tr -d '\n' | sed 's/\(..\)/%\1/g')"
DENO_VERSION_RANGE_URL_ENCODED="$(printf "%s" "${DENO_VERSION_RANGE}" | xxd -p | tr -d '\n' | sed 's/\(..\)/%\1/g')"
DEFAULT_DENO="$(command -v deno || true)"

get_largest_usable_tmpfs() {
mount \
| grep '\btype tmpfs\b' \
| grep -v '\bnoexec\b' \
| grep -v '\bro\b' \
| cut -d' ' -f3 \
| xargs df --output=avail,target \
| tail -n+2 \
findmnt -Ononoexec,noro -ttmpfs -nboAVAIL,TARGET \
| sort -rn \
| head -n1 \
| cut -d' ' -f2
| cut -d\ -f2
}

get_tmp_dir() {
Expand Down
1 change: 1 addition & 0 deletions example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ ensure_command_installed() {
fi
}

DENO_VERSION_RANGE_URL_ENCODED="$(printf "%s" "${DENO_VERSION_RANGE}" | xxd -p | tr -d '\n' | sed 's/\(..\)/%\1/g')"
DENO_VERSION_RANGE_URL_ENCODED="$(printf "%s" "${DENO_VERSION_RANGE}" | xxd -p | tr -d '\n' | sed 's/\(..\)/%\1/g')"
DEFAULT_DENO="$(command -v deno || true)"

Expand Down
12 changes: 3 additions & 9 deletions src/deno-shebang-piped.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,14 @@ ensure_command_installed() {
fi
}

DENO_VERSION_RANGE_URL_ENCODED="$(printf '%s' "${DENO_VERSION_RANGE}" | xxd -p | tr -d '\n' | sed 's/\(..\)/%\1/g')"
DENO_VERSION_RANGE_URL_ENCODED="$(printf "%s" "${DENO_VERSION_RANGE}" | xxd -p | tr -d '\n' | sed 's/\(..\)/%\1/g')"
DEFAULT_DENO="$(command -v deno || true)"

get_largest_usable_tmpfs() {
mount \
| grep '\btype tmpfs\b' \
| grep -v '\bnoexec\b' \
| grep -v '\bro\b' \
| cut -d' ' -f3 \
| xargs df --output=avail,target \
| tail -n+2 \
findmnt -Ononoexec,noro -ttmpfs -nboAVAIL,TARGET \
| sort -rn \
| head -n1 \
| cut -d' ' -f2
| cut -d\ -f2
}

get_tmp_dir() {
Expand Down
1 change: 1 addition & 0 deletions src/deno-shebang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ ensure_command_installed() {
fi
}

DENO_VERSION_RANGE_URL_ENCODED="$(printf "%s" "${DENO_VERSION_RANGE}" | xxd -p | tr -d '\n' | sed 's/\(..\)/%\1/g')"
DENO_VERSION_RANGE_URL_ENCODED="$(printf "%s" "${DENO_VERSION_RANGE}" | xxd -p | tr -d '\n' | sed 's/\(..\)/%\1/g')"
DEFAULT_DENO="$(command -v deno || true)"

Expand Down

0 comments on commit 5b42559

Please sign in to comment.