Compare commits

...

3 Commits

Author SHA1 Message Date
AJ ONeal
5dacdc7b9a wip: ffprobe 2024-07-15 19:34:29 -06:00
AJ ONeal
5c7a218d88 feat(git): option to install from package manager 2024-07-15 19:34:29 -06:00
AJ ONeal
01ae7f5603 feat(fish): option to install from package manager 2024-07-15 19:34:29 -06:00
3 changed files with 145 additions and 11 deletions

45
ffprobe/releases.js Normal file
View File

@@ -0,0 +1,45 @@
'use strict';
var path = require('path');
var github = require('../_common/github.js');
var owner = 'eugeneware';
var repo = 'ffmpeg-static';
module.exports = function (request) {
return github(request, owner, repo).then(function (all) {
all.releases = all.releases
.filter(function (rel) {
let isFfmpeg = rel.name.includes('ffmpeg');
if (!isFfmpeg) {
return;
}
// remove README and LICENSE
return !['.README', '.LICENSE'].includes(path.extname(rel.name));
})
.map(function (rel) {
rel.version = rel.version.replace(/^b/, '');
if (/win32/.test(rel.name)) {
rel.os = 'windows';
rel.ext = 'exe';
}
if (/ia32/.test(rel.name)) {
rel.arch = '386';
} else if (/x64/.test(rel.name)) {
rel.arch = 'amd64';
}
return rel;
});
return all;
});
};
if (module === require.main) {
module.exports(require('@root/request')).then(function (all) {
all = require('../_webi/normalize.js')(all);
console.info(JSON.stringify(all));
});
}

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