Skip to content

Commit aabca2e

Browse files
euankjosharian
authored andcommitted
all: update shebangs for more portability
NixOS by default doesn't ship with /bin/bash, rather /usr/bin/env bash is the way to get the right bash. This caused two issues on NixOS: 1. The `push` button on the web interface would fail with ` ! [remote rejected] <commit> -> <branch> (pre-receive hook declined)` 2. `make` would result in an error On the host side, for 1 you could see `fatal: cannot exec '/tmp/sketch-git-hooks-3993344797/pre-receive': No such file or directory`, and for 2, you could similarly see `make: ./build/webui.sh: No such file or directory` This fixes both of those errors by updating to more portable shebangs. ```
1 parent 72cf08c commit aabca2e

File tree

10 files changed

+12
-12
lines changed

10 files changed

+12
-12
lines changed

bin/run-formatters.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
set -e
33

44
# Script to run formatters for both Go and webui files

build/clean.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
set -e
33

44
rm -f sketch
55
rm -rf embedded/sketch-linux embedded/webui-dist
6-
rm -rf webui/node_modules webui/dist
6+
rm -rf webui/node_modules webui/dist

build/innie.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
set -e
33

44
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="${LDFLAGS:-}" -tags=innie -o embedded/sketch-linux/sketch-linux-amd64 ./cmd/sketch &

build/outie.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
set -e
33

44
# Note: This incantation is duplicated in .goreleaser.yml; please keep them in sync.

build/webui.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
set -e
33

44
# Use a content-based hash of the webui dir to avoid unnecessary rebuilds.

claudetool/codereview/update_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
44
CURRENT_DIR=$(pwd)

dockerimg/githttp_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func TestSetupHooksDir(t *testing.T) {
5151
// Check for key elements in the script
5252
contentStr := string(content)
5353
if !containsAll(contentStr, []string{
54-
"#!/bin/bash",
54+
"#!/usr/bin/env bash",
5555
"refs/remotes/origin/",
5656
"git push origin",
5757
"Force pushes are not allowed",
@@ -110,7 +110,7 @@ func TestPreReceiveHookScript(t *testing.T) {
110110

111111
// Verify the script contains the expected bash shebang
112112
scriptContent := string(script)
113-
if !contains(scriptContent, "#!/bin/bash") {
113+
if !contains(scriptContent, "#!/usr/bin/env bash") {
114114
t.Errorf("pre-receive hook missing bash shebang")
115115
}
116116

dockerimg/post-receive.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
# Post-receive hook for sketch git http server
33
# Sets upstream tracking branch for sketch branches
44

dockerimg/pre-receive.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
# Pre-receive hook for sketch git http server
33
# Handles refs/remotes/origin/Y pushes by forwarding them to origin/Y
44

loop/update_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
44
CURRENT_DIR=$(pwd)

0 commit comments

Comments
 (0)