mirror of
https://github.com/msmhq/msm.git
synced 2024-08-30 18:12:35 +00:00
Install wrapper to automatically detect distribution
Detects Linux distribution, downloads and executes corresponding installation script.
This commit is contained in:
parent
4461774cc6
commit
56ac65a54b
37
installers/install.sh
Normal file
37
installers/install.sh
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
BASE_URL="https://raw.github.com/marcuswhybrow/minecraft-server-manager/master/installers/"
|
||||||
|
|
||||||
|
function check_os() {
|
||||||
|
if [[ -f /etc/debian_version ]]; then
|
||||||
|
INSTALL_SCRIPT="debian.sh"
|
||||||
|
elif [[ -f /etc/redhat-release ]]; then
|
||||||
|
INSTALL_SCRIPT="arch.sh"
|
||||||
|
elif [[ -f /etc/arch-release ]]; then
|
||||||
|
INSTALL_SCRIPT="redhat.sh"
|
||||||
|
else
|
||||||
|
echo "Error, unsupported distribution. Please install manually."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_installer() {
|
||||||
|
type curl 1>/dev/null 2>&1
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
curl "${BASE_URL}/${INSTALL_SCRIPT}" -o /tmp/msminst.sh
|
||||||
|
else
|
||||||
|
wget -q "${BASE_URL}/${INSTALL_SCRIPT}" -O /tmp/msminst.sh
|
||||||
|
fi
|
||||||
|
chmod u+x /tmp/msminst.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
function do_install() {
|
||||||
|
if [[ -f /tmp/msminst.sh ]]; then
|
||||||
|
/tmp/msminst.sh && rm -f /tmp/msminst.sh
|
||||||
|
else
|
||||||
|
echo "Error, failed to download install script."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
check_os
|
||||||
|
get_installer
|
||||||
|
do_install
|
Loading…
Reference in New Issue
Block a user