feat(fish): add Linux x86_64 and aarch64 binary support

Removes the Linux guard (was: exit 1 with apt suggestion).
Adds pkg_install branch for Linux: extracts bare fish binary from
fish-VERSION-linux-ARCH.tar.xz into ~/.local/opt/fish-vVERSION/bin/.
Adds _linux_post_install() with chsh instructions.
macOS: installs fish*.app to /Applications/fish.app (covers v3 fish.app
and v4 fish-VERSION.app); pkg_link symlinks Contents/MacOS/fish.
OS detection via uname -s at top level; functions have no OS guards.
pkg_link avoids calling webi_link (would recurse since webi_link calls
pkg_link when defined).
Replaces [ with test throughout per POSIX shell conventions.

Co-authored-by: AJ ONeal <aj@therootcompany.com>
This commit is contained in:
detox-24
2026-05-17 18:47:23 -06:00
committed by AJ ONeal
parent e6ad76382d
commit d0a9fdda05
2 changed files with 100 additions and 57 deletions

View File

@@ -71,6 +71,14 @@ Builds.getPackage({ name: projName }).then(async function (/*projInfo*/) {
var nodeOs = os.platform();
var nodeOsRelease = os.release();
var nodeArch = os.arch();
// To make arch names compatible across all helpers
if (nodeArch === 'x64') {
nodeArch = 'amd64';
} else if (nodeArch === 'arm64') {
nodeArch = 'arm64';
}
var nodeLibc = 'libc';
if (process.platform === 'linux') {
nodeLibc = 'gnu';

View File

@@ -3,23 +3,19 @@ set -e
set -u
if command -v fish > /dev/null; then
if [ ! -e ~/.config/fish/config.fish ]; then
mkdir -p ~/.config/fish
touch ~/.config/fish/config.fish
chmod 0600 ~/.config/fish/config.fish
fi
fi
if [ "Darwin" != "$(uname -s)" ]; then
echo "No fish installer for Linux yet. Try this instead:"
echo " sudo apt install -y fish"
exit 1
if ! test -e ~/.config/fish/config.fish; then
mkdir -p ~/.config/fish
touch ~/.config/fish/config.fish
chmod 0600 ~/.config/fish/config.fish
fi
fi
################
# Install fish #
################
my_os=$(uname -s)
# Every package should define these 6 variables
# shellcheck disable=2034
pkg_cmd_name="fish"
@@ -34,70 +30,109 @@ pkg_src_dir="$HOME/.local/opt/fish-v$WEBI_VERSION"
# shellcheck disable=2034
pkg_src="$pkg_src_cmd"
# pkg_install must be defined by every package
if test "Darwin" = "${my_os}"; then
pkg_src_cmd="/Applications/fish.app/Contents/Resources/base/usr/local/bin/fish"
# shellcheck disable=2034
pkg_src="${pkg_src_cmd}"
fi
_linux_post_install() {
if ! test -e "$HOME/.local/bin/fish"; then
return 0
fi
echo ""
echo "To set fish as your default shell, run:"
echo " chsh -s $HOME/.local/bin/fish"
echo ""
}
_macos_post_install() {
if ! [ -e "$HOME/.local/bin/fish" ]; then
return 0
fi
if ! test -e "$HOME/.local/bin/fish"; then
return 0
fi
echo ""
echo "Trying to set fish as the default shell..."
echo ""
# stop the caching of preferences
killall cfprefsd
echo ""
echo "Trying to set fish as the default shell..."
echo ""
# stop the caching of preferences
killall cfprefsd
# Set default Terminal.app shell to fish
defaults write com.apple.Terminal "Shell" -string "$HOME/.local/bin/fish"
echo "To set 'fish' as the default Terminal.app shell:"
echo " Terminal > Preferences > General > Shells open with:"
echo " $HOME/.local/bin/fish"
echo ""
# Set default Terminal.app shell to fish
defaults write com.apple.Terminal "Shell" -string "$HOME/.local/bin/fish"
echo "To set 'fish' as the default Terminal.app shell:"
echo " Terminal > Preferences > General > Shells open with:"
echo " $HOME/.local/bin/fish"
echo ""
# Set default iTerm2 shell to fish
if [ -e "$HOME/Library/Preferences/com.googlecode.iterm2.plist" ]; then
/usr/libexec/PlistBuddy \
-c "SET ':New Bookmarks:0:Custom Command' 'Custom Shell'" \
"$HOME/Library/Preferences/com.googlecode.iterm2.plist"
/usr/libexec/PlistBuddy \
-c "SET ':New Bookmarks:0:Command' $HOME/.local/bin/fish" \
"$HOME/Library/Preferences/com.googlecode.iterm2.plist"
echo "To set 'fish' as the default iTerm2 shell:"
echo " iTerm2 > Preferences > Profiles > General > Command >"
echo " Custom Shell: $HOME/.local/bin/fish"
echo ""
fi
# Set default iTerm2 shell to fish
if test -e "$HOME/Library/Preferences/com.googlecode.iterm2.plist"; then
/usr/libexec/PlistBuddy \
-c "SET ':New Bookmarks:0:Custom Command' 'Custom Shell'" \
"$HOME/Library/Preferences/com.googlecode.iterm2.plist"
/usr/libexec/PlistBuddy \
-c "SET ':New Bookmarks:0:Command' $HOME/.local/bin/fish" \
"$HOME/Library/Preferences/com.googlecode.iterm2.plist"
echo "To set 'fish' as the default iTerm2 shell:"
echo " iTerm2 > Preferences > Profiles > General > Command >"
echo " Custom Shell: $HOME/.local/bin/fish"
echo ""
fi
killall cfprefsd
killall cfprefsd
}
# always try to reset the default shells
_macos_post_install
if test "Darwin" = "${my_os}"; then
_macos_post_install
fi
pkg_install() {
mv fish.app/Contents/Resources/base/usr/local "$HOME/.local/opt/fish-v${WEBI_VERSION}"
if test "Darwin" = "${my_os}"; then
rm -rf "/Applications/fish-v${WEBI_VERSION}.app"
mv -f fish*.app "/Applications/fish-v${WEBI_VERSION}.app"
rm -rf /Applications/fish.app
mv "/Applications/fish-v${WEBI_VERSION}.app" "/Applications/fish.app"
return 0
fi
mkdir -p "$pkg_src_dir/bin"
mv fish "$pkg_src_dir/bin/"
}
pkg_link() {
if test "Darwin" = "${my_os}"; then
mkdir -p "$HOME/.local/bin"
ln -sf /Applications/fish.app/Contents/Resources/base/usr/local/bin/fish "$HOME/.local/bin/fish"
return 0
fi
rm -rf "$pkg_dst_cmd"
ln -s "$pkg_src_cmd" "$pkg_dst_cmd"
}
pkg_post_install() {
# don't skip what webi would do automatically
webi_post_install
# don't skip what webi would do automatically
webi_post_install
# try again to update default shells, now that all files should exist
_macos_post_install
if [ ! -e ~/.config/fish/config.fish ]; then
mkdir -p ~/.config/fish
touch ~/.config/fish/config.fish
chmod 0600 ~/.config/fish/config.fish
fi
# try again to update default shells, now that all files should exist
if test "Darwin" = "${my_os}"; then
_macos_post_install
else
_linux_post_install
fi
if ! test -e ~/.config/fish/config.fish; then
mkdir -p ~/.config/fish
touch ~/.config/fish/config.fish
chmod 0600 ~/.config/fish/config.fish
fi
}
# pkg_get_current_version is recommended, but (soon) not required
pkg_get_current_version() {
# 'fish --version' has output in this format:
# fish, version 3.1.2
# This trims it down to just the version number:
# 3.1.2
fish --version 2> /dev/null | head -n 1 | cut -d ' ' -f 3
# 'fish --version' has output in this format:
# fish, version 4.3.3
# This trims it down to just the version number:
# 4.3.3
fish --version 2> /dev/null | head -n 1 | cut -d ' ' -f 3
}