forgejo-release.sh checks in BIN_DIR / TMP_DIR for tea instead of PATH #51

Open
opened 2025-05-05 12:14:33 +00:00 by endz · 1 comment

When using a non-debian based distribution or OS like FreeBSD there is no dpkg or apt-get and tea is installed in PATH.

However the release shellscript explicitly checks in BIN_DIR for tea:

if ! test -f "$BIN_DIR"/tea; then

This prevents the usage of this action on runners on non-debian based distributions.

When using a non-debian based distribution or OS like FreeBSD there is no dpkg or apt-get and tea is installed in PATH. However the release shellscript explicitly checks in BIN_DIR for tea: https://code.forgejo.org/actions/forgejo-release/src/commit/23391e15acb8488c37c8b9d14049d28e3f7359ba/forgejo-release.sh#L27 This prevents the usage of this action on runners on non-debian based distributions.
Contributor

It could check if the command is already installed just like in the function setup_api which checks for curl and jq.

Something like this could work :

if [ ! which tea ] || [ ! test -f "$BIN_DIR"/tea ]; then

But the BIN_DIR variable would remain an issue in other places in the script and you can't override it from the action.

My main issue comes from the fact that Alpine Linux doesn't just print amd64 but musl-linux-amd64 when running dpkg --print-architecture so I wanted to avoid going inside this condition. Maybe there's a more overall solution to this issue that would help with different distros & OS.

Maybe an approach that could work :

  1. If tea is installed, set the variable $BIN_TEA to which tea
  2. If tea is not installed, do the steps already there to download and set the variable $BIN_TEA to $TMP_DIR/tea
  3. Replace all calls to $BIN/tea by $BIN_TEA
It could check if the command is already installed just like in the function `setup_api` which checks for `curl` and `jq`. Something like this could work : ```bash if [ ! which tea ] || [ ! test -f "$BIN_DIR"/tea ]; then ``` But the `BIN_DIR` variable would remain an issue in other places in the script and you can't override it from the action. My main issue comes from the fact that Alpine Linux doesn't just print `amd64` but `musl-linux-amd64` when running `dpkg --print-architecture` so I wanted to avoid going inside this condition. Maybe there's a more overall solution to this issue that would help with different distros & OS. Maybe an approach that could work : 1. If tea is installed, set the variable `$BIN_TEA` to `which tea` 2. If tea is not installed, do the steps already there to download and set the variable `$BIN_TEA` to `$TMP_DIR/tea` 3. Replace all calls to `$BIN/tea` by `$BIN_TEA`
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
actions/forgejo-release#51
No description provided.