Skip to content

Comments

Add support for TMPDIR in install.sh#5285

Open
gene1wood wants to merge 11 commits intonetbirdio:mainfrom
gene1wood:support-tmpdir
Open

Add support for TMPDIR in install.sh#5285
gene1wood wants to merge 11 commits intonetbirdio:mainfrom
gene1wood:support-tmpdir

Conversation

@gene1wood
Copy link

@gene1wood gene1wood commented Feb 9, 2026

Describe your changes

  • Adds support for the POSIX TMPDIR standard in install.sh which enables the user to indicate their temporary directory with the TMPDIR environment variable. If no TMPDIR value is set, the installer falls back to the original behavior of using /tmp.
  • Adds caching if the installation package is already present locally and the remote package is not newer. This would prevent re-downloading the same release package file if the newest package is already present.
  • Expands the curl arguments for these package downloads from their single character version (e.g. -L) to the full version (e.g. --location) for greater clarity.
  • Disable the curl progress meter when fetching the binary package. This matches the curl behavior when downloading the MacOS package and keeps the installer output clean.
  • Remove the deletion of /tmp/netbird.pkg for MacOS installations. This leaves it to the OS to manage keeping the /tmp directory clean and matches the behavior when downloading binary packages to /tmp. This also makes caching of packages possible by retaining the downloaded package.

Issue ticket number and link

Fixes #5284

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Summary by CodeRabbit

  • Bug Fixes

    • Installer now respects configured temporary directories (avoids hard-coded /tmp) and improves OS detection for more reliable platform-specific installs.
  • Improvements

    • Installer supports specifying application type for correct binary naming, selection, and UI install flow.
    • Replaced ad-hoc OS checks with stable OS-type constants and clarified, type-aware install logs and download behavior.

* Adds support for the POSIX TMPDIR standard in `install.sh` which enables the user to indicate their temporary directory with the TMPDIR environment variable. If no TMPDIR value is set, the installer falls back to the original behavior of using `/tmp`.
* Adds caching if the installation package is already present locally and the remote package is not newer. This would prevent re-downloading the same release package file if the newest package is already present.
* Expands the curl arguments for these package downloads from their single character version (e.g. -L) to the full version (e.g. --location) for greater clarity.
* Disable the curl progress meter when fetching the binary package. This matches the curl behavior when downloading the MacOS package and keeps the installer output clean.
* Remove the deletion of `/tmp/netbird.pkg` for MacOS installations. This leaves it to the OS to manage keeping the `/tmp` directory clean and matches the behavior when downloading binary packages to `/tmp`. This also makes caching of packages possible by retaining the downloaded package.

Fixes netbirdio#5284
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds DARWIN and LINUX constants and an APP_TYPE parameter to download/install logic in release_files/install.sh; switches OS checks to those constants, replaces hard-coded /tmp with ${TMPDIR:-/tmp}, strengthens curl flags and Authorization header usage, and adjusts binary naming and UI-app handling to use APP_TYPE. (48 words)

Changes

Cohort / File(s) Summary
Install script
release_files/install.sh
Add DARWIN and LINUX constants; add APP_TYPE parameter to download_release_binary() and pivot binary naming, UI-app branches, install paths and messages to use APP_TYPE; replace hard-coded /tmp with ${TMPDIR:-/tmp}; tighten curl invocation (--fail --silent --show-error --location --remote-name --time-cond) and use --header for Authorization when GITHUB_TOKEN is present; migrate Darwin/Linux checks to constant comparisons. No other public signatures changed.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant User
  participant Installer as "install.sh"
  participant GitHub as "GitHub Release"
  participant FS as "Filesystem (${TMPDIR:-/tmp})"

  User->>Installer: run install.sh (pass APP_TYPE)
  Installer->>GitHub: curl request (--fail --silent --show-error --location --remote-name --time-cond, add Authorization header if GITHUB_TOKEN)
  GitHub-->>Installer: return release asset
  Installer->>FS: save asset to ${TMPDIR:-/tmp}
  Installer->>Installer: compute BINARY_NAME using APP_TYPE + DARWIN/LINUX constants
  Installer->>FS: move/install binary/package to target location (APP_TYPE-driven paths)
  Installer-->>User: report install completion
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped where temp files like to hide,
TMPDIR showed me a tidier stride.
APP_TYPE named every shiny crate,
Darwin and Linux, tidy and straight.
Curl fetched treats — I did a happy slide.

