feat: optimize project file structure

This commit is contained in:
DDSRem
2023-06-16 15:03:50 +08:00
parent 84c79024de
commit 7478b21b33
7 changed files with 9 additions and 9 deletions

View File

@@ -0,0 +1,14 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
function __old_compatible {
umask ${UMASK}
if [ -f /config/bangumi.json ]; then
mv /config/bangumi.json /app/data/bangumi.json
fi
}
__old_compatible 2>&1 | sed "s#^#cont-init: info: $(realpath $0): &#g"

View File

@@ -0,0 +1,13 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
function __fixuser {
groupmod -o -g "${PGID}" ab
usermod -o -u "${PUID}" ab
chown ab:ab -R /app /ab
}
__fixuser 2>&1 | sed "s#^#cont-init: info: $(realpath $0): &#g"

View File

@@ -0,0 +1,4 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
pkill -f 'python3 main.py'

View File

@@ -0,0 +1 @@
3

View File

@@ -0,0 +1,16 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
umask ${UMASK}
if [ -f /app/config/config.json ]; then
AB_PORT=$(jq '.program.webui_port' /app/config/config.json)
elif [ -f /app/config/config_dev.json ]; then
AB_PORT=$(jq '.program.webui_port' /app/config/config_dev.json)
else
AB_PORT=7892
fi
exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost ${AB_PORT}" \
cd /app s6-setuidgid ab python3 main.py