mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-10 09:51:02 +01:00
Automatic folders definition
https://github.com/alexbelgium/hassio-addons/issues/502
This commit is contained in:
31
unpackerr/rootfs/etc/cont-init.d/99-config.sh
Normal file
31
unpackerr/rootfs/etc/cont-init.d/99-config.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/bashio
|
||||
|
||||
# Set user
|
||||
if bashio::config_has.value 'PUID'; then PUID = "$(bashio::config 'PUID')"; fi
|
||||
if bashio::config_has.value 'PGID'; then PGID = "$(bashio::config 'PGID')"; fi
|
||||
|
||||
# Enable watch folder
|
||||
if bashio::config_has.value "watch_path"; then
|
||||
# Enables folders
|
||||
sed -i "/[[folder]]/c [[folder]]" /config/unpackerr.conf
|
||||
# Set downloads path
|
||||
sed -i "s|_path|_pth|g" /config/unpackerr.conf
|
||||
sed -i "/path =/c path = $(bashio::config 'watch_path')" /config/unpackerr.conf
|
||||
sed -i "s|_pth|_path|g" /config/unpackerr.conf
|
||||
# Make path
|
||||
mkdir -p "$(bashio::config 'watch_path')"
|
||||
# Set permission
|
||||
chown -R $PUID:$PGID "$(bashio::config 'watch_path')"
|
||||
fi
|
||||
|
||||
# Enable extraction folder
|
||||
if bashio::config_has.value "extraction_path"; then
|
||||
# Enables folders
|
||||
sed -i "/[[folder]]/c [[folder]]" /config/unpackerr.conf
|
||||
# Set extraction path
|
||||
sed -i "/extract_path =/c extract_path = $(bashio::config 'extraction_path')" /config/unpackerr.conf
|
||||
# Make path
|
||||
mkdir -p "$(bashio::config 'extraction_path')"
|
||||
# Set permission
|
||||
chown -R $PUID:$PGID "$(bashio::config 'extraction_path')"
|
||||
fi
|
||||
Reference in New Issue
Block a user