diff --git a/root/etc/cont-init.d/80-sma-link.bash b/root/etc/cont-init.d/80-sma-link.bash new file mode 100644 index 0000000..6f2c05f --- /dev/null +++ b/root/etc/cont-init.d/80-sma-link.bash @@ -0,0 +1,38 @@ +#!/usr/bin/with-contenv bash + +# create config directory +if [ ! -d "/config/scripts/sma" ]; then + mkdir -p "/config/scripts/sma" && \ + chmod 0777 -R "/config/scripts/sma" +fi + +# import new config, if does not exist +if [ ! -f "/config/scripts/sma/autoProcess.ini" ]; then + cp "/usr/local/sma/setup/autoProcess.ini.sample" "/config/scripts/sma/autoProcess.ini" +fi + +# link config file for use +if [ ! -f "/usr/local/sma/scripts/config/autoProcess.ini" ]; then + ln -s "/config/scripts/sma/autoProcess.ini" "/usr/local/sma/config/autoProcess.ini" +fi + +# remove sickbeard_mp4_automator log if exists +if [ -f "/var/log/sma.log" ]; then + rm "/var/log/sma.log" +fi + +# remove sickbeard_mp4_automator log from sma config folder if exists +if [ -f "/config/sma/sma.log" ]; then + rm "/config/sma/sma.log" +fi + +# create sma log file +touch "/config/scripts/sma/sma.log" && \ + +# link sma log file +ln -s "/config/scripts/sma/sma.log" "/var/log/sma.log" && \ + +# set permissions +chmod 0666 "/config/sma"/* + +exit 0