This repository has been archived by the owner on Jul 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·66 lines (56 loc) · 1.97 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#bin/sh
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# Authors:
# Tilman Griesel - rocketengine.io
LOG="log/setup/setup.log"
USER_NAME="athena-gamepanel"
USER_PASS=$(openssl rand -base64 16)
USER_GROUP="athena-gamepanel"
# Make sure only root can run this script
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
echo "--------------------------------------------"
echo "ATHENA SETUP STARTED"
echo "--------------------------------------------"
echo "Creating folder structure ..."
mkdir -p log
mkdir -p log/setup
mkdir -p log/server
mkdir -p _SERVER &>> $LOG
mkdir -p modules &>> $LOG
echo "Clean up ..."
skill -KILL -u $USER_NAME &>> $LOG # Kill user session
userdel $USER_NAME &>> $LOG # Delete user
echo "Creating user ..."
groupadd $USER_GROUP
useradd -m -p $USER_PASS $USER_NAME -g $USER_GROUP &>> $LOG # Add user to the system
echo "Setting permissions ..."
chown -R :$USER_GROUP _SERVER/ &>> $LOG
chown -R :$USER_GROUP log/ &>> $LOG
chmod -R 770 log &>> $LOG
chmod -R 770 _SERVER &>> $LOG
chmod 700 setup.sh &>> $LOG
echo "--------------------------------------------"
echo "ATHENA SETUP COMPLETED"
echo "Username:" $USER_NAME
echo "Password:" $USER_PASS
echo "--------------------------------------------"
exit 0