forked from pterodactyl/daemon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the entrypoint script for setting sftp.enabled false
Move to use jq as my grep was failing.
- Loading branch information
Showing
1 changed file
with
6 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
#!/bin/ash | ||
## Ensure we are in /srv/daemon | ||
|
||
CORE_CHECK=$(grep -o '"enabled": false,' /srv/daemon/config/core.json) | ||
|
||
if [ $CORE_CHECK != '"enabled": false,' ]; then | ||
if [ $(cat /srv/daemon/config/core.json | jq -r '.sftp.enabled') == "null" ]; then | ||
echo -e "Updating config to enable sftp-server." | ||
sed -i 's/ "ip": "0.0.0.0",/ "ip": "0.0.0.0",\n "enabled": false,/g' /srv/daemon/config/core.json | ||
else | ||
cat /srv/daemon/config/core.json | jq '.sftp.enabled |= false' > /tmp/core | ||
cat /tmp/core > /srv/daemon/config/core.json | ||
elif [ $(cat /srv/daemon/config/core.json | jq -r '.sftp.enabled') == "false" ]; then | ||
echo -e "Config already set up for golang sftp server" | ||
else | ||
echo -e "You may have purposly set the sftp to true and that will fail." | ||
fi | ||
|
||
exec "$@" |