initialisation
This commit is contained in:
49
scripts/init.sh
Normal file
49
scripts/init.sh
Normal file
@ -0,0 +1,49 @@
|
||||
#!/bin/sh
|
||||
# 2025-02-25
|
||||
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
echo "This script must be run as root" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CWD=/opt/docker/pterodactyl/scripts
|
||||
PTERODACTYL=$(realpath $CWD/../)
|
||||
|
||||
#
|
||||
# Choosen mode is to remove existing folders and symbolic links
|
||||
# to be able to recreate good ones.
|
||||
#
|
||||
|
||||
#
|
||||
# Remove existing settings
|
||||
#
|
||||
|
||||
if [ -L /var/lib/pterodactyl/volumes ]; then
|
||||
rm -f /var/lib/pterodactyl/volumes
|
||||
fi
|
||||
|
||||
if [ -L /var/log/pterodactyl ]; then
|
||||
rm -f /var/log/pterodactyl
|
||||
fi
|
||||
|
||||
if [ -L /tmp/pterodactyl ]; then
|
||||
rm -rf /tmp/pterodactyl
|
||||
fi
|
||||
|
||||
if [ -d /var/lib/pterodactyl ]; then
|
||||
rmdir /var/lib/pterodactyl
|
||||
fi
|
||||
|
||||
|
||||
# Create required settings
|
||||
mkdir -p /var/lib/pterodactyl
|
||||
ln -s $PTERODACTYL/datas/common/volumes /var/lib/pterodactyl/volumes
|
||||
ln -s $PTERODACTYL/datas/node/tmp /tmp/pterodactyl
|
||||
ln -s $PTERODACTYL/datas/node/logs /var/log/pterodactyl
|
||||
|
||||
# Adjust owner (user:group)
|
||||
chown -R 1000:1000 /var/lib/pterodactyl
|
||||
chown -R 1000:1000 /var/log/pterodactyl
|
||||
chown -R 1000:1000 /tmp/pterodactyl
|
||||
|
||||
exit 0
|
Reference in New Issue
Block a user