Skip to content

Commit

Permalink
Owner Group is now selectable and will be created if non existent
Browse files Browse the repository at this point in the history
  • Loading branch information
meisterd committed Jul 6, 2013
1 parent dd1ff54 commit 8d00a03
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion installers/common.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
msm_dir="/opt/msm"
msm_user="minecraft"
msm_group="minecraft"
dl_dir="$(mktemp -d -t msm-XXX)"

# Outputs an MSM INSTALL log line
Expand Down Expand Up @@ -30,6 +31,13 @@ function config_installation() {
msm_user="$input"
fi

echo -n "New server group to be created [${msm_group}]: "
read input
if [ ! -z "$input" ]; then
msm_group="$input"
fi


echo -n "Complete installation with these values? [y/N]: "
read answer

Expand Down Expand Up @@ -57,13 +65,19 @@ function add_minecraft_user() {
sudo useradd ${msm_user}
}

# Verifies existence of or adds group for Minecraft server (default "minecraft")
function add_minecraft_group() {
install_log "Creating default group '${msm_group}'"
sudo groupadd ${msm_group}
}

# Verifies existence and permissions of msm server directory (default /opt/msm)
function create_msm_directories() {
install_log "Creating MSM directories"
if [ ! -d "$msm_dir" ]; then
sudo mkdir -p "$msm_dir" || install_error "Couldn't create directory '$msm_dir'"
fi
sudo chown -R $msm_user:$msm_user "$msm_dir" || install_error "Couldn't change file ownership for '$msm_dir'"
sudo chown -R $msm_user:$msm_group "$msm_dir" || install_error "Couldn't change file ownership for '$msm_dir'"
}

# Fetches latest msm.conf, cron job, and init script
Expand Down Expand Up @@ -151,6 +165,7 @@ function install_complete() {
function install_msm() {
config_installation
add_minecraft_user
add_minecraft_group
update_system_packages
install_dependencies
create_msm_directories
Expand Down

0 comments on commit 8d00a03

Please sign in to comment.