Revert "chmod +x scripts"

This reverts commit 3351e5b29c.
This commit is contained in:
Alexandre
2022-06-15 21:03:13 +02:00
parent 27bb72ef76
commit 42bef66f08
218 changed files with 9448 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
##################
# 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')
#clean data
sed -i '/IMPORTER_DIR/d' /data/config/papermerge.conf.py || true
#add data
sed -i "2 i\IMPORTER_DIR = \"$IMPORTDIR\"" /data/config/papermerge.conf.py
bashio::log.info "Import dir set to $IMPORTDIR"
##################
# CREATE FOLDERS #
##################
#if [ ! -d /data/config ]; then
# echo "Creating /config"
# mkdir -p /config
#fi
#chown -R abc:abc /config
if [ ! -d "$MEDIADIR" ]; then
echo "Creating $MEDIADIR"
mkdir -p "$MEDIADIR"
fi
chown -R abc:abc "$MEDIADIR"
if [ ! -d "$IMPORTDIR" ]; then
echo "Creating $IMPORTDIR"
mkdir -p "$IMPORTDIR"
fi
chown -R abc:abc "$IMPORTDIR"
##################
# CONFIGURE IMAP #
##################
IMAPHOST=$(bashio::config 'imaphost')
IMAPUSERNAME=$(bashio::config 'imapusername')
IMAPPASSWORD=$(bashio::config 'imappassword')
if [ "$IMAPHOST" != "null" ]; then
printf "\nIMPORT_MAIL_HOST = \"%s\"" "$IMAPHOST" >> /data/config/papermerge.conf.py
bashio::log.info "IMPORT_MAIL_HOST set to $IMAPHOST"
if [ "$IMAPUSERNAME" != "null" ]; then
printf "\nIMPORT_MAIL_USER = \"%s\"" "$IMAPUSERNAME" >> /data/config/papermerge.conf.py
bashio::log.info "IMPORT_MAIL_USER set to $IMAPUSERNAME"
else
bashio::log.info "! IMAPHOST has been set, but no IMAPUSERNAME. Please check your configuration!"
fi
if [ "$IMAPPASSWORD" != "null" ]; then
printf "\nIMPORT_MAIL_PASS = \"%s\"" "$IMAPPASSWORD" >> /data/config/papermerge.conf.py
IMAPPASSWORDMASKED=$(echo "$IMAPPASSWORD" | sed -r 's/./x/g')
bashio::log.info "IMPORT_MAIL_PASS set to $IMAPPASSWORDMASKED"
else
bashio::log.info "! IMAPHOST has been set, but no IMAPPASSWORD. Please check your configuration!"
fi
fi