Files
hassio-addons/papermerge/rootfs/etc/cont-init.d/99-configuration
2021-10-18 22:25:22 +02:00

41 lines
928 B
Plaintext

#!/usr/bin/with-contenv bashio
##################
# SELECT FOLDERS #
##################
#Set media dir
MEDIADIR=$(bashio::config 'storage_dir')
#clean data
sed -i '/MEDIA_DIR/d' /data/config/papermerge.conf.py
#add data
sed -i "2 i\MEDIA_DIR = $MEDIADIR" /data/config/papermerge.conf.py
bashio::log.info "Storage dir set to $MEDIADIR"
#Set import dir
IMPORTDIR="$(bashio::config 'import_dir')"
sed -i "2 i\export IMPORTER_DIR=$IMPORTDIR" /etc/services.d/papermerge/run
bashio::log.info "Import dir set to $IMPORTDIR"
##################
# CREATE FOLDERS #
##################
if [ ! -d /config ]; then
echo "Creating /config"
mkdir -p /config
chown -R abc:abc /config
fi
if [ ! -d $MEDIADIR ]; then
echo "Creating $MEDIADIR"
mkdir -p $MEDIADIR
chown -R abc:abc $MEDIADIR
fi
if [ ! -d $IMPORTDIR ]; then
echo "Creating $IMPORTDIR"
mkdir -p $IMPORTDIR
chown -R abc:abc $IMPORTDIR
fi