Update 33-script-setup.bash

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

@ -12,14 +12,12 @@ if [ ! -f "/config/scripts/video-pp.bash" ]; then
chmod 0777 "/config/scripts/video-pp.bash"
fi
if [ ! -f "/config/scripts/sab-config-updated" ]; then
if [ ! -f "/config/sabnzbd.ini" ]; then
# start cron
service cron start
if [ -f "/config/sabnzbd.ini" ]; then
if cat "/config/sabnzbd.ini" | grep "\[categories\]" | read; then
if cat "/config/sabnzbd.ini" | grep "\[\[radarr\]\]" | read; then
sleep 0.1
else
exit 0
fi
# Add scripts path
if cat "/config/sabnzbd.ini" | grep "script_dir = \"\"" | read; then
sed -i "s/script_dir = \"\"/script_dir = \"\/config\/scripts\"/g" "/config/sabnzbd.ini"
@ -40,18 +38,18 @@ if [ ! -f "/config/scripts/sab-config-updated" ]; then
sed -i "s/script_can_fail = 0/script_can_fail = 1/g" "/config/sabnzbd.ini"
fi
# remove software category
if cat "/config/sabnzbd.ini" | grep "\[\[software\]\]" | read; then
sleep 0.1
else
sed -i '/\[\[software\]\]/,+7d' "/config/sabnzbd.ini"
# Enable permissions failure
if cat "/config/sabnzbd.ini" | grep "permissions = \"\"" | read; then
sed -i "s/permissions = \"\"/permissions = \"766\"/g" "/config/sabnzbd.ini"
fi
# Add radarr category
if cat "/config/sabnzbd.ini" | grep "\[\[radarr\]\]" | read; then
if cat "/config/sabnzbd.ini" | grep "\[categories\]" | read; then
sleep 0.1
else
sed -i '/\[\[movies\]\]/,+7d' "/config/sabnzbd.ini" && \
# Add categories
echo "[categories]" >> "/config/sabnzbd.ini" && \
# Add radarr category
echo "[[radarr]]" >> "/config/sabnzbd.ini" && \
echo "priority = -100" >> "/config/sabnzbd.ini" && \
echo "pp = \"\"" >> "/config/sabnzbd.ini" && \
@ -59,13 +57,9 @@ if [ ! -f "/config/scripts/sab-config-updated" ]; then
echo "script = video-pp.bash" >> "/config/sabnzbd.ini" && \
echo "newzbin = \"\"" >> "/config/sabnzbd.ini" && \
echo "order = 1" >> "/config/sabnzbd.ini" && \
echo "dir = radarr" >> "/config/sabnzbd.ini"
fi
echo "dir = radarr" >> "/config/sabnzbd.ini" && \
# Add sonarr category
if cat "/config/sabnzbd.ini" | grep "\[\[sonarr\]\]" | read; then
sleep 0.1
else
sed -i '/\[\[tv\]\]/,+7d' "/config/sabnzbd.ini" && \
echo "[[sonarr]]" >> "/config/sabnzbd.ini" && \
echo "priority = -100" >> "/config/sabnzbd.ini" && \
@ -74,14 +68,9 @@ if [ ! -f "/config/scripts/sab-config-updated" ]; then
echo "script = video-pp.bash" >> "/config/sabnzbd.ini" && \
echo "newzbin = \"\"" >> "/config/sabnzbd.ini" && \
echo "order = 2" >> "/config/sabnzbd.ini" && \
echo "dir = sonarr" >> "/config/sabnzbd.ini"
fi
echo "dir = sonarr" >> "/config/sabnzbd.ini" && \
# Add lidarr category
if cat "/config/sabnzbd.ini" | grep "\[\[lidarr\]\]" | read; then
sleep 0.1
else
sed -i '/\[\[audio\]\]/,+7d' "/config/sabnzbd.ini" && \
echo "[[lidarr]]" >> "/config/sabnzbd.ini" && \
echo "priority = -100" >> "/config/sabnzbd.ini" && \
echo "pp = \"\"" >> "/config/sabnzbd.ini" && \
@ -92,16 +81,16 @@ if [ ! -f "/config/scripts/sab-config-updated" ]; then
echo "dir = lidarr" >> "/config/sabnzbd.ini"
fi
if [ ! -f "/config/scripts/sab-config-updated" ]; then
touch "/config/scripts/sab-config-updated" && \
chmod 0666 "/config/scripts/sab-config-updated"
fi
fi
fi
fi
if [ -f "/config/scripts/sab-config-updated" ]; then
if cat "/config/sabnzbd.ini" | grep "\[\[software\]\]" | read; then
sed -i '/\[\[software\]\]/,+7d' "/config/sabnzbd.ini" && \
sed -i '/\[\[audio\]\]/,+7d' "/config/sabnzbd.ini" && \
sed -i '/\[\[tv\]\]/,+7d' "/config/sabnzbd.ini" && \
sed -i '/\[\[movies\]\]/,+7d' "/config/sabnzbd.ini" && \
# stop cron
service cron stop
else
# start cron
service cron start
fi
fi
exit 0

Loading…
Cancel
Save