From 51692b26fb3c3a0d0574bb2ab2bf8aa2a5078e69 Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Wed, 23 Sep 2020 11:48:17 +0200 Subject: [PATCH] added dnf --- MySQL-ModInst.sh | 39 ++++++++++++++++++++++++++++++++++++--- dnf.list | 1 + 2 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 dnf.list diff --git a/MySQL-ModInst.sh b/MySQL-ModInst.sh index e7f6dc8..b30b32e 100644 --- a/MySQL-ModInst.sh +++ b/MySQL-ModInst.sh @@ -19,6 +19,39 @@ PKGM="apt" OUTPUT='/dev/tty' IMODE=l +#OS Detect + +dist_ver=$(grep --color=never -Po "^VERSION_ID=\K.*" "/etc/os-release") +dist=$(grep --color=never -Po "^ID=\K.*" "/etc/os-release") + +echo "input: $dist $dist_ver" + +if [[ "${dist}" == *"ubuntu"* ]] && [[ "${dist_ver}" == *"18.04"* ]]; then + echo "Ubuntu 18.04 Detected" + PKGM="apt" + shortdist=ubu1804 +elif [[ "${dist}" == *"ubuntu"* ]] && [[ "${dist_ver}" == *"20.04"* ]]; then + echo "Ubuntu 20.04 Detected" + PKGM="apt" + shortdist=ubu2004 +elif [[ "${dist}" == *"debian"* ]] && [[ "${dist_ver}" == *"10"* ]]; then + PKGM="apt" + PKGLIST="apt.list" + echo "Debian 10 Detected" + shortdist=deb10 +elif [[ "${dist}" == *"centos"* ]] && [[ "${dist_ver}" == *"8"* ]]; then + echo "Centos 8 Detected" + PKGM="dnf" + PKGLIST="dnf.list" + shortdist=cent8 +else +echo "This os in not supported" +fi + +unset dist_ver +unset dist + + #Web-V2 Vars password=TestP@ssword123 @@ -62,8 +95,8 @@ $PKGI curl > $OUTPUT 2>&1 # Generating APT list # ##-------------------------## #Webserver specific aptList -if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$mtype"/apt.list; then - curl "$mtype"/apt.list >>/tmp/apt.list +if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$mtype"/"$PKGLIST"; then + curl "$mtype"/"$PKGLIST" >>/tmp/apt.list fi @@ -73,7 +106,7 @@ fi msg "Preconfiguring." $PKGI software-properties-common gnupg > $OUTPUT 2>&1 -$PKGM update +$PKGM update -y $PKGM upgrade -y diff --git a/dnf.list b/dnf.list new file mode 100644 index 0000000..1ef115a --- /dev/null +++ b/dnf.list @@ -0,0 +1 @@ +mysql-community-server \ No newline at end of file