Update 02-script-setup.bash

pull/1/head
RandomNinjaAtk 5 years ago committed by GitHub
parent 8688a0463f
commit 3bff6d82df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,9 +3,10 @@
# Create scripts directory
if [ ! -d "/config/scripts" ]; then
mkdir -p "/config/scripts"
chmod 0777 "/config/scripts"
fi
# Remove existing LAD start script
# Remove existing AudioPostProcessing script
if [ -f "/config/scripts/AudioPostProcessing.bash" ]; then
rm "/config/scripts/AudioPostProcessing.bash"
sleep 0.1
@ -29,26 +30,41 @@ if [ ! -d "/downloads/complete" ]; then
chmod 0777 "/downloads/incomplete"
fi
if [ ! -f "/config/scripts/sab-config-updated" ]; then
# start cron
service cron start
if [ -f "/config/sabnzbd.ini" ]; then
# Add scripts path
if cat "/config/sabnzbd.ini" | grep "/config/scripts" | read; then
sleep 0.1
else
sed -i "s/script_dir = \"\"/script_dir = \"\/config\/scripts\"/g" "/config/sabnzbd.ini"
fi
# Correct incomplete path
if cat "/config/sabnzbd.ini" | grep "/downloads/incomplete" | read; then
sleep 0.1
else
sed -i "s/Downloads\/incomplete/\/downloads\/incomplete/g" "/config/sabnzbd.ini"
fi
# Correct complete path
if cat "/config/sabnzbd.ini" | grep "/downloads/complete" | read; then
sleep 0.1
else
sed -i "s/Downloads\/complete/\/downloads\/complete/g" "/config/sabnzbd.ini"
fi
# Enable script failure
if cat "/config/sabnzbd.ini" | grep "script_can_fail = 0" | read; then
sleep 0.1
else
sed -i "s/script_can_fail = 0/script_can_fail = 1/g" "/config/sabnzbd.ini"
fi
# Add radarr category
if cat "/config/sabnzbd.ini" | grep "\[\[radarr\]\]" | read; then
sleep 0.1
else
@ -63,6 +79,7 @@ if [ -f "/config/sabnzbd.ini" ]; then
echo "dir = radarr" >> "/config/sabnzbd.ini"
fi
# Add sonarr category
if cat "/config/sabnzbd.ini" | grep "\[\[sonarr\]\]" | read; then
sleep 0.1
else
@ -77,6 +94,7 @@ if [ -f "/config/sabnzbd.ini" ]; then
echo "dir = sonarr" >> "/config/sabnzbd.ini"
fi
# Add lidarr category
if cat "/config/sabnzbd.ini" | grep "\[\[lidarr\]\]" | read; then
sleep 0.1
else
@ -91,6 +109,12 @@ if [ -f "/config/sabnzbd.ini" ]; then
echo "dir = lidarr" >> "/config/sabnzbd.ini"
fi
if [ ! -f "/config/scripts/sab-config-updated" ]; then
touch "/config/scripts/sab-config-updated"
fi
fi
# start cron
service cron stop
fi
exit 0

Loading…
Cancel
Save