Skip to content

Fix script issues#3577

Open
gravitacia wants to merge 2 commits into
beefproject:masterfrom
gravitacia:fix-scripts
Open

Fix script issues#3577
gravitacia wants to merge 2 commits into
beefproject:masterfrom
gravitacia:fix-scripts

Conversation

@gravitacia
Copy link
Copy Markdown

Pull Request

Thanks for submitting a PR! Please fill in this template where appropriate:

Category

Bug, Tools, Installer

Feature/Issue Description

Q: Please give a brief summary of your feature/fix
A: This PR fixes two cross-platform compatibility scripting bugs affecting installation and development tools on standard GNU/Linux environments: (1) a Linux syntax error in the version bumping utility caused by macOS-specific sed -i arguments, and (2) missing sudo privileges on the Alpine Linux installer path

Q: Give a technical rundown of what you have changed (if applicable)
A:

  1. tools/bump-version.sh: Implemented a check on the $OSTYPE environment variable. If running on macOS , the script utilizes the BSD-compliant sed -i '' -e syntax. On other operating systems (like GNU/Linux), it falls back to standard sed -i -e syntax.
  2. install: Added sudo to the apk update and apk add commands on the Alpine Linux branch to ensure standard root privileges during dependency installation (aligning with the Debian, RedHat, SuSE, and Arch Linux installation paths).
  3. Both files have been normalized to standard Unix \n (LF) line endings

Test Cases

Q: Describe your test cases, what you have covered and if there are any use cases that still need addressing.
A: Both scripts were successfully validated for bash parsing and syntax correctness using the bash -n utility, completing with zero warnings or syntax errors

Wiki Page

(Not applicable)

@zinduolis
Copy link
Copy Markdown
Contributor

Thanks, @gravitacia , for your PR, i'm now reviewing it.

Comment thread tools/bump-version.sh
sed -i '' -e "s/\"version\": \"$1\"/\"version\": \"$2\"/g" package.json
sed -i '' -e "s/\"version\": \"$1\"/\"version\": \"$2\"/g" package-lock.json
sed -i '' -e "s/\"version\": \"$1\"/\"version\": \"$2\"/g" config.yaml
if [[ "$OSTYPE" == "darwin"* ]]; then
Copy link
Copy Markdown
Contributor

@zinduolis zinduolis Jun 2, 2026

Choose a reason for hiding this comment

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

@gravitacia , what are your thoughts on making this more robust across all Unix-like operating systems and shell environment as per below?

if sed --version 2>&1 | grep -q 'GNU'; then
  # GNU sed
  sed -i -e "s/$1/$2/g" VERSION
  sed -i -e "s/\"version\": \"$1\"/\"version\": \"$2\"/g" package.json
  sed -i -e "s/\"version\": \"$1\"/\"version\": \"$2\"/g" package-lock.json
  sed -i -e "s/\"version\": \"$1\"/\"version\": \"$2\"/g" config.yaml
else
  # BSD sed (macOS, FreeBSD, OpenBSD, etc.)
  sed -i '' -e "s/$1/$2/g" VERSION
  sed -i '' -e "s/\"version\": \"$1\"/\"version\": \"$2\"/g" package.json
  sed -i '' -e "s/\"version\": \"$1\"/\"version\": \"$2\"/g" package-lock.json
  sed -i '' -e "s/\"version\": \"$1\"/\"version\": \"$2\"/g" config.yaml
fi

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sure, I think it will be better that way

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please update your PR, test it and let me know when I can review it again.

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.

2 participants