Bug hunting
This commit is contained in:
71
installJRMC
71
installJRMC
@@ -38,10 +38,9 @@ printHelp() {
|
|||||||
repo: Install MC from repository, updates are handled by the system package manager
|
repo: Install MC from repository, updates are handled by the system package manager
|
||||||
rpm: Build and install RPM locally (RPM-based distros only)
|
rpm: Build and install RPM locally (RPM-based distros only)
|
||||||
deb: Download and install offcial MC package locally (useful with --compat flag for older distros)
|
deb: Download and install offcial MC package locally (useful with --compat flag for older distros)
|
||||||
--build
|
--build=[opensuse|fedora|centos]
|
||||||
Build RPM from source DEB but do not install. Optional TARGET parameter enables RPM crossbuilding (ex. 'opensuse', 'fedora', 'centos')
|
Build RPM from source DEB but do not install
|
||||||
--target opensuse|fedora|centos
|
Specify non-native target with optional parameter (ex. 'opensuse', 'fedora', 'centos')
|
||||||
Cross-build RPM or createrepo for target distro
|
|
||||||
--mcversion VERSION
|
--mcversion VERSION
|
||||||
Specify the MC version, ex. "28.0.94" (Default: latest)
|
Specify the MC version, ex. "28.0.94" (Default: latest)
|
||||||
--outputdir PATH
|
--outputdir PATH
|
||||||
@@ -123,16 +122,25 @@ getOS() {
|
|||||||
parseInput() {
|
parseInput() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
debug "Running: ${FUNCNAME[0]}"
|
||||||
|
|
||||||
declare -g RPM_BUILD_SWITCH REPO_INSTALL_SWITCH COMPAT_SWITCH CREATEREPO_SWITCH UNINSTALL_SWITCH DEB_INSTALL_SWITCH
|
declare -g BUILD_SWITCH REPO_INSTALL_SWITCH COMPAT_SWITCH
|
||||||
declare -g TARGET OUTPUTDIR MCVERSION RESTOREFILE BETAPASS SERVICE_TYPE VNCPASS USER_DISPLAY CREATEREPO_WEBROOT CREATEREPO_USER
|
declare -g CREATEREPO_SWITCH UNINSTALL_SWITCH DEB_INSTALL_SWITCH
|
||||||
|
declare -g TARGET OUTPUTDIR MCVERSION RESTOREFILE BETAPASS SERVICE_TYPE
|
||||||
|
declare -g VNCPASS USER_DISPLAY CREATEREPO_WEBROOT CREATEREPO_USER
|
||||||
declare -ga SERVICES CONTAINERS
|
declare -ga SERVICES CONTAINERS
|
||||||
|
declare long_opts short_opts
|
||||||
|
|
||||||
if [[ $# -eq 0 ]] || [[ $# -eq 1 && "$1" =~ ^(--debug|-d)$ ]]; then
|
if [[ $# -eq 0 ]] || [[ $# -eq 1 && "$1" =~ ^(--debug|-d)$ ]]; then
|
||||||
echo "No options passed, defaulting to repo installation method"
|
|
||||||
REPO_INSTALL_SWITCH=1
|
REPO_INSTALL_SWITCH=1
|
||||||
|
elif [[ $# -eq 1 && "$1" =~ ^(--compat)$ ]]; then
|
||||||
|
TARGET="$ID"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if _input=$(getopt -o +i:vdhus:c: -l install:,build,target:,outputdir:,mcversion:,restorefile:,betapass:,service-type:,service:,version,debug,help,uninstall,createrepo,createrepo-webroot:,createrepo-user:,vncpass:,display:,container:,tests,compat -- "$@"); then
|
long_opts="install:,build::,outputdir:,mcversion:,restorefile:,betapass:,"
|
||||||
|
long_opts+="service-type:,service:,version,debug,help,uninstall,createrepo,"
|
||||||
|
long_opts+="createrepo-webroot:,createrepo-user:,vncpass:,display:,container:,tests,compat"
|
||||||
|
short_opts="+i:vb::dhus:c:"
|
||||||
|
|
||||||
|
if _input=$(getopt -o $short_opts -l $long_opts -- "$@"); then
|
||||||
eval set -- "$_input"
|
eval set -- "$_input"
|
||||||
while true; do
|
while true; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@@ -140,10 +148,11 @@ parseInput() {
|
|||||||
shift
|
shift
|
||||||
case "$1" in
|
case "$1" in
|
||||||
rpm)
|
rpm)
|
||||||
RPM_BUILD_SWITCH=1
|
BUILD_SWITCH=1
|
||||||
RPM_INSTALL_SWITCH=1
|
RPM_INSTALL_SWITCH=1
|
||||||
;;
|
;;
|
||||||
deb)
|
deb)
|
||||||
|
BUILD_SWITCH=1
|
||||||
DEB_INSTALL_SWITCH=1
|
DEB_INSTALL_SWITCH=1
|
||||||
;;
|
;;
|
||||||
repo)
|
repo)
|
||||||
@@ -151,10 +160,8 @@ parseInput() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
--build)
|
--build|-b)
|
||||||
RPM_BUILD_SWITCH=1
|
BUILD_SWITCH=1
|
||||||
;;
|
|
||||||
--target)
|
|
||||||
shift && TARGET="$1"
|
shift && TARGET="$1"
|
||||||
;;
|
;;
|
||||||
--outputdir)
|
--outputdir)
|
||||||
@@ -176,7 +183,7 @@ parseInput() {
|
|||||||
shift && SERVICES+=("$1")
|
shift && SERVICES+=("$1")
|
||||||
;;
|
;;
|
||||||
--createrepo)
|
--createrepo)
|
||||||
RPM_BUILD_SWITCH=1
|
BUILD_SWITCH=1
|
||||||
CREATEREPO_SWITCH=1
|
CREATEREPO_SWITCH=1
|
||||||
;;
|
;;
|
||||||
--createrepo-webroot)
|
--createrepo-webroot)
|
||||||
@@ -289,7 +296,7 @@ installPackage() {
|
|||||||
skip_check_installed=1
|
skip_check_installed=1
|
||||||
;;
|
;;
|
||||||
--allow-downgrades)
|
--allow-downgrades)
|
||||||
[[ "$ID" =~ (debian|ubuntu|neon) ]] && install_flags+=(--allow-downgrades)
|
[[ "$ID" =~ (debian|ubuntu|linuxmint|neon) ]] && install_flags+=(--allow-downgrades)
|
||||||
;;
|
;;
|
||||||
--nogpgcheck)
|
--nogpgcheck)
|
||||||
if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
|
if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
|
||||||
@@ -471,7 +478,9 @@ acquireDeb() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -f "$MCDEB" ]]; then
|
if [[ -f "$MCDEB" ]]; then
|
||||||
|
echo "Downloaded MC $MCVERSION DEB to: $MCDEB"
|
||||||
|
else
|
||||||
err "Downloaded DEB file missing or corrupted"
|
err "Downloaded DEB file missing or corrupted"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -648,7 +657,8 @@ buildRPM() {
|
|||||||
|
|
||||||
# Run rpmbuild
|
# Run rpmbuild
|
||||||
echo "Building RPM for MC $MCVERSION, this may take awhile"
|
echo "Building RPM for MC $MCVERSION, this may take awhile"
|
||||||
rpmbuild_cmd="rpmbuild --define=\"%_topdir $OUTPUTDIR\" --define=\"%_libdir /usr/lib\" -bb $OUTPUTDIR/SPECS/mediacenter.spec"
|
rpmbuild_cmd="rpmbuild --define=\"%_topdir $OUTPUTDIR\" --define=\"%_libdir /usr/lib\" -bb"
|
||||||
|
rpmbuild_cmd+=" $OUTPUTDIR/SPECS/mediacenter.spec"
|
||||||
debug "$rpmbuild_cmd" || rpmbuild_cmd+=" &>/dev/null"
|
debug "$rpmbuild_cmd" || rpmbuild_cmd+=" &>/dev/null"
|
||||||
if eval "$rpmbuild_cmd" && [[ -f "$MCRPM" ]] ; then
|
if eval "$rpmbuild_cmd" && [[ -f "$MCRPM" ]] ; then
|
||||||
echo "Build successful. The RPM file is located at: $MCRPM"
|
echo "Build successful. The RPM file is located at: $MCRPM"
|
||||||
@@ -1393,7 +1403,7 @@ main() {
|
|||||||
getOS
|
getOS
|
||||||
|
|
||||||
# Some distros need external repos installed for MC libraries
|
# Some distros need external repos installed for MC libraries
|
||||||
if [[ "$ID" == "ubuntu|neon" ]]; then
|
if [[ "$ID" =~ (ubuntu|linuxmint|neon) ]]; then
|
||||||
echo "Adding universe repository"
|
echo "Adding universe repository"
|
||||||
if ! grep ^deb /etc/apt/sources.list|grep -q universe; then
|
if ! grep ^deb /etc/apt/sources.list|grep -q universe; then
|
||||||
sudo add-apt-repository universe
|
sudo add-apt-repository universe
|
||||||
@@ -1456,18 +1466,25 @@ main() {
|
|||||||
if (( REPO_INSTALL_SWITCH )); then
|
if (( REPO_INSTALL_SWITCH )); then
|
||||||
if [[ "$ID" =~ ^opensuse.*$ ]]; then
|
if [[ "$ID" =~ ^opensuse.*$ ]]; then
|
||||||
echo "A SUSE repository is not yet available"
|
echo "A SUSE repository is not yet available"
|
||||||
echo "Use --install rpm to build and install a SUSE RPM instead""
|
echo "Use --install rpm to build and install a SUSE RPM instead"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
elif installMCFromRepo; then
|
||||||
if installMCFromRepo; then
|
|
||||||
echo "JRiver Media Center installed successfully from repo"
|
echo "JRiver Media Center installed successfully from repo"
|
||||||
|
symlinkCerts
|
||||||
|
restoreLicense
|
||||||
|
openFirewall "jriver"
|
||||||
else
|
else
|
||||||
err "JRiver Media Center installation from repo failed"
|
err "JRiver Media Center installation from repo failed"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
symlinkCerts
|
fi
|
||||||
restoreLicense
|
|
||||||
openFirewall "jriver"
|
if (( BUILD_SWITCH )); then
|
||||||
|
installPackage "wget" "dpkg" "rpm-build"
|
||||||
|
acquireDeb
|
||||||
|
if [[ "$TARGET" =~ ^(fedora|centos|opensuse.*) ]]; then
|
||||||
|
buildRPM
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( DEB_INSTALL_SWITCH )); then
|
if (( DEB_INSTALL_SWITCH )); then
|
||||||
@@ -1482,12 +1499,6 @@ main() {
|
|||||||
openFirewall "jriver"
|
openFirewall "jriver"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( RPM_BUILD_SWITCH )); then
|
|
||||||
installPackage "wget" "dpkg" "rpm-build"
|
|
||||||
acquireDeb
|
|
||||||
buildRPM
|
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user