|
@@ -212,7 +212,7 @@ EOF
|
|
# build some basic command arrays based on OS and user input
|
|
# build some basic command arrays based on OS and user input
|
|
if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
|
|
if [[ "$ID" =~ ^(fedora|centos)$ ]]; then
|
|
_install_cmd=("dnf" "install" "-y")
|
|
_install_cmd=("dnf" "install" "-y")
|
|
- _update_cmd=("dnf" "update" "-y")
|
|
|
|
|
|
+ _update_cmd=("dnf" "makecache" "-y")
|
|
_pkg_query_cmd=("rpm" "-q")
|
|
_pkg_query_cmd=("rpm" "-q")
|
|
elif [[ "$ID" =~ ^(ubuntu|debian)$ ]]; then
|
|
elif [[ "$ID" =~ ^(ubuntu|debian)$ ]]; then
|
|
_install_cmd=("apt-get" "install" "-y")
|
|
_install_cmd=("apt-get" "install" "-y")
|
|
@@ -245,34 +245,56 @@ EOF
|
|
|
|
|
|
# We will add packages to this array if their command is not available
|
|
# We will add packages to this array if their command is not available
|
|
local -a _pkg_array
|
|
local -a _pkg_array
|
|
|
|
+ local -a _url_pkg_array
|
|
|
|
|
|
# parse commands
|
|
# parse commands
|
|
for _pkg in "$@"; do
|
|
for _pkg in "$@"; do
|
|
|
|
+ # Clean up package name and handle OS-specific tweaks
|
|
_pkg=$(_packageOverrides "$_pkg")
|
|
_pkg=$(_packageOverrides "$_pkg")
|
|
- # Insert the package name to test if already installed one element from the end
|
|
|
|
- # and silence output
|
|
|
|
- if ! "${_pkg_query_cmd[@]}" "$_pkg" > /dev/null 2>&1; then
|
|
|
|
- _pkg_array+=("$_pkg")
|
|
|
|
|
|
+ # Insert the package name to test if already installed
|
|
|
|
+ if [[ "$_pkg" != "" ]] && ! "${_pkg_query_cmd[@]}" "$_pkg" > /dev/null 2>&1; then
|
|
|
|
+ if [[ -n $_url_pkg ]]; then
|
|
|
|
+ _url_pkg_array+=("$_url_pkg")
|
|
|
|
+ else
|
|
|
|
+ _pkg_array+=("$_pkg")
|
|
|
|
+ fi
|
|
fi
|
|
fi
|
|
done
|
|
done
|
|
|
|
|
|
if [[ ${#_pkg_array[@]} -ge 1 ]]; then
|
|
if [[ ${#_pkg_array[@]} -ge 1 ]]; then
|
|
- echo "Installing ${_pkg_array[*]}"
|
|
|
|
|
|
+ [[ -n $_debug ]] && echo "Installing: " "${_pkg_array[@]}"
|
|
"${_install_cmd[@]}" "${_pkg_array[@]}" > /dev/null 2>&1
|
|
"${_install_cmd[@]}" "${_pkg_array[@]}" > /dev/null 2>&1
|
|
fi
|
|
fi
|
|
|
|
+
|
|
|
|
+ if [[ ${#_url_pkg_array[@]} -ge 1 ]]; then
|
|
|
|
+ [[ -n $_debug ]] && echo "Installing: " "${_url_pkg_array[@]}"
|
|
|
|
+ "${_install_cmd_nogpg[@]}" "${_url_pkg_array[@]}" > /dev/null 2>&1
|
|
|
|
+ fi
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
_packageOverrides () {
|
|
_packageOverrides () {
|
|
|
|
|
|
- if [[ "$ID" == "ubuntu" || "$ID" == "debian" ]]; then
|
|
|
|
- if [[ "$1" == "rpm-build" ]]; then
|
|
|
|
- echo "rpm"
|
|
|
|
- elif [[ "$1" == "createrepo_c" ]]; then
|
|
|
|
- echo "createrepo"
|
|
|
|
- else
|
|
|
|
|
|
+ unset _url_pkg
|
|
|
|
+
|
|
|
|
+ if [[ "$1" == "rpm-build" && "$ID" =~ ^(ubuntu|debian)$ ]]; then
|
|
|
|
+ echo "rpm"
|
|
|
|
+ elif [[ "$1" == "createrepo_c" && "$ID" =~ ^(ubuntu|debian)$ ]]; then
|
|
|
|
+ echo "createrepo"
|
|
|
|
+ elif [[ "$1" == "rpmfusion-free-release" ]]; then
|
|
|
|
+ if [[ "$ID" == "fedora" ]]; then
|
|
|
|
+ _url_pkg="https://download1.rpmfusion.org/free/$ID/rpmfusion-free-release-$VERSION_ID.noarch.rpm"
|
|
|
|
+ echo "$1"
|
|
|
|
+ elif [[ "$ID" == "centos" ]]; then
|
|
|
|
+ _url_pkg="https://download1.rpmfusion.org/free/el/rpmfusion-free-release-$VERSION_ID.noarch.rpm"
|
|
echo "$1"
|
|
echo "$1"
|
|
|
|
+ else
|
|
|
|
+ echo ""
|
|
fi
|
|
fi
|
|
|
|
+ elif [[ "$1" == "epel-release" && "$ID" != "centos" ]]; then
|
|
|
|
+ echo ""
|
|
else
|
|
else
|
|
echo "$1"
|
|
echo "$1"
|
|
fi
|
|
fi
|
|
@@ -321,21 +343,7 @@ EOF
|
|
|
|
|
|
_installExternalRepos () {
|
|
_installExternalRepos () {
|
|
|
|
|
|
- if [[ "$ID" == "fedora" ]]; then
|
|
|
|
- if ! rpm --quiet --query rpmfusion-free-release; then
|
|
|
|
- echo "Installing rpmfusion-free-release repo..."
|
|
|
|
- "${_install_cmd_nogpg[@]}" "https://download1.rpmfusion.org/free/$ID/rpmfusion-free-release-$VERSION_ID.noarch.rpm" > /dev/null 2>&1
|
|
|
|
- fi
|
|
|
|
- elif [[ "$ID" == "centos" ]]; then
|
|
|
|
- if ! rpm --quiet --query epel-release; then
|
|
|
|
- echo "Installing epel-release repo..."
|
|
|
|
- "${_install_cmd_nogpg[@]}" epel-release > /dev/null 2>&1
|
|
|
|
- fi
|
|
|
|
- if ! rpm --quiet --query rpmfusion-free-release; then
|
|
|
|
- echo "Installing rpmfusion-free-release repo..."
|
|
|
|
- "${_install_cmd_nogpg[@]}" "https://download1.rpmfusion.org/free/el/rpmfusion-free-release-$VERSION_ID.noarch.rpm" > /dev/null 2>&1
|
|
|
|
- fi
|
|
|
|
- fi
|
|
|
|
|
|
+ _installPackage rpmfusion-free-release epel-release
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -352,7 +360,7 @@ gpgcheck=0
|
|
EOF'
|
|
EOF'
|
|
[[ -n $_debug ]] && cat /etc/yum.repos.d/jriver.repo
|
|
[[ -n $_debug ]] && cat /etc/yum.repos.d/jriver.repo
|
|
echo "Installing latest JRiver Media Center from repo..."
|
|
echo "Installing latest JRiver Media Center from repo..."
|
|
- if "${_update_cmd[@]}" && "${_install_cmd[@]}" MediaCenter; then
|
|
|
|
|
|
+ if "${_update_cmd[@]}" && "${_install_cmd[@]}" MediaCenter > /dev/null 2>&1; then
|
|
echo "JRiver Media Center installed successfully!"
|
|
echo "JRiver Media Center installed successfully!"
|
|
echo "You can check for future MC updates by running \"sudo dnf update\""
|
|
echo "You can check for future MC updates by running \"sudo dnf update\""
|
|
else
|
|
else
|