diff --git a/root/etc/cont-init.d/32-sma-setup.bash b/root/etc/cont-init.d/32-sma-setup.bash index 458f414..146ce72 100644 --- a/root/etc/cont-init.d/32-sma-setup.bash +++ b/root/etc/cont-init.d/32-sma-setup.bash @@ -1,53 +1,37 @@ #!/usr/bin/with-contenv bash -# import new config, if does not exist -if [ ! -f "/config/scripts/configs/sonarr-pp.ini" ]; then - cp "/usr/local/sma/setup/autoProcess.ini.sample" "/config/scripts/configs/sonarr-pp.ini" && \ - # set permissions - chmod 0666 "/config/scripts/configs/sonarr-pp.ini" -fi - -# import new config, if does not exist -if [ ! -f "/config/scripts/configs/radarr-pp.ini" ]; then - cp "/usr/local/sma/setup/autoProcess.ini.sample" "/config/scripts/configs/radarr-pp.ini" && \ - # set permissions - chmod 0666 "/config/scripts/configs/radarr-pp.ini" -fi - -# Remove sonarr log -if [ -f "/config/scripts/logs/sonarr-pp.log" ]; then - rm "/config/scripts/logs/sonarr-pp.log" && \ +# Remove exisitng +if [ -d "/config/scripts/sma" ]; then + rm -rf "/config/scripts/sma" && \ sleep 0.1 fi -# Remove radarr log -if [ -f "/config/scripts/logs/radarr-pp.log" ]; then - rm "/config/scripts/logs/radarr-pp.log" && \ +if [ -d "/usr/local/sma/config" ]; then + rm -rf /usr/local/sma/config/* && \ sleep 0.1 fi -# create sonarr log -if [ ! -f "/config/scripts/logs/sonarr-pp.log" ]; then - touch "/config/scripts/logs/sonarr-pp.log" && \ - # set permissions - chmod 0666 "/config/scripts/logs/sonarr-pp.log" +# create config directory +if [ ! -d "/config/scripts/sma" ]; then + mkdir -p "/config/scripts/sma" && \ + chmod 0777 -R "/config/scripts/sma" fi -# create radarr log -if [ ! -f "/config/scripts/logs/radarr-pp.log" ]; then - touch "/config/scripts/logs/radarr-pp.log" && \ - # set permissions - chmod 0666 "/config/scripts/logs/radarr-pp.log" + +# import new config, if does not exist +if [ ! -f "/config/sma/autoProcess.ini" ]; then + cp "/usr/local/sma/setup/autoProcess.ini.sample" "/usr/local/sma/config/autoProcess.ini" fi -# Set ffmpeg/ffprobe location -sed -i "s/ffmpeg.exe/ffmpeg/g" "/config/scripts/configs/sonarr-pp.ini" -sed -i "s/ffprobe.exe/ffprobe/g" "/config/scripts/configs/sonarr-pp.ini" +# create sma log file +touch "/config/scripts/sma/sma.log" && \ -# Set ffmpeg/ffprobe location -sed -i "s/ffmpeg.exe/ffmpeg/g" "/config/scripts/configs/radarr-pp.ini" -sed -i "s/ffprobe.exe/ffprobe/g" "/config/scripts/configs/radarr-pp.ini" +# link sma log file +ln -s "/config/scripts/sma/sma.log" "/usr/local/sma/config/sma.log" && \ +# set permissions +chmod 0666 "/config/scripts/sma"/* chmod 0777 -R "/usr/local/sma" +chmod 0777 -R "/scripts" exit 0