Comparer les révisions
1 Révisions
4241a04463
...
be6908b9d4
| Auteur | SHA1 | Date | |
|---|---|---|---|
| be6908b9d4 |
54
installJRMC
54
installJRMC
@@ -168,8 +168,16 @@ EOF
|
||||
}
|
||||
|
||||
|
||||
_runDebug () {
|
||||
|
||||
[[ -n $_debug ]] && echo "Running: $*"
|
||||
}
|
||||
|
||||
|
||||
_checkUser () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
if [[ "$_user" == "root" ]]; then
|
||||
|
||||
cat <<EOF
|
||||
@@ -187,6 +195,8 @@ EOF
|
||||
|
||||
_getOS () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
if [[ -e /etc/os-release ]]; then
|
||||
source /etc/os-release
|
||||
else
|
||||
@@ -194,11 +204,15 @@ EOF
|
||||
echo "Your OS is unsupported"
|
||||
_printHelpAndExit 1
|
||||
fi
|
||||
|
||||
[[ -n $_debug ]] && echo "Platform: $ID $VERSION_ID"
|
||||
}
|
||||
|
||||
|
||||
_buildCommands () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
# build some basic command arrays based on OS and user input
|
||||
if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
|
||||
_install_cmd=("dnf" "install" "-y")
|
||||
@@ -238,6 +252,8 @@ EOF
|
||||
|
||||
_installPackage () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
# We will add packages to this array if their command is not available
|
||||
local -a _pkg_array
|
||||
local -a _url_pkg_array
|
||||
@@ -270,6 +286,8 @@ EOF
|
||||
|
||||
_packageQuirks () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
unset _url_pkg
|
||||
|
||||
if [[ "$1" == "rpm-build" && "$ID" =~ ^(ubuntu|debian)$ ]]; then
|
||||
@@ -296,6 +314,8 @@ EOF
|
||||
|
||||
_setVersion () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
if [[ -z "$_mcversion" ]]; then
|
||||
|
||||
_installPackage wget
|
||||
@@ -321,6 +341,8 @@ EOF
|
||||
|
||||
_sanityChecks () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
# Cannot create a repo without an rpm
|
||||
if [[ -n $_createrepo || -n $_mcversion ]]; then
|
||||
_rpmbuild="true"
|
||||
@@ -336,12 +358,16 @@ EOF
|
||||
|
||||
_installExternalRepos () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
_installPackage rpmfusion-free-release epel-release
|
||||
}
|
||||
|
||||
|
||||
_installRepo () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
_installPackage wget gnupg
|
||||
|
||||
if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
|
||||
@@ -386,6 +412,8 @@ EOF'
|
||||
|
||||
_acquireDeb () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
# If necessary, create SOURCES dir
|
||||
[[ ! -d "$_outputdir/SOURCES" ]] && mkdir -p "$_outputdir/SOURCES"
|
||||
|
||||
@@ -420,6 +448,8 @@ EOF'
|
||||
|
||||
_buildRPM () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
# install build dependencies
|
||||
_installPackage wget dpkg rpm-build
|
||||
|
||||
@@ -524,6 +554,8 @@ EOF"
|
||||
|
||||
_runCreateRepo () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
_installPackage createrepo_c
|
||||
|
||||
unset _prefix
|
||||
@@ -564,6 +596,8 @@ EOF"
|
||||
|
||||
_installRPM () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
# skip installing same version
|
||||
_installed_ver="$(rpm --query MediaCenter)"
|
||||
_to_be_installed_ver="MediaCenter-$_mcversion.x86_64"
|
||||
@@ -591,6 +625,8 @@ EOF"
|
||||
|
||||
_symlinkCerts () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
if [[ ! -f /etc/ssl/certs/ca-certificates.crt && \
|
||||
-f /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem ]]; then
|
||||
echo "Symlinking /etc/ssl/certs/ca-certificates.crt to /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem"
|
||||
@@ -605,6 +641,8 @@ EOF"
|
||||
|
||||
_restoreLicense () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
# Allow user to drop an mjr file next to installJRMC
|
||||
if [[ -z $_restorefile ]]; then
|
||||
for _mjr in "$_basedir"/*.mjr; do
|
||||
@@ -623,6 +661,8 @@ EOF"
|
||||
|
||||
_openFirewall () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
# RHEL
|
||||
if [[ "$ID" =~ ^(fedora|centos)$ ]] && [[ -x $(command -v firewall-cmd) ]]; then
|
||||
if ! firewall-cmd --get-services | grep -q jriver; then
|
||||
@@ -653,6 +693,8 @@ EOF"
|
||||
|
||||
_setVNCPass () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
_vncpassfile="$HOME/.vnc/jrmc_passwd"
|
||||
|
||||
if [[ -n $_vncpass ]]; then
|
||||
@@ -668,6 +710,8 @@ EOF"
|
||||
|
||||
_systemctlReloadAndEnable () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
echo "Enabling $1"
|
||||
|
||||
if [[ "$_user" == "root" ]]; then
|
||||
@@ -682,6 +726,8 @@ EOF"
|
||||
|
||||
_generateServiceVars () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
unset _service_fname _service_name _timer_fname _timer_name _user_specifier
|
||||
|
||||
if [[ "$_user" == "root" ]]; then
|
||||
@@ -702,6 +748,8 @@ EOF"
|
||||
|
||||
_serviceMediaserver () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
_generateServiceVars "jriver-mediaserver"
|
||||
|
||||
"${_bash_cmd[@]}" "cat <<-EOF > $_service_fname
|
||||
@@ -728,6 +776,8 @@ EOF"
|
||||
|
||||
_serviceX11VNC () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
_installPackage x11vnc
|
||||
_setVNCPass
|
||||
|
||||
@@ -761,6 +811,8 @@ EOF"
|
||||
|
||||
_serviceCreaterepo () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
_generateServiceVars "jriver-createrepo"
|
||||
|
||||
"${_bash_cmd[@]}" "cat <<-EOF > $_service_fname
|
||||
@@ -791,6 +843,8 @@ EOF"
|
||||
|
||||
_uninstall () {
|
||||
|
||||
_runDebug "${FUNCNAME[0]}"
|
||||
|
||||
read -r -p "Do you really want to uninstall all JRiver Media Center files? [y/N] " _response
|
||||
_response=${_response,,} # tolower
|
||||
[[ ! "$_response" =~ ^(yes|y)$ ]] && echo "Cancelling uninstall..." && exit 0
|
||||
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur