Compare commits
5 Commits
99746aecd0
...
f40d1b2ba0
| Author | SHA1 | Date | |
|---|---|---|---|
| f40d1b2ba0 | |||
| 2ca5fdf933 | |||
| b7849c3a8b | |||
| 73759e6a7f | |||
| d6e9ec6501 |
57
installJRMC
57
installJRMC
@@ -20,7 +20,7 @@
|
||||
|
||||
shopt -s extglob
|
||||
|
||||
_scriptversion="1.0b2"
|
||||
_scriptversion="1.0b3"
|
||||
_outputdir="$PWD/output"
|
||||
_createrepo_webroot="/var/www/jriver"
|
||||
_exec_user="$(whoami)"
|
||||
@@ -402,7 +402,7 @@ getLatestVersion() {
|
||||
# Arguments:
|
||||
# One or more package names
|
||||
# Options:
|
||||
# --no-check: Do not check if package is already installed
|
||||
# --nocheck: Do not check if package is already installed
|
||||
# --nogpgcheck: Disable GPG checks for RPM based distros
|
||||
# --silent, -s: Do not report errors (useful if package is not strictly required and errors are noisy)
|
||||
#######################################
|
||||
@@ -410,14 +410,14 @@ installPackage() {
|
||||
debug "Running: ${FUNCNAME[0]}" "$@"
|
||||
|
||||
local -a _pkg_array _install_flags
|
||||
local _pkg
|
||||
local _pkg _nocheck _silent _return
|
||||
|
||||
if _input=$(getopt -o +s -l no-check,nogpgcheck,silent -- "$@"); then
|
||||
if _input=$(getopt -o +s -l nocheck,nogpgcheck,silent -- "$@"); then
|
||||
eval set -- "$_input"
|
||||
while true; do
|
||||
case "$1" in
|
||||
--no-check)
|
||||
local _no_check=true
|
||||
--nocheck)
|
||||
_nocheck=true
|
||||
;;
|
||||
--nogpgcheck)
|
||||
if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
|
||||
@@ -427,7 +427,7 @@ installPackage() {
|
||||
fi
|
||||
;;
|
||||
--silent|-s)
|
||||
local _silent=true
|
||||
_silent=true
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
@@ -443,11 +443,11 @@ installPackage() {
|
||||
|
||||
for _pkg in "$@"; do
|
||||
# Check for alias
|
||||
if [[ -v PKG_ALIASES["$_pkg"] ]]; then
|
||||
if [[ ! -v _nocheck && -v PKG_ALIASES[$_pkg] ]]; then
|
||||
_pkg=${PKG_ALIASES[$_pkg]}
|
||||
fi
|
||||
# Check if already installed
|
||||
if [[ -v _no_check ]] || ! pkg_query "$_pkg" > /dev/null 2>&1; then
|
||||
if [[ -v _nocheck ]] || ! pkg_query "$_pkg" > /dev/null 2>&1; then
|
||||
_pkg_array+=("$_pkg")
|
||||
fi
|
||||
done
|
||||
@@ -461,7 +461,7 @@ installPackage() {
|
||||
else
|
||||
pkg_install "${_install_flags[@]}" "${_pkg_array[@]}" > /dev/null 2>&1
|
||||
fi
|
||||
local _return=$?
|
||||
_return=$?
|
||||
[[ $_return -ne 0 && ! -v _silent ]] && err "Failed to install ${_pkg_array[*]}. Attempting to continue..."
|
||||
return $_return
|
||||
fi
|
||||
@@ -532,10 +532,10 @@ installMCFromRepo() {
|
||||
fi
|
||||
|
||||
if debug; then
|
||||
debug "installPackage --no-check $_mcpkg"
|
||||
installPackage --no-check --nogpgcheck "$_mcpkg"
|
||||
debug "installPackage --nocheck $_mcpkg"
|
||||
installPackage --nocheck --nogpgcheck "$_mcpkg"
|
||||
else
|
||||
installPackage --no-check --nogpgcheck "$_mcpkg" > /dev/null 2>&1
|
||||
installPackage --nocheck --nogpgcheck "$_mcpkg" > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
return $?
|
||||
@@ -588,6 +588,8 @@ acquireDeb() {
|
||||
buildRPM() {
|
||||
debug "Running: ${FUNCNAME[0]}"
|
||||
|
||||
declare -l _build_requires _requires
|
||||
|
||||
declare -g _mcrpm="$_outputdir/RPMS/x86_64/MediaCenter-$_mcversion.x86_64.rpm"
|
||||
|
||||
# skip rebuilding the rpm if it already exists
|
||||
@@ -604,9 +606,22 @@ buildRPM() {
|
||||
# rpmbuild uses rpm to check for build dependencies
|
||||
# this will fail on non-rpm distros
|
||||
if [[ "$ID" =~ ^(fedora|centos|opensuse.*)$ ]]; then
|
||||
local _build_requires=$'BuildRequires: rpm >= 4.11.0\nBuildRequires: dpkg'
|
||||
_build_requires=$'BuildRequires: rpm >= 4.11.0\nBuildRequires: dpkg'
|
||||
fi
|
||||
|
||||
# ALIASES (for SUSE)
|
||||
|
||||
|
||||
|
||||
# If you are building on SUSE, I assume you want SUSE RPMs
|
||||
# i.e. cross-building not an option but could be added
|
||||
if [[ "$ID" =~ ^opensuse.*$ ]]; then
|
||||
_requires=$'Requires: libglvnd \nBuildRequires: dpkg'
|
||||
else
|
||||
_requires=$'Requires: libglvnd \nBuildRequires: dpkg'
|
||||
fi
|
||||
|
||||
|
||||
# Create spec file
|
||||
cat <<- EOF > "$_outputdir/SPECS/mediacenter.spec"
|
||||
Name: MediaCenter
|
||||
@@ -631,7 +646,6 @@ buildRPM() {
|
||||
Requires: libstdc++ >= 7.4
|
||||
Requires: gtk3 >= 3.24
|
||||
Requires: mesa-libGL
|
||||
Requires: libglvnd-glx
|
||||
Requires: pango >= 1.42
|
||||
Requires: nss >= 3.42
|
||||
Requires: nspr >= 4.20
|
||||
@@ -1292,11 +1306,11 @@ main() {
|
||||
|
||||
# Install MC using package manager
|
||||
if [[ -v _install && "$_install" == "repo" ]]; then
|
||||
if ! installMCFromRepo; then
|
||||
if installMCFromRepo; then
|
||||
echo "JRiver Media Center installed successfully"
|
||||
else
|
||||
err "JRiver Media Center installation failed"
|
||||
exit 1
|
||||
else
|
||||
echo "JRiver Media Center installed successfully"
|
||||
fi
|
||||
symlinkCerts
|
||||
restoreLicense
|
||||
@@ -1323,7 +1337,12 @@ main() {
|
||||
|
||||
# Install RPM
|
||||
if [[ -v _install && "$_install" == "rpm" ]]; then
|
||||
installPackage --no-check --nogpgcheck "$_mcrpm"
|
||||
if installPackage --nocheck --nogpgcheck "$_mcrpm"; then
|
||||
echo "JRiver Media Center installed successfully"
|
||||
else
|
||||
err "JRiver Media Center installation failed"
|
||||
exit 1
|
||||
fi
|
||||
symlinkCerts
|
||||
restoreLicense
|
||||
openFirewall "jriver"
|
||||
|
||||
Reference in New Issue
Block a user