🚥 Pre-merge checks | ✅ 3 | ❌ 3
❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (97 files):

⚔️ .github/workflows/check-license-dependencies.yml (content)
⚔️ .github/workflows/golang-test-darwin.yml (content)
⚔️ .github/workflows/golang-test-freebsd.yml (content)
⚔️ .github/workflows/golang-test-linux.yml (content)
⚔️ .github/workflows/golang-test-windows.yml (content)
⚔️ .github/workflows/golangci-lint.yml (content)
⚔️ .github/workflows/release.yml (content)
⚔️ .gitignore (content)
⚔️ .goreleaser.yaml (content)
⚔️ LICENSE (content)
⚔️ client/cmd/login.go (content)
⚔️ client/embed/embed.go (content)
⚔️ client/firewall/nftables/router_linux.go (content)
⚔️ client/firewall/nftables/router_linux_test.go (content)
⚔️ client/firewall/uspfilter/conntrack/tcp.go (content)
⚔️ client/firewall/uspfilter/conntrack/tcp_test.go (content)
⚔️ client/firewall/uspfilter/log/log.go (content)
⚔️ client/iface/device/device_filter.go (content)
⚔️ client/iface/device/device_netstack.go (content)
⚔️ client/iface/netstack/tun.go (content)
⚔️ client/internal/engine.go (content)
⚔️ client/internal/networkmonitor/monitor.go (content)
⚔️ go.mod (content)
⚔️ go.sum (content)
⚔️ infrastructure_files/getting-started.sh (content)
⚔️ management/cmd/management.go (content)
⚔️ management/cmd/management_test.go (content)
⚔️ management/cmd/root.go (content)
⚔️ management/internals/controllers/network_map/controller/controller.go (content)
⚔️ management/internals/modules/peers/manager.go (content)
⚔️ management/internals/modules/peers/manager_mock.go (content)
⚔️ management/internals/server/boot.go (content)
⚔️ management/internals/server/config/config.go (content)
⚔️ management/internals/server/modules.go (content)
⚔️ management/internals/server/server.go (content)
⚔️ management/server/account.go (content)
⚔️ management/server/account/manager.go (content)
⚔️ management/server/account_test.go (content)
⚔️ management/server/activity/codes.go (content)
⚔️ management/server/group_test.go (content)
⚔️ management/server/http/handler.go (content)
⚔️ management/server/http/handlers/peers/peers_handler.go (content)
⚔️ management/server/http/handlers/peers/peers_handler_test.go (content)
⚔️ management/server/http/middleware/auth_middleware.go (content)
⚔️ management/server/http/middleware/auth_middleware_test.go (content)
⚔️ management/server/http/testing/testing_tools/channel/channel.go (content)
⚔️ management/server/idp/auth0.go (content)
⚔️ management/server/idp/authentik.go (content)
⚔️ management/server/idp/azure.go (content)
⚔️ management/server/idp/embedded.go (content)
⚔️ management/server/idp/google_workspace.go (content)
⚔️ management/server/idp/keycloak.go (content)
⚔️ management/server/idp/pocketid.go (content)
⚔️ management/server/idp/util.go (content)
⚔️ management/server/idp/zitadel.go (content)
⚔️ management/server/mock_server/account_mock.go (content)
⚔️ management/server/networks/manager_test.go (content)
⚔️ management/server/networks/resources/manager.go (content)
⚔️ management/server/networks/resources/manager_test.go (content)
⚔️ management/server/peer.go (content)
⚔️ management/server/peer/peer.go (content)
⚔️ management/server/peer_test.go (content)
⚔️ management/server/permissions/modules/module.go (content)
⚔️ management/server/store/sql_store.go (content)
⚔️ management/server/store/sqlstore_bench_test.go (content)
⚔️ management/server/store/store.go (content)
⚔️ management/server/telemetry/app_metrics.go (content)
⚔️ management/server/types/account.go (content)
⚔️ management/server/types/networkmap_golden_test.go (content)
⚔️ management/server/util/util.go (content)
⚔️ relay/cmd/root.go (content)
⚔️ relay/server/server.go (content)
⚔️ release_files/install.sh (content)
⚔️ shared/management/client/rest/client.go (content)
⚔️ shared/management/client/rest/events.go (content)
⚔️ shared/management/client/rest/events_test.go (content)
⚔️ shared/management/client/rest/networks.go (content)
⚔️ shared/management/client/rest/networks_test.go (content)
⚔️ shared/management/client/rest/peers.go (content)
⚔️ shared/management/client/rest/peers_test.go (content)
⚔️ shared/management/client/rest/users.go (content)
⚔️ shared/management/client/rest/users_test.go (content)
⚔️ shared/management/http/api/openapi.yml (content)
⚔️ shared/management/http/api/types.gen.go (content)
⚔️ shared/management/proto/generate.sh (content)
⚔️ shared/management/proto/management.pb.go (content)
⚔️ shared/management/status/error.go (content)
⚔️ shared/relay/client/client.go (content)
⚔️ shared/relay/client/conn.go (content)
⚔️ signal/cmd/root.go (content)
⚔️ signal/cmd/run.go (content)
⚔️ signal/metrics/app.go (content)
⚔️ signal/server/signal.go (content)
⚔️ stun/server.go (content)
⚔️ util/log.go (content)
⚔️ util/syslog_nonwindows.go (content)
⚔️ util/syslog_windows.go (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
Out of Scope Changes check ❓ Inconclusive The PR introduces additional enhancements beyond the core TMPDIR requirement (caching, curl flag expansion, progress meter disabling, package retention) which are described as intended improvements but not part of the original issue scope. Clarify whether the additional enhancements (caching, curl flags, progress meter, package retention) should be included in this PR or deferred to separate issues for better scope isolation.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add support for TMPDIR in install.sh' is directly related to one key aspect of the PR (TMPDIR support), but the changeset includes additional substantial improvements (caching, curl flag expansion, progress meter disabling, and package retention) not reflected in the title.
Description check ✅ Passed The PR description comprehensively covers all major changes including TMPDIR support, caching, curl flag expansion, progress meter disabling, and package retention. It references the linked issue, includes proper checklist marking, and follows the template structure.
Linked Issues check ✅ Passed The PR successfully implements the core requirement from issue #5284: adding TMPDIR environment variable support to install.sh with fallback to /tmp when TMPDIR is unset, as evidenced by the mentioned shift to TMPDIR-based paths in the raw summary.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@release_files/install.sh`:
- Line 79: The fallback curl invocation that retries the download currently
re-sends the conditional header (--time-cond) and can silently accept a 304 and
leave a stale binary; update the second curl command (the fallback after the ||)
to remove the --time-cond "${TMPDIR:-/tmp}/${BINARY_NAME}" argument so the
fallback always requests the resource unconditionally using the same flags
(e.g., keep --fail --silent --show-error --location --remote-name --dns-servers
8.8.8.8) with DOWNLOAD_URL and TMPDIR/BINARY_NAME unchanged.
🧹 Nitpick comments (2)
release_files/install.sh (2)

77-80: Consider extracting ${TMPDIR:-/tmp} into a variable to reduce repetition and risk of divergence.

The expression ${TMPDIR:-/tmp} is repeated seven times across the file. A single assignment near the top (e.g., NB_TMPDIR="${TMPDIR:-/tmp}") would be easier to read, less error-prone, and simpler to change later.

♻️ Suggested refactor

Add near the top of the file (e.g., after line 19):

+NB_TMPDIR="${TMPDIR:-/tmp}"

Then replace every occurrence, for example:

-      cd "${TMPDIR:-/tmp}" && curl --fail --silent --show-error --location --remote-name --time-cond "${TMPDIR:-/tmp}/${BINARY_NAME}" --header "Authorization: token ${GITHUB_TOKEN}" "$DOWNLOAD_URL"
+      cd "${NB_TMPDIR}" && curl --fail --silent --show-error --location --remote-name --time-cond "${NB_TMPDIR}/${BINARY_NAME}" --header "Authorization: token ${GITHUB_TOKEN}" "$DOWNLOAD_URL"

…and similarly for lines 79, 188, and 189.


77-77: These curl invocations are very long single lines — consider line continuations for readability.

Lines 77 and 79 are well over 150 characters. Shell line continuations (\) would make these easier to review and maintain.

♻️ Example for line 77
-      cd "${TMPDIR:-/tmp}" && curl --fail --silent --show-error --location --remote-name --time-cond "${TMPDIR:-/tmp}/${BINARY_NAME}" --header "Authorization: token ${GITHUB_TOKEN}" "$DOWNLOAD_URL"
+      cd "${TMPDIR:-/tmp}" && \
+        curl --fail --silent --show-error --location --remote-name \
+          --time-cond "${TMPDIR:-/tmp}/${BINARY_NAME}" \
+          --header "Authorization: token ${GITHUB_TOKEN}" \
+          "$DOWNLOAD_URL"

This satisfies the SonarQube issue of "String literals should not be duplicated [shelldre:S1192](https://sonarcloud.io/organizations/netbirdio/rules?open=shelldre%3AS1192&rule_key=shelldre%3AS1192)" by setting the OS_TYPE values of "darwin" and "linux" to constants.

This also changes the leading whitespace for one line from tabs to spaces to match its neighboring lines.
When fetching the binary release, if the curl fetch fails, the installer retries using the 8.8.8.8 DNS server. This commit removes the --time-cond curl argument from this fallback retry fetch since under this condition, where DNS isn't working, we should download the binary release regardless of whether or not there is a local copy of the file, to ensure we get an updated file if there is a newer version.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@release_files/install.sh`:
- Around line 16-17: The DARWIN and LINUX constants are defined as lowercase
strings but never dereferenced, causing OS_TYPE to become the uppercase literals
"DARWIN"/"LINUX" and producing wrong download filenames; fix by either (A)
dereferencing the constants where assigned and compared—e.g., set OS_TYPE to
"$DARWIN" or "$LINUX" and compare against "$DARWIN"/"$LINUX" wherever [
"$OS_TYPE" = ... ] is used so interpolated filenames use lowercase—or (B) remove
the DARWIN/LINUX constants and replace their usages with the lowercase literals
"darwin"/"linux" directly (ensure all comparisons and the OS_TYPE assignment and
any interpolation into download filenames reference the lowercase value). Ensure
changes touch the OS_TYPE assignments, comparisons, and any download filename
interpolation that uses OS_TYPE.

This was a mistake where the `$` was missing from the constants.
@gene1wood
Copy link
Author

gene1wood commented Feb 9, 2026

I'm unsure what the convention is here in the netbird repo

I'm finding that SonarQube is identifying pre-existing issues with install.sh. Is the convention in the netbird repo, that if a contributor PRs a change in a file, if SonarQube identifies other issues in that file that don't have anything to do with the PR, the contributor should fix those issues and incorporate them into the PR? Or is the contributor meant to ignore the SonarQube CI failures as they are pre-existing and not related to the PR?

I began fixing the pre-existing issues that SonarQube identified (see 47ad132 and ce24863 ), but after doing so, SonarQube found further pre-existing issues with install.sh

I'm trying to figure out if I should work on those pre-existing issues or ignore them.

This was a mistake where the `$` was missing from the constants.
@gene1wood
Copy link
Author

@coderabbitai resume

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

✅ Actions performed

Reviews resumed.

To satisfy SonarQube which identified

> Function parameters should be assigned to local variables with descriptive names [shelldre:S7679](https://sonarcloud.io/organizations/netbirdio/rules?open=shelldre%3AS7679&rule_key=shelldre%3AS7679)

This replaces the use of `$1` in the `download_release_binary()` function in `installer.sh` with the variable `$APP_TYPE`
@gene1wood
Copy link
Author

The remaining SonarQube issues involve

Use "[[" instead of "[" for conditional tests shelldre:S7688

I think that maintaining POSIX compatibility across the potentially broad set of clients that one might run install.sh on is more important than the benefits of switching away from [ to [[.

If the maintainers disagree and would like to see that change, I can make it in this PR.

I'm still unsure if I should even be making these SonarQube changes due to pre-existing issues that don't relate to my change in this PR

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@release_files/install.sh`:
- Around line 80-82: Replace the curl calls that use --remote-name and
--time-cond (the branches that run with and without GITHUB_TOKEN) with a safe
temporary-file download pattern: create a temp file (using mktemp with
"${TMPDIR:-/tmp}/${BINARY_NAME}.XXXXXX"), invoke curl with -o "$tmp" and -z
"${TMPDIR:-/tmp}/${BINARY_NAME}" (preserve any header/option differences like
--header "Authorization: token ${GITHUB_TOKEN}" and the --dns-servers fallback),
capture the HTTP status via -w '%{http_code}', and only mv the temp file to
"${TMPDIR:-/tmp}/${BINARY_NAME}" when the status is 200; otherwise rm -f the
temp file. Update both the authenticated branch and the public branch (the two
curl invocations around BINARY_NAME/TMPDIR/DOWNLOAD_URL) to use this pattern to
avoid truncation on HTTP 304.
🧹 Nitpick comments (1)
release_files/install.sh (1)

100-100: The parameter expansion ${APP_TYPE%_"${BINARY_BASE_NAME}"} is a no-op — likely meant to use BINARY_NAME.

APP_TYPE is "netbird" or "netbird-ui", which never ends with _${BINARY_BASE_NAME}, so the % suffix strip never matches and the expansion just returns APP_TYPE unchanged. This works by coincidence (the extracted binary name happens to equal APP_TYPE), but it's misleading.

If the intent was to derive the binary name from the archive filename, it should operate on BINARY_NAME. If the intent is simply to reference the extracted binary by APP_TYPE, drop the % expansion for clarity:

Suggested simplification
-        ${SUDO} mv "${APP_TYPE%_"${BINARY_BASE_NAME}"}" "$INSTALL_DIR/"
+        ${SUDO} mv "${APP_TYPE}" "$INSTALL_DIR/"

This tells curl to set the modified time of the file it downloads to that on the remote server. This will enable effective caching if the package is fetched again.
Given the broad set of OSes that the install.sh runs on, we should prefer POSIX compliance over the reliability best practice that SonarQube calls out in [shelldre:S7688](https://sonarcloud.io/organizations/netbirdio/rules?open=shelldre%3AS7688&rule_key=shelldre%3AS7688)

This disables SonarQube on these lines (sadly there is no more targeted way to do this, for example to disable only this specific shelldre for these lines)
The syntax for the NOSONAR annotation is //NOSONAR
Moving the //NOSONAR annotation to the end of the comment to be at the end of the line
It looks like the //NOSONAR annotation doesn't work in shell files.
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
6 New issues
6 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@release_files/install.sh`:
- Around line 67-74: Keep the existing UI Linux asset naming as-is (do not
change the repeated "linux" segment); fix the unsafe unquoted assignment by
changing APP_TYPE=$1 to APP_TYPE="$1" so APP_TYPE safely handles spaces/special
chars, and simplify the pointless parameter expansion
`${APP_TYPE%_"${BINARY_BASE_NAME}"}` to just `${APP_TYPE}` (adjust uses in
BINARY_NAME/BINARY_BASE_NAME logic accordingly) to improve clarity.
🧹 Nitpick comments (2)
release_files/install.sh (2)

100-100: No-op parameter expansion — simplify to $APP_TYPE.

${APP_TYPE%_"${BINARY_BASE_NAME}"} attempts to strip a suffix from APP_TYPE, but APP_TYPE ("netbird" or "netbird-ui") never ends with _${BINARY_BASE_NAME}, so the % expansion is always a no-op. This is confusing to read and suggests the extracted binary name is derived from BINARY_NAME when it's really just APP_TYPE.

♻️ Proposed simplification
-        ${SUDO} mv "${APP_TYPE%_"${BINARY_BASE_NAME}"}" "$INSTALL_DIR/"
+        ${SUDO} mv "${APP_TYPE}" "$INSTALL_DIR/"

80-82: cd inside the function permanently changes the working directory for the caller.

cd "${TMPDIR:-/tmp}" runs in the current shell (not a subshell), so after download_release_binary returns, the script's working directory is ${TMPDIR:-/tmp}. This happens to work because subsequent operations reference $BINARY_NAME as a relative path and later code uses absolute paths for service installation. However, this is fragile — future changes that assume the original working directory after calling install_native_binaries could silently break.

Consider wrapping the function body in a subshell (...) or saving/restoring the directory.

Comment on lines 67 to 74
if [ "$APP_TYPE" = "$UI_APP" ]; then # Prefer POSIX compliance over shelldre:S7688 //NOSONAR
BINARY_NAME="${APP_TYPE}-${OS_TYPE}_${BINARY_BASE_NAME}"
if [ "$OS_TYPE" = "$DARWIN" ]; then # Prefer POSIX compliance over shelldre:S7688 //NOSONAR
BINARY_NAME="${APP_TYPE}_${BINARY_BASE_NAME}"
fi
else
BINARY_NAME="$1_${BINARY_BASE_NAME}"
BINARY_NAME="${APP_TYPE}_${BINARY_BASE_NAME}"
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -e

echo "=== Checking latest GitHub release assets for netbird-ui ==="
curl -s https://api.github.com/repos/netbirdio/netbird/releases/latest \
  | jq -r '.assets[] | select(.name | contains("netbird-ui")) | .name' | head -20

echo ""
echo "=== Checking goreleaser UI config for naming patterns ==="
fd '.goreleaser' . --type f 2>/dev/null | head -5
# Look for goreleaser config files
fd 'goreleaser' . --type f 2>/dev/null | while read f; do
  if [[ "$f" == *".yml"* ]] || [[ "$f" == *".yaml"* ]]; then
    echo "File: $f"
    head -30 "$f"
    echo "---"
  fi
done

echo ""
echo "=== Checking current install.sh lines 55-75 ==="
sed -n '55,75p' release_files/install.sh

echo ""
echo "=== Checking old install.sh from main branch ==="
curl -s https://raw.githubusercontent.com/netbirdio/netbird/main/release_files/install.sh 2>/dev/null | sed -n '55,75p' || echo "Could not fetch main branch"

Repository: netbirdio/netbird

Length of output: 2307


🏁 Script executed:

sed -n '95,105p' release_files/install.sh

Repository: netbirdio/netbird

Length of output: 416


🏁 Script executed:

sed -n '55,60p' release_files/install.sh

Repository: netbirdio/netbird

Length of output: 355


Remove the binary naming concern; fix line 57 quoting.

The UI Linux asset name netbird-ui-linux_0.65.0_linux_amd64.tar.gz is correct per GitHub releases—the repeated linux segment is intentional. However, line 57 requires quoting: APP_TYPE="$1" instead of APP_TYPE=$1 to safely handle potential whitespace or special characters.

Additionally, the parameter expansion on line 100—${APP_TYPE%_"${BINARY_BASE_NAME}"} —is a no-op (never matches, returns APP_TYPE unchanged) and could be simplified to just ${APP_TYPE} for clarity.

🤖 Prompt for AI Agents
In `@release_files/install.sh` around lines 67 - 74, Keep the existing UI Linux
asset naming as-is (do not change the repeated "linux" segment); fix the unsafe
unquoted assignment by changing APP_TYPE=$1 to APP_TYPE="$1" so APP_TYPE safely
handles spaces/special chars, and simplify the pointless parameter expansion
`${APP_TYPE%_"${BINARY_BASE_NAME}"}` to just `${APP_TYPE}` (adjust uses in
BINARY_NAME/BINARY_BASE_NAME logic accordingly) to improve clarity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for TMPDIR in install.sh

1 participant