diff --git a/install.sh b/install.sh index b687c1d..83b92e5 100755 --- a/install.sh +++ b/install.sh @@ -81,4 +81,4 @@ fi $sudo mkdir -p "$INSTALL_DIR" $sudo install -m 0755 "$bin" "$INSTALL_DIR/aperture" -echo "==> Installed $("$INSTALL_DIR/aperture" -version | head -1) to $INSTALL_DIR/aperture" +echo "==> Installed $("$INSTALL_DIR/aperture" --version | head -1) to $INSTALL_DIR/aperture" diff --git a/scripts/sign_macos_test.go b/scripts/sign_macos_test.go index 845b27b..9426da0 100644 --- a/scripts/sign_macos_test.go +++ b/scripts/sign_macos_test.go @@ -176,3 +176,20 @@ case "$tool $1" in ;; esac ` + +// install.sh reports the version of what it just installed. It has to use the +// GNU form: the single-dash long form is deprecated, so it both prints a +// deprecation warning on stderr and would greet every fresh install with a +// notice about a flag the user never typed. +func TestInstallScriptReportsVersionInGNUForm(t *testing.T) { + script, err := os.ReadFile("../install.sh") + if err != nil { + t.Fatal(err) + } + if strings.Contains(string(script), " -version") { + t.Error("install.sh calls the installed binary with the deprecated -version form") + } + if !strings.Contains(string(script), `aperture" --version`) { + t.Error("install.sh no longer reports the installed version") + } +}