Wire up --target deb

This commit is contained in:
2022-01-13 13:54:17 -05:00
parent 22c2be25bc
commit 46f92b7812

View File

@@ -345,6 +345,44 @@ installPackage() {
} }
#######################################
# Installs a package using the system package manager
# Arguments:
# One or more package names
# Options:
# --skip-check-installed: Do not check if package is already installed
# --nogpgcheck: Disable GPG checks for RPM based distros
# --allow-downgrades: Useful for installing compatability versions on DEB based distros
# --silent, -s: Do not report errors (useful if package is not strictly required and errors are noisy)
#######################################
installMCDEB() {
debug "Running: ${FUNCNAME[0]}"
aquireDeb
declare mcdeb="$MCDEB"
declare pkg_install_cmd="installPackage --skip-check-installed --nogpgcheck"
if (( COMPAT_SWITCH )); then
declare extract_dir && extract_dir="$(mktemp -d)"
mcdeb="${MCDEB/.deb/.compat.deb}"
pushd "$extract_dir" &>/dev/null || return $?
ar x "$MCDEB"
tar -xJf "control.tar.xz"
# Remove minimum version specifiers from control file
sed -i 's/ ([^)]*)//g' "control"
sed -i 's/([^)]*)//g' "control" # TODO MC DEB package error
tar -cJf "control.tar.xz" "control" "postinst"
ar rcs "$mcdeb" "debian-binary" "control.tar.xz" "data.tar.xz"
popd &>/dev/null || return $?
rm -rf "$extract_dir"
pkg_install_cmd+=" --allow-downgrades"
fi
pkg_install_cmd+=" $mcdeb"
debug "$pkg_install_cmd" || pkg_install_cmd+=" &>/dev/null"
eval "$pkg_install_cmd"
}
####################################### #######################################
# Add the JRiver repository files # Add the JRiver repository files
####################################### #######################################
@@ -1422,9 +1460,9 @@ main() {
exit 1 exit 1
fi fi
if installMCFromRepo; then if installMCFromRepo; then
echo "JRiver Media Center installed successfully" echo "JRiver Media Center installed successfully from repo"
else else
err "JRiver Media Center installation failed" err "JRiver Media Center installation from repo failed"
exit 1 exit 1
fi fi
symlinkCerts symlinkCerts
@@ -1433,24 +1471,15 @@ main() {
fi fi
if (( DEB_INSTALL_SWITCH )); then if (( DEB_INSTALL_SWITCH )); then
acquireDeb if installMCDEB; then
if (( COMPAT_SWITCH )); then echo "JRiver Media Center installed successfully from local deb"
declare extract_dir && extract_dir="$(mktemp -d)" else
declare mcdeb_compat="${MCDEB/.deb/.compat.deb}" err "JRiver Media Center installation from local deb failed"
pushd "$extract_dir" &>/dev/null || return $? exit 1
ar x "$MCDEB"
tar -xJf "control.tar.xz"
# Remove minimum version specifiers from control file
sed -i 's/ ([^)]*)//g' "control"
sed -i 's/([^)]*)//g' "control" # TODO MC DEB package error
tar -cJf "control.tar.xz" "control" "postinst"
ar rcs "$mcdeb_compat" "debian-binary" "control.tar.xz" "data.tar.xz"
popd &>/dev/null || return $?
rm -rf "$extract_dir"
fi fi
pkg_install_cmd="installPackage --skip-check-installed --nogpgcheck $mcdeb_compat" symlinkCerts
debug "$pkg_install_cmd" || pkg_install_cmd+=" &>/dev/null" restoreLicense
eval "$pkg_install_cmd" openFirewall "jriver"
fi fi
if (( RPM_BUILD_SWITCH )); then if (( RPM_BUILD_SWITCH )); then
@@ -1460,13 +1489,11 @@ main() {
fi fi
if (( RPM_INSTALL_SWITCH )); then if (( RPM_INSTALL_SWITCH )); then
#rpm --upgrade "$MCRPM" # TODO, maybe universalize for RPM distros #rpm --upgrade "$MCRPM" # TODO, maybe universalize for RPM distros
if installPackage --skip-check-installed --nogpgcheck "$MCRPM"; then if installPackage --skip-check-installed --nogpgcheck "$MCRPM"; then
echo "JRiver Media Center installed successfully" echo "JRiver Media Center installed successfully from local RPM"
else else
err "JRiver Media Center installation failed" err "JRiver Media Center installation from local RPM failed"
exit 1 exit 1
fi fi
symlinkCerts symlinkCerts