Fix --install=local on SUSE
This commit is contained in:
55
installJRMC
55
installJRMC
@@ -269,16 +269,11 @@ init() {
|
|||||||
# Currently there is no remote repository for SUSE
|
# Currently there is no remote repository for SUSE
|
||||||
# installJRMC can easily create one but I'd rather a SUSEian provide it
|
# installJRMC can easily create one but I'd rather a SUSEian provide it
|
||||||
# So use local rpmbuild method by default for SUSE
|
# So use local rpmbuild method by default for SUSE
|
||||||
if [[ $# -le 2 ]]; then
|
if ((REPO_INSTALL_SWITCH)); then
|
||||||
case "$1" in
|
debug "Automatically using --install=local for SUSE"
|
||||||
--debug| -d| --verbose| -y| --yes| --auto| --mcrepo| --mcversion| \
|
REPO_INSTALL_SWITCH=0
|
||||||
--arch| --betapass| --restorefile| --outputdir| --no-update)
|
BUILD_SWITCH=1
|
||||||
debug "Automatically using --install local for SUSE"
|
LOCAL_INSTALL_SWITCH=1
|
||||||
REPO_INSTALL_SWITCH=0
|
|
||||||
BUILD_SWITCH=1
|
|
||||||
LOCAL_INSTALL_SWITCH=1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -295,7 +290,7 @@ init() {
|
|||||||
else
|
else
|
||||||
err "OS detection failed!"
|
err "OS detection failed!"
|
||||||
ask_ok "Continue with manual installation?" || exit 1
|
ask_ok "Continue with manual installation?" || exit 1
|
||||||
debug "Automatically using --install local for unknown distro"
|
debug "Automatically using --install=local for unknown distro"
|
||||||
ID="unknown"
|
ID="unknown"
|
||||||
REPO_INSTALL_SWITCH=0
|
REPO_INSTALL_SWITCH=0
|
||||||
BUILD_SWITCH=1
|
BUILD_SWITCH=1
|
||||||
@@ -475,7 +470,7 @@ install_package() {
|
|||||||
debug "Aliasing $pkg to ${pkg_aliases[$pkg]}"
|
debug "Aliasing $pkg to ${pkg_aliases[$pkg]}"
|
||||||
pkg=${pkg_aliases[$pkg]}
|
pkg=${pkg_aliases[$pkg]}
|
||||||
fi
|
fi
|
||||||
if (( no_install_check )) \
|
if ((no_install_check)) \
|
||||||
|| ! { command -v "$pkg" &>/dev/null \
|
|| ! { command -v "$pkg" &>/dev/null \
|
||||||
|| "${PKG_QUERY[@]}" "$pkg" &>/dev/null; }; then
|
|| "${PKG_QUERY[@]}" "$pkg" &>/dev/null; }; then
|
||||||
pkg_array+=("$pkg")
|
pkg_array+=("$pkg")
|
||||||
@@ -777,7 +772,7 @@ build_rpm() {
|
|||||||
requires="${requires%?}"
|
requires="${requires%?}"
|
||||||
recommends="${recommends%?}"
|
recommends="${recommends%?}"
|
||||||
|
|
||||||
if (( COMPAT_SWITCH )); then
|
if ((COMPAT_SWITCH)); then
|
||||||
# Strip minimum versions
|
# Strip minimum versions
|
||||||
requires=$(echo "$requires" | awk -F" " 'NF == 4 {print $1 " " $2} NF != 4 {print $0}')
|
requires=$(echo "$requires" | awk -F" " 'NF == 4 {print $1 " " $2} NF != 4 {print $0}')
|
||||||
fi
|
fi
|
||||||
@@ -860,7 +855,7 @@ build_rpm() {
|
|||||||
install_mc_deb() {
|
install_mc_deb() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
debug "Running: ${FUNCNAME[0]}"
|
||||||
|
|
||||||
if (( COMPAT_SWITCH )); then
|
if ((COMPAT_SWITCH)); then
|
||||||
local extract_dir; extract_dir="$(mktemp -d)"
|
local extract_dir; extract_dir="$(mktemp -d)"
|
||||||
pushd "$extract_dir" &>/dev/null || return
|
pushd "$extract_dir" &>/dev/null || return
|
||||||
command -v ar &>/dev/null || { install_package binutils || return 1; }
|
command -v ar &>/dev/null || { install_package binutils || return 1; }
|
||||||
@@ -1175,10 +1170,10 @@ set_display_vars() {
|
|||||||
THIS_DISPLAY_NUM="${THIS_DISPLAY#*:}" # strip prefix
|
THIS_DISPLAY_NUM="${THIS_DISPLAY#*:}" # strip prefix
|
||||||
THIS_DISPLAY_NUM="${THIS_DISPLAY_NUM%%.*}" # strip suffix
|
THIS_DISPLAY_NUM="${THIS_DISPLAY_NUM%%.*}" # strip suffix
|
||||||
# Increment each time we run this
|
# Increment each time we run this
|
||||||
if (( NEXT_DISPLAY_NUM )); then
|
if ((NEXT_DISPLAY_NUM)); then
|
||||||
declare -g NEXT_DISPLAY_NUM=$(( NEXT_DISPLAY_NUM + 1 ))
|
declare -g NEXT_DISPLAY_NUM=$((NEXT_DISPLAY_NUM + 1))
|
||||||
else
|
else
|
||||||
declare -g NEXT_DISPLAY_NUM=$(( THIS_DISPLAY_NUM + 1 ))
|
declare -g NEXT_DISPLAY_NUM=$((THIS_DISPLAY_NUM + 1))
|
||||||
fi
|
fi
|
||||||
NEXT_DISPLAY=":$NEXT_DISPLAY_NUM"
|
NEXT_DISPLAY=":$NEXT_DISPLAY_NUM"
|
||||||
}
|
}
|
||||||
@@ -1281,7 +1276,7 @@ service_jriver-xvnc() {
|
|||||||
|
|
||||||
set_service_vars "${FUNCNAME[0]##*_}" "system"
|
set_service_vars "${FUNCNAME[0]##*_}" "system"
|
||||||
set_display_vars
|
set_display_vars
|
||||||
declare -g PORT=$(( NEXT_DISPLAY_NUM + 5900 ))
|
declare -g PORT=$((NEXT_DISPLAY_NUM + 5900))
|
||||||
|
|
||||||
install_package tigervnc-server
|
install_package tigervnc-server
|
||||||
set_vnc_pass xvnc
|
set_vnc_pass xvnc
|
||||||
@@ -1294,7 +1289,7 @@ service_jriver-xvnc() {
|
|||||||
-xstartup "/usr/bin/mediacenter$MC_MVERSION"
|
-xstartup "/usr/bin/mediacenter$MC_MVERSION"
|
||||||
)
|
)
|
||||||
|
|
||||||
if (( NOVNCAUTH )); then
|
if ((NOVNCAUTH)); then
|
||||||
start_cmd+=(
|
start_cmd+=(
|
||||||
-name "jriver$NEXT_DISPLAY"
|
-name "jriver$NEXT_DISPLAY"
|
||||||
-SecurityTypes None)
|
-SecurityTypes None)
|
||||||
@@ -1325,7 +1320,7 @@ service_jriver-xvnc() {
|
|||||||
if ! "${ENABLE[@]}" "$SERVICE_NAME"; then
|
if ! "${ENABLE[@]}" "$SERVICE_NAME"; then
|
||||||
err "vncserver failed to start on DISPLAY $NEXT_DISPLAY"
|
err "vncserver failed to start on DISPLAY $NEXT_DISPLAY"
|
||||||
# Allow to increment 10 times before breaking
|
# Allow to increment 10 times before breaking
|
||||||
max=$(( THIS_DISPLAY_NUM + 10 ))
|
max=$((THIS_DISPLAY_NUM + 10))
|
||||||
while [[ $NEXT_DISPLAY_NUM -lt $max ]]; do
|
while [[ $NEXT_DISPLAY_NUM -lt $max ]]; do
|
||||||
echo "Incrementing DISPLAY and retrying"
|
echo "Incrementing DISPLAY and retrying"
|
||||||
service_jriver-xvnc && return
|
service_jriver-xvnc && return
|
||||||
@@ -1345,7 +1340,7 @@ service_jriver-x11vnc() {
|
|||||||
local -a start_cmd
|
local -a start_cmd
|
||||||
set_service_vars "${FUNCNAME[0]##*_}" "user"
|
set_service_vars "${FUNCNAME[0]##*_}" "user"
|
||||||
set_display_vars
|
set_display_vars
|
||||||
declare -g PORT=$(( THIS_DISPLAY_NUM + 5900 ))
|
declare -g PORT=$((THIS_DISPLAY_NUM + 5900))
|
||||||
install_package x11vnc
|
install_package x11vnc
|
||||||
set_vnc_pass x11vnc
|
set_vnc_pass x11vnc
|
||||||
|
|
||||||
@@ -1369,7 +1364,7 @@ service_jriver-x11vnc() {
|
|||||||
-bg
|
-bg
|
||||||
)
|
)
|
||||||
|
|
||||||
if (( NOVNCAUTH )); then
|
if ((NOVNCAUTH)); then
|
||||||
start_cmd+=(-nopw)
|
start_cmd+=(-nopw)
|
||||||
else
|
else
|
||||||
start_cmd+=(-rfbauth "$HOME/.vnc/jrmc_passwd")
|
start_cmd+=(-rfbauth "$HOME/.vnc/jrmc_passwd")
|
||||||
@@ -1588,7 +1583,7 @@ main() {
|
|||||||
debug "Running: ${FUNCNAME[0]} $*"
|
debug "Running: ${FUNCNAME[0]} $*"
|
||||||
|
|
||||||
echo "Starting installJRMC $SCRIPT_VERSION"
|
echo "Starting installJRMC $SCRIPT_VERSION"
|
||||||
if (( DEBUG )); then
|
if ((DEBUG)); then
|
||||||
echo "Debugging on"
|
echo "Debugging on"
|
||||||
else
|
else
|
||||||
echo "To enable debugging output, use --debug or -d"
|
echo "To enable debugging output, use --debug or -d"
|
||||||
@@ -1597,7 +1592,7 @@ main() {
|
|||||||
# Parse input, set default/host variables, and MC version
|
# Parse input, set default/host variables, and MC version
|
||||||
init "$@"
|
init "$@"
|
||||||
|
|
||||||
if (( UNINSTALL_SWITCH )); then
|
if ((UNINSTALL_SWITCH)); then
|
||||||
if ask_ok "Do you really want to uninstall JRiver Media Center?"; then
|
if ask_ok "Do you really want to uninstall JRiver Media Center?"; then
|
||||||
uninstall
|
uninstall
|
||||||
else
|
else
|
||||||
@@ -1608,7 +1603,7 @@ main() {
|
|||||||
|
|
||||||
install_external_repos
|
install_external_repos
|
||||||
|
|
||||||
if (( REPO_INSTALL_SWITCH )); then
|
if ((REPO_INSTALL_SWITCH)); then
|
||||||
echo "Installing JRiver Media Center from remote repository"
|
echo "Installing JRiver Media Center from remote repository"
|
||||||
if install_mc_repo; then
|
if install_mc_repo; then
|
||||||
echo "JRiver Media Center installed successfully from remote repository"
|
echo "JRiver Media Center installed successfully from remote repository"
|
||||||
@@ -1622,7 +1617,7 @@ main() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( BUILD_SWITCH )) && [[ $ID != "arch" ]]; then
|
if ((BUILD_SWITCH)) && [[ $ID != "arch" ]]; then
|
||||||
[[ -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; }
|
||||||
|
|
||||||
@@ -1633,7 +1628,7 @@ main() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( LOCAL_INSTALL_SWITCH )); then
|
if ((LOCAL_INSTALL_SWITCH)); then
|
||||||
if PKG_INSTALL_LOCAL "$@"; then
|
if PKG_INSTALL_LOCAL "$@"; then
|
||||||
echo "JRiver Media Center installed successfully from local package"
|
echo "JRiver Media Center installed successfully from local package"
|
||||||
else
|
else
|
||||||
@@ -1646,7 +1641,7 @@ main() {
|
|||||||
disable_btrfs_cow
|
disable_btrfs_cow
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( CREATEREPO_SWITCH )); then
|
if ((CREATEREPO_SWITCH)); then
|
||||||
if run_createrepo; then
|
if run_createrepo; then
|
||||||
echo "Successfully updated repo"
|
echo "Successfully updated repo"
|
||||||
else
|
else
|
||||||
@@ -1682,11 +1677,11 @@ main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# @section Helper functions
|
# @section Helper functions
|
||||||
debug() { (( DEBUG )) && echo "Debug: $*"; }
|
debug() { ((DEBUG)) && echo "Debug: $*"; }
|
||||||
err() { echo "Error: $*" >&2; }
|
err() { echo "Error: $*" >&2; }
|
||||||
ask_ok() {
|
ask_ok() {
|
||||||
declare response
|
declare response
|
||||||
(( YES_SWITCH )) && return 0
|
((YES_SWITCH)) && return 0
|
||||||
read -r -p "$* [y/N]: " response
|
read -r -p "$* [y/N]: " response
|
||||||
[[ ${response,,} =~ ^(yes|y)$ ]]
|
[[ ${response,,} =~ ^(yes|y)$ ]]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user