2018-10-01 17:44:06 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-07-15 16:36:16 +00:00
|
|
|
UPDATE_URL="https://raw.githubusercontent.com/msmhq/msm/master"
|
2013-06-10 03:48:34 +00:00
|
|
|
wget -q ${UPDATE_URL}/installers/common.sh -O /tmp/msmcommon.sh
|
2012-11-03 22:35:11 +00:00
|
|
|
source /tmp/msmcommon.sh && rm -f /tmp/msmcommon.sh
|
2012-09-02 17:45:09 +00:00
|
|
|
|
2022-07-25 00:34:02 +00:00
|
|
|
# Installs sudo if it is not installed
|
|
|
|
function install_sudo() {
|
|
|
|
install_log "Installing sudo"
|
|
|
|
DEBIAN_FRONTEND=noninteractive apt-get -yqq install sudo
|
|
|
|
}
|
|
|
|
|
2012-09-02 17:45:09 +00:00
|
|
|
function update_system_packages() {
|
|
|
|
install_log "Updating sources"
|
2018-10-04 22:22:56 +00:00
|
|
|
if [ -f /etc/os-release ]; then
|
|
|
|
. /etc/os-release
|
2020-09-26 22:02:50 +00:00
|
|
|
if [ "$NAME" == 'Ubuntu' ]; then
|
2022-07-25 00:34:02 +00:00
|
|
|
if ! command -v add-apt-repository > /dev/null 2>&1; then
|
|
|
|
sudo apt-get -yqq install software-properties-common
|
|
|
|
fi
|
|
|
|
|
2018-10-04 22:22:56 +00:00
|
|
|
sudo add-apt-repository universe || install_error "Couldn't enable universe repository"
|
|
|
|
fi
|
|
|
|
fi
|
2022-07-25 00:34:02 +00:00
|
|
|
sudo apt-get -yqq update || install_error "Couldn't update package list"
|
|
|
|
DEBIAN_FRONTEND=noninteractive sudo apt-get -yqq upgrade || install_error "Couldn't upgrade packages"
|
2012-09-02 17:45:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function install_dependencies() {
|
|
|
|
install_log "Installing required packages"
|
2022-07-25 00:34:02 +00:00
|
|
|
DEBIAN_FRONTEND=noninteractive sudo apt-get -yqq install jq rsync screen wget zip || install_error "Couldn't install dependencies"
|
|
|
|
if ! command -v java > /dev/null 2>&1; then
|
|
|
|
install_log "Installing Java (OpenJDK 17)"
|
|
|
|
DEBIAN_FRONTEND=noninteractive sudo apt-get -yqq install openjdk-17-jre-headless || install_error "Couldn't install Java"
|
|
|
|
fi
|
2012-09-02 17:45:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function enable_init() {
|
|
|
|
install_log "Enabling automatic startup and shutdown"
|
2012-09-02 18:29:17 +00:00
|
|
|
hash insserv 2>/dev/null
|
|
|
|
if [[ $? == 0 ]]; then
|
2012-11-03 22:20:53 +00:00
|
|
|
sudo insserv msm
|
2012-09-02 18:29:17 +00:00
|
|
|
else
|
2015-08-06 15:13:24 +00:00
|
|
|
sudo update-rc.d msm defaults 99 10
|
2012-09-02 18:29:17 +00:00
|
|
|
fi
|
2012-09-02 17:45:09 +00:00
|
|
|
}
|
2012-09-13 18:55:31 +00:00
|
|
|
|
2013-06-10 03:48:34 +00:00
|
|
|
install_msm
|