Move install process to a sourceable function

This commit is contained in:
Marcus Whybrow 2012-11-03 21:20:16 +00:00
parent 63d2e21dbe
commit 00a2251823
4 changed files with 32 additions and 29 deletions

View File

@ -141,3 +141,33 @@ function update_msm() {
function install_complete() {
install_log "Done. Type 'msm help' to get started. Have fun!"
}
function install() {
echo "This script requires superuser access to install files to /etc."
echo "You will be prompted for your password by sudo."
# Clear existing sudo credentials
sudo -k
# Run install functions as sudo
# These functions are defined in another script
# after which this script is sourced
sudo sh <<SCRIPT
config_installation
update_system_packages
install_dependencies
add_minecraft_user
create_msm_directories
download_latest_files
patch_latest_files
install_config
install_cron
reload_cron
install_init
enable_init
update_msm
install_complete
SCRIPT
}

View File

@ -31,4 +31,4 @@ function enable_init() {
fi
}
bash <(wget -qO- https://raw.github.com/marcuswhybrow/minecraft-server-manager/master/installers/install.sh)
install

View File

@ -1,27 +0,0 @@
echo "This script requires superuser access to install files to /etc."
echo "You will be prompted for your password by sudo."
# Clear existing sudo credentials
sudo -k
# Run install functions as sudo
# These functions are defined in another script
# after which this script is sourced
sudo sh <<SCRIPT
config_installation
update_system_packages
install_dependencies
add_minecraft_user
create_msm_directories
download_latest_files
patch_latest_files
install_config
install_cron
reload_cron
install_init
enable_init
update_msm
install_complete
SCRIPT

View File

@ -20,4 +20,4 @@ function enable_init() {
chkconfig --add msm
}
source <(wget -qO- https://raw.github.com/marcuswhybrow/minecraft-server-manager/master/installers/install.sh)
install