From 5b4255994ef9da7518139196ddb7317bdb147127 Mon Sep 17 00:00:00 2001 From: Hugo Josefson Date: Sun, 31 Mar 2024 23:50:55 +0200 Subject: [PATCH] fixup! feat: use largest writable tmpfs that allows executables --- example | 1 + example-piped | 12 +++--------- example-piped.ts | 12 +++--------- example.ts | 1 + src/deno-shebang-piped.sh | 12 +++--------- src/deno-shebang.sh | 1 + 6 files changed, 12 insertions(+), 27 deletions(-) diff --git a/example b/example index 1dfc263..1c79f80 100755 --- a/example +++ b/example @@ -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)" diff --git a/example-piped b/example-piped index 861d1d5..2d962b6 100755 --- a/example-piped +++ b/example-piped @@ -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() { diff --git a/example-piped.ts b/example-piped.ts index 861d1d5..2d962b6 100755 --- a/example-piped.ts +++ b/example-piped.ts @@ -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() { diff --git a/example.ts b/example.ts index 1dfc263..1c79f80 100755 --- a/example.ts +++ b/example.ts @@ -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)" diff --git a/src/deno-shebang-piped.sh b/src/deno-shebang-piped.sh index 45d090e..de84eed 100755 --- a/src/deno-shebang-piped.sh +++ b/src/deno-shebang-piped.sh @@ -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() { diff --git a/src/deno-shebang.sh b/src/deno-shebang.sh index 429f43d..49e5cd1 100755 --- a/src/deno-shebang.sh +++ b/src/deno-shebang.sh @@ -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)"