Last active
December 31, 2019 22:03
-
-
Save josephcy95/3360cd7f16515ca8e9cdfd3a1eac9882 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install ark | |
echo "installing ark" | |
curl -sL http://git.io/vtf5N | bash -s steam | |
su - steam -c "arkmanager install" | |
# Configure the server | |
# server name | |
while true; do | |
read -p "ARK Server Name (no special characters): " ark_SessionName | |
if ! [[ "$ark_SessionName" =~ [^(a-zA-Z0-9|[:blank])] ]]; then | |
if [[ -z "${ark_SessionName// }" ]]; then | |
echo "Cannot be empty" | |
else | |
break | |
fi | |
else | |
echo 'Invalid input!' | |
fi | |
done | |
# server password | |
while true; do | |
read -p "ARK Server Password (blank for none, no special characters): " ark_ServerPassword | |
if ! [[ "$ark_ServerPassword" =~ [^a-zA-Z0-9] ]]; then | |
break | |
else | |
echo 'Invalid input!' | |
fi | |
done | |
# server admin password | |
while true; do | |
read -p "ARK Server Admin Password (no special characters): " ark_ServerAdminPassword | |
if ! [[ "$ark_ServerAdminPassword" =~ [^a-zA-Z0-9] ]]; then | |
if [[ -z "${ark_ServerAdminPassword// }" ]]; then | |
echo "Cannot be empty" | |
else | |
break | |
fi | |
else | |
echo 'Invalid input!' | |
fi | |
done | |
file="/etc/arkmanager/arkmanager.cfg" | |
tmp_file="/etc/arkmanager/_arkmanager.cfg" | |
awk '{gsub("ark_SessionName=\"ARK Server Tools\"", "ark_SessionName=\"'"$ark_SessionName"'\""); print $0}' $file > $tmp_file && mv $tmp_file $file | |
awk '{gsub("ark_ServerPassword=\"\"", "ark_ServerPassword=\"'"$ark_ServerPassword"'\""); print $0}' $file > $tmp_file && mv $tmp_file $file | |
awk '{gsub("ark_ServerAdminPassword=\"keyboardcat\"", "ark_ServerAdminPassword=\"'"$ark_ServerAdminPassword"'\""); print $0}' $file > $tmp_file && mv $tmp_file $file | |
awk '{gsub("ark_MaxPlayers=\"70\"", "ark_MaxPlayers=\"25\""); print $0}' $file > $tmp_file && mv $tmp_file $file | |
echo "installation finished, please note the following important information" | |
#echo "ssh port: $port" | |
echo "ssh user: steam" | |
echo "ssh user password: $password" | |
echo "ark server name: $ark_SessionName" | |
echo "ark server password: $ark_ServerPassword" | |
echo "ark server admin password: $ark_ServerAdminPassword" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment