Move all distro checking logic to plexupdate-core

This commit is contained in:
Alex Malinovich 2018-04-19 21:45:12 -07:00
commit fd540b0325
4 changed files with 32 additions and 40 deletions

BIN
extras/.installer.sh.swp Normal file

Binary file not shown.

View file

@ -34,6 +34,7 @@ install() {
sleep 1
[ -z "$DISTRO_INSTALL" ] && check_distro
DISTRO_INSTALL="${DISTRO_INSTALL} install"
if [ $EUID -ne 0 ]; then
sudo $DISTRO_INSTALL $1 || abort "Failed while trying to install '$1'. Please install it manually and try again."
@ -42,24 +43,6 @@ install() {
fi
}
check_distro() {
if [ -f /etc/redhat-release ] && hash dnf 2>/dev/null; then
DISTRO="redhat"
DISTRO_INSTALL="dnf -y install"
elif [ -f /etc/redhat-release ] && hash yum 2>/dev/null; then
DISTRO="redhat" #or CentOS but functionally the same
DISTRO_INSTALL="yum -y install"
elif hash apt 2>/dev/null; then
DISTRO="debian" #or Ubuntu
DISTRO_INSTALL="apt install"
elif hash apt-get 2>/dev/null; then
DISTRO="debian"
DISTRO_INSTALL="apt-get install"
else
DISTRO="unknown"
fi
}
yesno() {
case "$1" in
"")