mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-26 19:21:39 +00:00
cleanup + added modified init-adduser
This commit is contained in:
parent
39a79ec4b2
commit
30eaa32e05
5 changed files with 74 additions and 55 deletions
49
build/docker/root/etc/cont-init.d/10-adduser
Normal file
49
build/docker/root/etc/cont-init.d/10-adduser
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
#!/usr/bin/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
PUID=${AUDIOBOOKSHELF_UID:-1000}
|
||||||
|
PGID=${AUDIOBOOKSHELF_GID:-1000}
|
||||||
|
|
||||||
|
groupmod -o -g "$PGID" abc
|
||||||
|
usermod -o -u "$PUID" abc
|
||||||
|
|
||||||
|
echo '
|
||||||
|
-------------------------------------
|
||||||
|
|
||||||
|
█████╗ ██████╗ ███████╗
|
||||||
|
██╔══██╗██╔══██╗██╔════╝
|
||||||
|
███████║██████╔╝███████╗
|
||||||
|
██╔══██║██╔══██╗╚════██║
|
||||||
|
██║ ██║██████╔╝███████║
|
||||||
|
╚═╝ ╚═╝╚═════╝ ╚══════╝
|
||||||
|
|
||||||
|
https://audiobookshelf.org
|
||||||
|
|
||||||
|
-------------------------------------
|
||||||
|
GID/UID
|
||||||
|
-------------------------------------'
|
||||||
|
echo "
|
||||||
|
User uid: $(id -u abc)
|
||||||
|
User gid: $(id -g abc)
|
||||||
|
-------------------------------------
|
||||||
|
"
|
||||||
|
|
||||||
|
time32="$(date +%Y)"
|
||||||
|
|
||||||
|
if [[ "${time32}" == "1970" || "${time32}" == "1969" ]] && [ "$(uname -m)" == "armv7l" ]; then
|
||||||
|
echo '
|
||||||
|
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
|
||||||
|
Your DockerHost is running an outdated version of libseccomp
|
||||||
|
|
||||||
|
To fix this, please visit https://docs.linuxserver.io/faq#libseccomp
|
||||||
|
|
||||||
|
Apps will not behave correctly without this
|
||||||
|
|
||||||
|
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
'
|
||||||
|
sleep infinity
|
||||||
|
fi
|
||||||
|
|
||||||
|
chown abc:abc /app
|
||||||
|
chown abc:abc /defaults
|
||||||
15
build/docker/root/etc/cont-init.d/20-config
Normal file
15
build/docker/root/etc/cont-init.d/20-config
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/with-contenv bash
|
||||||
|
|
||||||
|
# folders
|
||||||
|
mkdir -p \
|
||||||
|
/metadata/ \
|
||||||
|
/config/ \
|
||||||
|
/audiobooks/ \
|
||||||
|
/podcasts/
|
||||||
|
|
||||||
|
# permissions
|
||||||
|
chown -R abc:abc \
|
||||||
|
/config \
|
||||||
|
/metadata \
|
||||||
|
/audiobooks \
|
||||||
|
/podcasts
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
#!/usr/bin/with-contenv bash
|
|
||||||
|
|
||||||
# make config & metadata folder
|
|
||||||
mkdir -p \
|
|
||||||
/config/ \
|
|
||||||
/metadata/
|
|
||||||
|
|
||||||
# chown config & metadata directories if currently not set to abc
|
|
||||||
if [[ -d /config ]] && [[ "$(stat -c '%U' /config)" != "abc" ]]; then
|
|
||||||
chown -R abc:abc /config/
|
|
||||||
elif [[ -d /metadata ]] && [[ "$(stat -c '%U' /metadata)" != "abc" ]]; then
|
|
||||||
chown -R abc:abc /metadata/
|
|
||||||
fi
|
|
||||||
9
build/docker/root/etc/services.d/audiobookshelf/finish
Normal file
9
build/docker/root/etc/services.d/audiobookshelf/finish
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ "$1" -eq 256 ]; then
|
||||||
|
e=$((128 + $2))
|
||||||
|
else
|
||||||
|
e="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$e" > /run/s6-linux-init-container-results/exitcode
|
||||||
|
|
@ -1,48 +1,7 @@
|
||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
|
|
||||||
|
|
||||||
## Changing ownership recursively on /config still threw ownership errors for some reason
|
|
||||||
files=(
|
|
||||||
"/config/"
|
|
||||||
"/audiobooks/"
|
|
||||||
"/podcasts/"
|
|
||||||
"/metadata/"
|
|
||||||
"/config/users/njodb.properties"
|
|
||||||
"/config/libraryItems/njodb.properties"
|
|
||||||
"/config/sessions/njodb.properties"
|
|
||||||
"/config/libraries/njodb.properties"
|
|
||||||
"/config/settings/njodb.properties"
|
|
||||||
"/config/collections/njodb.properties"
|
|
||||||
"/config/playlists/njodb.properties"
|
|
||||||
"/config/authors/njodb.properties"
|
|
||||||
"/config/series/njodb.properties"
|
|
||||||
"/config/feeds/njodb.properties"
|
|
||||||
"/config/libraryItems"
|
|
||||||
"/config/settings/data"
|
|
||||||
"/config/users/data"
|
|
||||||
"/config/authors/data"
|
|
||||||
"/config/libraries/data"
|
|
||||||
"/config/series/data"
|
|
||||||
"/config/settings/tmp"
|
|
||||||
"/config/users/tmp"
|
|
||||||
"/config/authors/tmp"
|
|
||||||
"/config/libraries/tmp"
|
|
||||||
"/config/settings/cache"
|
|
||||||
"/config/users/cache"
|
|
||||||
"/config/authors/cache"
|
|
||||||
"/config/libraries/cache"
|
|
||||||
)
|
|
||||||
|
|
||||||
for file in "${files[@]}"; do
|
|
||||||
if [[ -f "$file" ]] && [[ "$(stat -c '%U' "$file")" != "abc" ]]; then
|
|
||||||
chown abc:abc "$file"
|
|
||||||
elif [[ -d "$file" ]] && [[ "$(stat -c '%U' "$file")" != "abc" ]]; then
|
|
||||||
chown -R abc:abc "$file"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
PORT=${PORT:-80}
|
PORT=${PORT:-80}
|
||||||
|
|
||||||
exec \
|
exec \
|
||||||
s6-setuidgid abc npm --prefix /app/audiobookshelf/ --cache /app/audiobookshelf/ run start --port "${PORT}"
|
s6-setuidgid abc npm --prefix /app/audiobookshelf/ --cache /app/audiobookshelf/ start --port "${PORT}"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue