Compare commits

...

8 Commits

7 changed files with 118 additions and 41 deletions

View File

@@ -3,17 +3,51 @@ set -e
set -u
if command -v fish > /dev/null; then
if [ ! -e ~/.config/fish/config.fish ]; then
if ! test -r ~/.config/fish/config.fish; then
mkdir -p ~/.config/fish
touch ~/.config/fish/config.fish
chmod 0600 ~/.config/fish/config.fish
fi
fi
else
if command -v sudo > /dev/null; then
my_answer='n'
if command -v apt > /dev/null; then
echo ""
echo "ERROR"
echo " No Webi installer for fish on Linux yet."
echo ""
echo "SOLUTION"
echo " Would you like to install with apt?"
echo " sudo apt install -y fish"
echo ""
printf "Install with sudo and apt [Y/n]? "
elif command -v apk > /dev/null; then
echo ""
echo "ERROR"
echo " No Webi installer for fish on Alpine yet."
echo ""
echo "SOLUTION"
echo " Would you like to install with apk?"
echo " sudo apk add --no-cache fish"
echo ""
printf "Install with sudo and apk [Y/n]? "
elif test "Darwin" != "$(uname -s)"; then
echo "No fish installer for Linux yet."
exit 1
fi
if [ "Darwin" != "$(uname -s)" ]; then
echo "No fish installer for Linux yet. Try this instead:"
echo " sudo apt install -y fish"
exit 1
read -r my_answer < /dev/tty
if test -z "${my_answer}" ||
test "${my_answer}" = "Y" ||
test "${my_answer}" = "y"; then
sudo apt install -y fish
else
exit 1
fi
elif test "Darwin" != "$(uname -s)"; then
echo "No fish installer for Linux yet."
exit 1
fi
fi
################
@@ -37,6 +71,10 @@ pkg_src="$pkg_src_cmd"
# pkg_install must be defined by every package
_macos_post_install() {
if test "Darwin" != "$(uname -s)"; then
return 0
fi
if ! [ -e "$HOME/.local/bin/fish" ]; then
return 0
fi
@@ -71,8 +109,10 @@ _macos_post_install() {
killall cfprefsd
}
# always try to reset the default shells
_macos_post_install
if test "Darwin" = "$(uname -s)"; then
# always try to reset the default shells
_macos_post_install
fi
pkg_install() {
mv fish.app/Contents/Resources/base/usr/local "$HOME/.local/opt/fish-v${WEBI_VERSION}"
@@ -84,7 +124,10 @@ pkg_post_install() {
webi_post_install
# try again to update default shells, now that all files should exist
_macos_post_install
if test "Darwin" = "$(uname -s)"; then
# always try to reset the default shells
_macos_post_install
fi
if [ ! -e ~/.config/fish/config.fish ]; then
mkdir -p ~/.config/fish

View File

@@ -14,11 +14,57 @@ __init_git() {
echo >&2 " for example, try: xcode-select --install"
# sudo xcodebuild -license accept
else
echo >&2 "Error: to install 'git' on Linux use the built-in package manager."
echo >&2 " for example, try: sudo apt install -y git"
fn_prompt_sudo_install git
fi
exit 1
}
fn_prompt_sudo_install() {
a_pkg="${1}"
if command -v sudo > /dev/null; then
my_answer='n'
cmd_pkg_add=''
if command -v apt > /dev/null; then
echo ""
echo "ERROR"
echo " No Webi installer for ${a_pkg} on Linux yet."
echo ""
echo "SOLUTION"
echo " Would you like to install with apt?"
echo " sudo apt install -y ${a_pkg}"
echo ""
printf "Install with sudo and apt [Y/n]? "
cmd_pkg_add='sudo apt install -y'
elif command -v apk > /dev/null; then
echo ""
echo "ERROR"
echo " No Webi installer for ${a_pkg} on Alpine yet."
echo ""
echo "SOLUTION"
echo " Would you like to install with apk?"
echo " sudo apk add --no-cache ${a_pkg}"
echo ""
printf "Install with sudo and apk [Y/n]? "
cmd_pkg_add='sudo apk add --no-cache'
elif test "Darwin" != "$(uname -s)"; then
echo "No ${a_pkg} installer for Linux yet."
exit 1
fi
read -r my_answer < /dev/tty
if test -z "${my_answer}" ||
test "${my_answer}" = "Y" ||
test "${my_answer}" = "y"; then
$cmd_pkg_add "${a_pkg}"
else
exit 1
fi
elif test "Darwin" != "$(uname -s)"; then
echo "No ${a_pkg} installer for Linux yet."
exit 1
fi
}
__init_git

View File

@@ -6,6 +6,7 @@ var repo = 'goreleaser';
module.exports = function (request) {
return github(request, owner, repo).then(function (all) {
all._names = ['goreleaser', '1'];
return all;
});
};

View File

@@ -7,19 +7,25 @@ var repo = 'ollama';
module.exports = async function (request) {
let all = await github(request, owner, repo);
// TODO why are the 0.0.x releases sorting so high?
let releases = [];
for (let rel of all.releases) {
let isLow = rel.version.startsWith('v0.0.');
if (isLow) {
// this is a janky, sudo-wantin' .app
let isJank = rel.name.startsWith('Ollama-darwin');
if (isJank) {
continue;
}
let isUniversal = rel.name === 'ollama-darwin';
if (isUniversal) {
let x64 = Object.assign({ arch: 'x86_64' }, rel);
releases.push(x64);
rel.arch = 'aarch64';
}
releases.push(rel);
}
all.releases = releases;
all._names = ['Ollama', 'ollama'];
return all;
};

View File

@@ -6,27 +6,6 @@ var repo = 'shellcheck';
module.exports = function (request) {
return github(request, owner, repo).then(function (all) {
all.releases = all.releases.filter(function (rel) {
// don't include meta versions as actual versions
if (
['latest', 'stable'].includes(rel.version) ||
'v' !== rel.version[0]
) {
return false;
}
return true;
});
all.releases.forEach(function (rel) {
// if there is no os or arch or source designation, and it's a .zip, it's Windows amd64
if (
!/(darwin|mac|linux|x86_64|arm|src|source)/i.test(rel.name) &&
/\.zip$/.test(rel.name)
) {
rel.os = 'windows';
rel.arch = 'amd64';
}
});
return all;
});
};

View File

@@ -6,6 +6,13 @@ var repo = 'watchexec';
module.exports = function (request) {
return github(request, owner, repo).then(function (all) {
let builds = [];
for (let build of all.releases) {
build.version = build.version.replace(/^cli-/, '');
builds.push(build);
}
all.releases = builds;
return all;
});
};

View File

@@ -6,11 +6,6 @@ var repo = 'zoxide';
module.exports = function (request) {
return github(request, owner, repo).then(function (all) {
all.releases.forEach(function (rel) {
if (/-arm-/.test(rel.download)) {
rel.arch = 'armv6l';
}
});
return all;
});
};