Compare commits
25 Commits
4b63f6b2fc
...
50331f0cde
| Author | SHA1 | Date | |
|---|---|---|---|
| 50331f0cde | |||
| 967be5b4e2 | |||
| 148dfbb083 | |||
| 7e572ed6df | |||
| b6e3074eff | |||
| 2216178db1 | |||
| 622917478a | |||
| d8cae07b4e | |||
| 655a08f70d | |||
| 9eed36d353 | |||
| 36bebb1d45 | |||
| 1fd5217533 | |||
| a7b9bca653 | |||
| 1a050e7e28 | |||
| ab45d26c12 | |||
| d3b3c020c3 | |||
| fd3f28367e | |||
| 23514ea85a | |||
| 389cd69da3 | |||
| 9a16ff6241 | |||
| b4cfa16081 | |||
| 6f8c093e2e | |||
| 1b35688806 | |||
| 66d4ba6fc0 | |||
| 7c59629a55 |
@@ -29,7 +29,7 @@ $ installJRMC --help
|
|||||||
--compat
|
--compat
|
||||||
Build/install MC without minimum dependency version requirements
|
Build/install MC without minimum dependency version requirements
|
||||||
--mcversion VERSION
|
--mcversion VERSION
|
||||||
Build or install a specific MC version, ex. "33.0.71" or "33" (default: latest)
|
Build or install a specific MC version, ex. "33.0.72" or "33" (default: latest)
|
||||||
--mcrepo REPO
|
--mcrepo REPO
|
||||||
Specify the MC repository, ex. "bullseye", "bookworm", "noble", etc (default: latest official)
|
Specify the MC repository, ex. "bullseye", "bookworm", "noble", etc (default: latest official)
|
||||||
--arch ARCH
|
--arch ARCH
|
||||||
@@ -122,9 +122,9 @@ Multiple services (but not `--service-types`) can be installed at one time using
|
|||||||
|
|
||||||
Install MC from the repository and start/enable `jriver-mediacenter.service` as a user service.
|
Install MC from the repository and start/enable `jriver-mediacenter.service` as a user service.
|
||||||
|
|
||||||
* `installJRMC --install local --compat --restorefile /path/to/license.mjr --mcversion 33.0.71`
|
* `installJRMC --install local --compat --restorefile /path/to/license.mjr --mcversion 33.0.72`
|
||||||
|
|
||||||
Build and install an MC 33.0.71 compatibility RPM locally and activate it using the `/path/to/license.mjr`
|
Build and install an MC 33.0.72 compatibility RPM locally and activate it using the `/path/to/license.mjr`
|
||||||
|
|
||||||
* `installJRMC --createrepo --createrepo-webroot /srv/jriver/repo --createrepo-user www-user`
|
* `installJRMC --createrepo --createrepo-webroot /srv/jriver/repo --createrepo-user www-user`
|
||||||
|
|
||||||
|
|||||||
108
installJRMC
108
installJRMC
@@ -18,14 +18,16 @@
|
|||||||
# * Be careful with tabs in heredocs
|
# * Be careful with tabs in heredocs
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
|
|
||||||
declare -g SCRIPT_VERSION="1.4.8"
|
declare -g SCRIPT_VERSION="1.5.0"
|
||||||
declare -g MC_REPO="bullseye" # should match the MC_VERSION
|
declare -g MC_REPO="bullseye" # should match the MC_VERSION
|
||||||
declare -g MC_VERSION="33.0.71" # Do find all replace
|
# declare -g MC_REPO="bookworm" # should match the MC_VERSION
|
||||||
|
declare -g MC_VERSION="33.0.72" # do find all replace
|
||||||
declare -g BOARD_URL="https://yabb.jriver.com/interact/index.php/board,86.0.html" # MC33
|
declare -g BOARD_URL="https://yabb.jriver.com/interact/index.php/board,86.0.html" # MC33
|
||||||
|
# declare -g BOARD_URL="https://yabb.jriver.com/interact/index.php/board,89.0.html" # MC34
|
||||||
declare -gi UPDATE_SWITCH=1 # set to 0 to disable automatic self-update
|
declare -gi UPDATE_SWITCH=1 # set to 0 to disable automatic self-update
|
||||||
declare -g SCRIPT_URL="https://git.bryanroessler.com/bryan/installJRMC/raw/master/installJRMC"
|
declare -g SCRIPT_URL="https://git.bryanroessler.com/bryan/installJRMC/raw/master/installJRMC"
|
||||||
# declare -g SCRIPT_URL="https://raw.githubusercontent.com/cryobry/installJRMC/refs/heads/master/installJRMC"
|
# declare -g SCRIPT_URL="https://raw.githubusercontent.com/cryobry/installJRMC/refs/heads/master/installJRMC"
|
||||||
declare -gi DEBUG=${DEBUG:-0} # det default debug and allow DEBUG env override (default: disabled)
|
declare -gi DEBUG=${DEBUG:-0} # set default debug and allow DEBUG env override (default: disabled)
|
||||||
|
|
||||||
# @description Print help text
|
# @description Print help text
|
||||||
print_help() {
|
print_help() {
|
||||||
@@ -118,7 +120,7 @@ parse_input() {
|
|||||||
declare -gi BUILD_SWITCH REPO_INSTALL_SWITCH LOCAL_INSTALL_SWITCH \
|
declare -gi BUILD_SWITCH REPO_INSTALL_SWITCH LOCAL_INSTALL_SWITCH \
|
||||||
CONTAINER_INSTALL_SWITCH CREATEREPO_SWITCH \
|
CONTAINER_INSTALL_SWITCH CREATEREPO_SWITCH \
|
||||||
COMPAT_SWITCH UNINSTALL_SWITCH YES_SWITCH DEBUG=0
|
COMPAT_SWITCH UNINSTALL_SWITCH YES_SWITCH DEBUG=0
|
||||||
declare -g USER_MC_VERSION USER_MC_REPO MJR_FILE \
|
declare -g USER_MC_VERSION USER_MC_RELEASE USER_MC_REPO MJR_FILE \
|
||||||
BETAPASS SERVICE_TYPE VNCPASS USER_DISPLAY BUILD_TARGET CREATEREPO_TARGET
|
BETAPASS SERVICE_TYPE VNCPASS USER_DISPLAY BUILD_TARGET CREATEREPO_TARGET
|
||||||
local long_opts short_opts input
|
local long_opts short_opts input
|
||||||
long_opts="install:,build::,outputdir:,mcversion:,arch:,mcrepo:,compat,"
|
long_opts="install:,build::,outputdir:,mcversion:,arch:,mcrepo:,compat,"
|
||||||
@@ -146,9 +148,12 @@ parse_input() {
|
|||||||
--outputdir) shift; OUTPUT_DIR="$1" ;;
|
--outputdir) shift; OUTPUT_DIR="$1" ;;
|
||||||
--mcversion)
|
--mcversion)
|
||||||
shift
|
shift
|
||||||
if [[ $1 =~ ([0-9]+.[0-9]+.[0-9]+) ]]; then
|
if [[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+-[0-9]+$ ]]; then
|
||||||
|
USER_MC_VERSION="${1%-*}"
|
||||||
|
USER_MC_RELEASE="${1#*-}"
|
||||||
|
elif [[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||||
USER_MC_VERSION="$1"
|
USER_MC_VERSION="$1"
|
||||||
elif [[ $1 =~ ([0-9][0-9]) ]]; then
|
elif [[ $1 =~ ^[0-9][0-9]$ ]]; then
|
||||||
case $1 in
|
case $1 in
|
||||||
33) ;; # use update check to determine latest version
|
33) ;; # use update check to determine latest version
|
||||||
32) USER_MC_VERSION="32.0.58" ;;
|
32) USER_MC_VERSION="32.0.58" ;;
|
||||||
@@ -232,7 +237,7 @@ init() {
|
|||||||
declare -g CREATEREPO_WEBROOT="/var/www/jriver"
|
declare -g CREATEREPO_WEBROOT="/var/www/jriver"
|
||||||
declare -g CREATEREPO_USER="$USER" # can be root
|
declare -g CREATEREPO_USER="$USER" # can be root
|
||||||
declare -g ID VERSION_ID ARCH NAME
|
declare -g ID VERSION_ID ARCH NAME
|
||||||
declare -g MC_MVERSION MC_PKG MC_RPM MC_ROOT
|
declare -g MC_MVERSION MC_RELEASE MC_PKG MC_RPM MC_ROOT
|
||||||
declare -ga PKG_INSTALL PKG_REMOVE PKG_UPDATE PKG_QUERY
|
declare -ga PKG_INSTALL PKG_REMOVE PKG_UPDATE PKG_QUERY
|
||||||
declare -ga SERVICES CONTAINERS
|
declare -ga SERVICES CONTAINERS
|
||||||
|
|
||||||
@@ -355,7 +360,7 @@ init() {
|
|||||||
PKG_INSTALL_LOCAL() { install_mc_deb "$@"; }
|
PKG_INSTALL_LOCAL() { install_mc_deb "$@"; }
|
||||||
;;
|
;;
|
||||||
suse)
|
suse)
|
||||||
PKG_INSTALL=(sudo zypper --gpg-auto-import-keys --non-interactive --quiet install --force --no-confirm)
|
PKG_INSTALL=(sudo zypper --gpg-auto-import-keys --non-interactive --quiet install --force --force-resolution --replacefiles --no-confirm)
|
||||||
PKG_REMOVE=(sudo zypper --non-interactive --quiet remove --clean-deps)
|
PKG_REMOVE=(sudo zypper --non-interactive --quiet remove --clean-deps)
|
||||||
PKG_UPDATE=(sudo zypper --non-interactive --quiet refresh jriver)
|
PKG_UPDATE=(sudo zypper --non-interactive --quiet refresh jriver)
|
||||||
PKG_QUERY=(rpm -q)
|
PKG_QUERY=(rpm -q)
|
||||||
@@ -387,9 +392,10 @@ init() {
|
|||||||
# Set MC version variables
|
# Set MC version variables
|
||||||
MC_REPO="${USER_MC_REPO:-$MC_REPO}"
|
MC_REPO="${USER_MC_REPO:-$MC_REPO}"
|
||||||
MC_VERSION="${USER_MC_VERSION:-$MC_VERSION}"
|
MC_VERSION="${USER_MC_VERSION:-$MC_VERSION}"
|
||||||
|
MC_RELEASE="${USER_MC_RELEASE:-1}"
|
||||||
MC_MVERSION="${MC_VERSION%%.*}"
|
MC_MVERSION="${MC_VERSION%%.*}"
|
||||||
MC_PKG="mediacenter$MC_MVERSION"
|
MC_PKG="mediacenter$MC_MVERSION"
|
||||||
MC_RPM="$OUTPUT_DIR/RPMS/x86_64/mediacenter$MC_MVERSION-$MC_VERSION.x86_64.rpm"
|
MC_RPM="$OUTPUT_DIR/RPMS/x86_64/mediacenter$MC_MVERSION-$MC_VERSION-$MC_RELEASE.x86_64.rpm"
|
||||||
MC_ROOT="/usr/lib/jriver/Media Center $MC_MVERSION"
|
MC_ROOT="/usr/lib/jriver/Media Center $MC_MVERSION"
|
||||||
|
|
||||||
if [[ -n $USER_MC_VERSION ]]; then
|
if [[ -n $USER_MC_VERSION ]]; then
|
||||||
@@ -420,12 +426,12 @@ get_latest_mc_version() {
|
|||||||
&& buildah run "$cnt" -- sh -c \
|
&& buildah run "$cnt" -- sh -c \
|
||||||
"apt update --allow-insecure-repositories &>/dev/null" &>/dev/null \
|
"apt update --allow-insecure-repositories &>/dev/null" &>/dev/null \
|
||||||
&& MC_VERSION=$(buildah run "$cnt" -- apt-cache policy mediacenter?? | grep Candidate | awk '{print $2}' | sort -V | tail -n1) &>/dev/null \
|
&& MC_VERSION=$(buildah run "$cnt" -- apt-cache policy mediacenter?? | grep Candidate | awk '{print $2}' | sort -V | tail -n1) &>/dev/null \
|
||||||
&& [[ $MC_VERSION =~ ([0-9]+.[0-9]+.[0-9]+) ]]; then
|
&& [[ $MC_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
|
||||||
mc_version_source="containerized package manager"
|
mc_version_source="containerized package manager"
|
||||||
execute buildah rm "$cnt"
|
execute buildah rm "$cnt"
|
||||||
# Fallback to webscrape
|
# Fallback to webscrape
|
||||||
elif MC_VERSION=$(download "$BOARD_URL" | grep -o "[0-9][0-9]\.[0-9]\.[0-9]\+" | head -n 1) \
|
elif MC_VERSION=$(download "$BOARD_URL" | grep -o "[0-9][0-9]\.[0-9]\.[0-9]\+" | head -n 1) \
|
||||||
&& [[ $MC_VERSION =~ ([0-9]+.[0-9]+.[0-9]+) ]]; then
|
&& [[ $MC_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
|
||||||
mc_version_source="webscrape"
|
mc_version_source="webscrape"
|
||||||
# Fallback to hardcoded value
|
# Fallback to hardcoded value
|
||||||
else
|
else
|
||||||
@@ -545,15 +551,19 @@ install_external_repos() {
|
|||||||
centos)
|
centos)
|
||||||
if ! command -v dpkg &>/dev/null; then
|
if ! command -v dpkg &>/dev/null; then
|
||||||
echo "Adding EPEL repository"
|
echo "Adding EPEL repository"
|
||||||
install_package epel-release
|
if ! install_package epel-release; then
|
||||||
|
# If epel-release is not available, install it manually
|
||||||
|
install_package --no-install-check \
|
||||||
|
"https://dl.fedoraproject.org/pub/epel/epel-release-latest-${VERSION_ID%%.*}.noarch.rpm"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if ! "${PKG_QUERY[@]}" rpmfusion-free-release &>/dev/null; then
|
if ! "${PKG_QUERY[@]}" rpmfusion-free-release &>/dev/null; then
|
||||||
echo "Installing the RPMFusion repository"
|
echo "Installing the RPMFusion repository"
|
||||||
install_package --no-install-check \
|
install_package --no-install-check \
|
||||||
"https://download1.rpmfusion.org/free/el/rpmfusion-free-release-$VERSION_ID.noarch.rpm"
|
"https://download1.rpmfusion.org/free/el/rpmfusion-free-release-${VERSION_ID%%.*}.noarch.rpm"
|
||||||
fi
|
fi
|
||||||
# Install mesa-va-drivers-freeworld separately from the RPM using dnf swap
|
# Install mesa-va-drivers-freeworld separately from the RPM using dnf swap
|
||||||
install_mesa_freeworld
|
# install_mesa_freeworld # no longer provided by RPMFusion for EL9, etc.
|
||||||
;;
|
;;
|
||||||
fedora)
|
fedora)
|
||||||
if ! "${PKG_QUERY[@]}" rpmfusion-free-release &>/dev/null; then
|
if ! "${PKG_QUERY[@]}" rpmfusion-free-release &>/dev/null; then
|
||||||
@@ -684,7 +694,17 @@ install_mc_repo() {
|
|||||||
# @description Acquires the source DEB package from JRiver
|
# @description Acquires the source DEB package from JRiver
|
||||||
acquire_deb() {
|
acquire_deb() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
debug "Running: ${FUNCNAME[0]}"
|
||||||
local fname="MediaCenter-$MC_VERSION-$ARCH.deb"
|
declare -g MC_SOURCE
|
||||||
|
local fname
|
||||||
|
|
||||||
|
# Usually JRiver exlcudes the release number from the filename
|
||||||
|
# but in some cases (test builds) it may be included
|
||||||
|
if [[ $MC_RELEASE -gt 1 ]]; then
|
||||||
|
fname="MediaCenter-$MC_VERSION-$MC_RELEASE-$ARCH.deb"
|
||||||
|
else
|
||||||
|
fname="MediaCenter-$MC_VERSION-$ARCH.deb"
|
||||||
|
fi
|
||||||
|
|
||||||
declare -g MC_DEB="$OUTPUT_DIR/SOURCES/$fname"
|
declare -g MC_DEB="$OUTPUT_DIR/SOURCES/$fname"
|
||||||
|
|
||||||
# If deb file already exists, skip download
|
# If deb file already exists, skip download
|
||||||
@@ -708,17 +728,19 @@ acquire_deb() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Loop through the repositories and attempt to download
|
# Loop through the repositories and attempt to download
|
||||||
|
local found=0
|
||||||
for repo in "${repos[@]}"; do
|
for repo in "${repos[@]}"; do
|
||||||
echo "Checking $repo for DEB package"
|
echo "Checking $repo for DEB package"
|
||||||
if download "$repo" "$MC_DEB"; then
|
if download "$repo" "$MC_DEB"; then
|
||||||
echo "Found"
|
echo "Found"
|
||||||
|
found=1
|
||||||
|
MC_SOURCE="$repo"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
err "DEB file not found/downloaded"
|
|
||||||
return 1
|
|
||||||
done
|
done
|
||||||
|
|
||||||
[[ -f $MC_DEB ]]
|
# Return if the download was successful
|
||||||
|
((found)) && [[ -f $MC_DEB ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
# @description Creates a SPEC file and builds the RPM from the source DEB using rpmbuild
|
# @description Creates a SPEC file and builds the RPM from the source DEB using rpmbuild
|
||||||
@@ -784,10 +806,12 @@ build_rpm() {
|
|||||||
requires=("${requires[@]/libvulkan1/vulkan-loader}")
|
requires=("${requires[@]/libvulkan1/vulkan-loader}")
|
||||||
requires=("${requires[@]/libepoxy0/libepoxy}")
|
requires=("${requires[@]/libepoxy0/libepoxy}")
|
||||||
requires=("${requires[@]/python/python3}")
|
requires=("${requires[@]/python/python3}")
|
||||||
requires=("${requires[@]/libwebkit2gtk*/webkit2gtk4.0}")
|
requires=("${requires[@]/libwebkit2gtk-4.0*/webkit2gtk4.0}")
|
||||||
|
requires=("${requires[@]/libwebkit2gtk-4.1*/webkit2gtk4.1}")
|
||||||
recommends+=(mesa-va-drivers-freeworld)
|
recommends+=(mesa-va-drivers-freeworld)
|
||||||
;;
|
;;
|
||||||
suse)
|
suse)
|
||||||
|
requires=("${requires[@]/python*/python313}")
|
||||||
requires=("${requires[@]/libc6/glibc}")
|
requires=("${requires[@]/libc6/glibc}")
|
||||||
requires=("${requires[@]/libasound2/alsa-lib}")
|
requires=("${requires[@]/libasound2/alsa-lib}")
|
||||||
requires=("${requires[@]/libx11-6/libX11-6}")
|
requires=("${requires[@]/libx11-6/libX11-6}")
|
||||||
@@ -804,7 +828,8 @@ build_rpm() {
|
|||||||
requires=("${requires[@]/libfribidi0/fribidi}")
|
requires=("${requires[@]/libfribidi0/fribidi}")
|
||||||
requires=("${requires[@]/libfontconfig1/fontconfig}")
|
requires=("${requires[@]/libfontconfig1/fontconfig}")
|
||||||
requires=("${requires[@]/libharfbuzz0b/libharfbuzz0}")
|
requires=("${requires[@]/libharfbuzz0b/libharfbuzz0}")
|
||||||
requires=("${requires[@]/libwebkit2gtk*/libwebkit2gtk-4_0-37}")
|
requires=("${requires[@]/libwebkit2gtk-4.0*/libwebkit2gtk-4_0-37}")
|
||||||
|
requires=("${requires[@]/libwebkit2gtk-4.1*/libwebkit2gtk-4_1-0}")
|
||||||
for i in "${!requires[@]}"; do
|
for i in "${!requires[@]}"; do
|
||||||
[[ ${requires[$i]} == "mesa-vulkan-drivers" ]] && unset -v 'requires[i]'
|
[[ ${requires[$i]} == "mesa-vulkan-drivers" ]] && unset -v 'requires[i]'
|
||||||
done
|
done
|
||||||
@@ -836,12 +861,12 @@ build_rpm() {
|
|||||||
cat <<-EOF > "$OUTPUT_DIR/SPECS/mediacenter.spec"
|
cat <<-EOF > "$OUTPUT_DIR/SPECS/mediacenter.spec"
|
||||||
Name: mediacenter$MC_MVERSION
|
Name: mediacenter$MC_MVERSION
|
||||||
Version: $MC_VERSION
|
Version: $MC_VERSION
|
||||||
Release: 1
|
Release: $MC_RELEASE
|
||||||
Summary: JRiver Media Center
|
Summary: JRiver Media Center
|
||||||
Group: Applications/Media
|
Group: Applications/Media
|
||||||
Source0: http://files.jriver-cdn.com/mediacenter/channels/v$MC_MVERSION/latest/MediaCenter-$MC_VERSION-$ARCH.deb
|
Source0: $MC_SOURCE
|
||||||
BuildArch: x86_64
|
BuildArch: x86_64
|
||||||
%define _rpmfilename %%{ARCH}/%%{NAME}-%%{version}.%%{ARCH}.rpm
|
%define _rpmfilename %%{ARCH}/%%{NAME}-%%{version}-%%{release}.%%{ARCH}.rpm
|
||||||
|
|
||||||
AutoReq: 0
|
AutoReq: 0
|
||||||
|
|
||||||
@@ -998,7 +1023,7 @@ install_mc_arch() {
|
|||||||
arch=('x86_64')
|
arch=('x86_64')
|
||||||
url="http://www.jriver.com/"
|
url="http://www.jriver.com/"
|
||||||
license=('custom')
|
license=('custom')
|
||||||
depends=('alsa-lib' 'gcc-libs' 'libx11' 'libxext' 'libxcb' 'libxau' 'libxdmcp' 'util-linux' 'libxext' 'gtk3')
|
depends=('alsa-lib' 'ca-certificates' 'gtk3' 'gcc-libs' 'libx11' 'libxext' 'libxcb' 'libxau' 'libxdmcp' 'util-linux' 'mesa-libgl' 'webkit2gtk')
|
||||||
optdepends=(
|
optdepends=(
|
||||||
'mesa-libgl: nouveau video support'
|
'mesa-libgl: nouveau video support'
|
||||||
'nvidia-libgl: nvidia video support'
|
'nvidia-libgl: nvidia video support'
|
||||||
@@ -1690,7 +1715,7 @@ main() {
|
|||||||
[[ -d $OUTPUT_DIR/SOURCES ]] || execute mkdir -p "$OUTPUT_DIR/SOURCES"
|
[[ -d $OUTPUT_DIR/SOURCES ]] || execute mkdir -p "$OUTPUT_DIR/SOURCES"
|
||||||
acquire_deb || { err "Could not download Media Center DEB package"; return 1; }
|
acquire_deb || { err "Could not download Media Center DEB package"; return 1; }
|
||||||
|
|
||||||
if [[ $BUILD_TARGET =~ (centos|fedora|suse) || $CREATEREPO_TARGET =~ (centos|fedora|suse) ]]; then
|
if [[ $BUILD_TARGET =~ centos|fedora|suse || $CREATEREPO_TARGET =~ centos|fedora|suse ]]; then
|
||||||
install_package dpkg rpm-build
|
install_package dpkg rpm-build
|
||||||
[[ -d $OUTPUT_DIR/SPECS ]] || execute mkdir -p "$OUTPUT_DIR/SPECS"
|
[[ -d $OUTPUT_DIR/SPECS ]] || execute mkdir -p "$OUTPUT_DIR/SPECS"
|
||||||
build_rpm
|
build_rpm
|
||||||
@@ -1764,35 +1789,24 @@ execute() {
|
|||||||
download() {
|
download() {
|
||||||
local url="$1"
|
local url="$1"
|
||||||
local output="${2:-}"
|
local output="${2:-}"
|
||||||
local -a download_cmd
|
local -a cmd
|
||||||
|
|
||||||
if command -v wget &>/dev/null; then
|
if command -v curl &>/dev/null || install_package --silent curl; then
|
||||||
download_cmd=(wget --quiet)
|
cmd=(curl --silent --fail --location)
|
||||||
elif command -v curl &>/dev/null; then
|
|
||||||
download_cmd=(curl --silent --location)
|
|
||||||
else
|
|
||||||
if install_package --silent wget; then
|
|
||||||
download_cmd=(wget --quiet)
|
|
||||||
elif install_package --silent curl; then
|
|
||||||
download_cmd=(curl --silent --location)
|
|
||||||
else
|
|
||||||
err "Unable to install wget or curl"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ${download_cmd[0]} == "wget" ]]; then
|
|
||||||
"${download_cmd[@]}" --output-document="${output:--}" "$url"
|
|
||||||
elif [[ ${download_cmd[0]} == "curl" ]]; then
|
|
||||||
if [[ -n "$output" ]]; then
|
if [[ -n "$output" ]]; then
|
||||||
"${download_cmd[@]}" --output "$output" "$url"
|
cmd+=(--output "$output")
|
||||||
else
|
else
|
||||||
"${download_cmd[@]}" "$url"
|
cmd+=(-O)
|
||||||
fi
|
fi
|
||||||
|
elif command -v wget &>/dev/null || install_package --silent wget; then
|
||||||
|
cmd=(wget --quiet)
|
||||||
|
[[ -n "$output" ]] && cmd+=("--output-document=$output")
|
||||||
else
|
else
|
||||||
err "Unsupported download command: ${download_cmd[*]}"
|
err "Unable to install wget or curl"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
"${cmd[@]}" "$url"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Roughly turn debugging on for pre-init
|
# Roughly turn debugging on for pre-init
|
||||||
|
|||||||
Reference in New Issue
Block a user