Skip to content

Commit

Permalink
remove unused code / silence linter
Browse files Browse the repository at this point in the history
  • Loading branch information
wiedehopf committed Apr 9, 2024
1 parent 3dbc4ff commit 2e72c9b
Showing 1 changed file with 2 additions and 67 deletions.
69 changes: 2 additions & 67 deletions rootfs/tar1090-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -363,72 +363,7 @@ do
done < <(echo "$instances")


if [[ $lighttpd == yes ]]; then
if lighttpd -tt -f /etc/lighttpd/lighttpd.conf 2>&1 | grep -i duplicate >/dev/null; then
mv -f /etc/lighttpd/conf-available/89-dump1090-fa.conf.dpkg-dist /etc/lighttpd/conf-available/89-dump1090-fa.conf &>/dev/null || true
fi

if ! grep -qs -E -e '^[^#]*"mod_alias"' /etc/lighttpd/lighttpd.conf /etc/lighttp/conf-enabled/* /etc/lighttpd/external.conf; then
echo 'server.modules += ( "mod_alias" )' > /etc/lighttpd/conf-available/07-mod_alias.conf
ln -s -f /etc/lighttpd/conf-available/07-mod_alias.conf /etc/lighttpd/conf-enabled/07-mod_alias.conf
else
rm -f /etc/lighttpd/conf-enabled/07-mod_alias.conf
fi

rm -f /etc/lighttpd/conf-available/87-mod_setenv.conf /etc/lighttpd/conf-enabled/87-mod_setenv.conf
while read -r FILE; do
sed -i -e 's/^server.modules.*mod_setenv.*/#\0/' "$FILE"
sed -i -e 's/^server.stat-cache-engine.*disable.*/#\0/' "$FILE"
done < <(find /etc/lighttpd/conf-available/* | grep -v setenv)

# add mod_setenv to lighttpd modules, check if it's one too much
echo 'server.modules += ( "mod_setenv" )' > /etc/lighttpd/conf-available/07-mod_setenv.conf
echo 'server.stat-cache-engine = "disable"' > /etc/lighttpd/conf-available/47-stat-cache.conf

ln -s -f /etc/lighttpd/conf-available/07-mod_setenv.conf /etc/lighttpd/conf-enabled/07-mod_setenv.conf
ln -s -f /etc/lighttpd/conf-available/47-stat-cache.conf /etc/lighttpd/conf-enabled/47-stat-cache.conf

if (( $(cat /etc/lighttpd/conf-enabled/* | grep -c -E -e '^server.stat-cache-engine *\= *"disable")') > 1 )); then
rm -f /etc/lighttpd/conf-enabled/47-stat-cache.conf
fi
if (( $(cat /etc/lighttpd/conf-enabled/* | grep -c -E -e '^server.modules.?\+=.?\(.?"mod_setenv".?\)') > 1 )); then
rm -f /etc/lighttpd/conf-available/07-mod_setenv.conf /etc/lighttpd/conf-enabled/07-mod_setenv.conf
fi

if lighttpd -tt -f /etc/lighttpd/lighttpd.conf 2>&1 | grep mod_setenv >/dev/null; then
rm -f /etc/lighttpd/conf-available/07-mod_setenv.conf /etc/lighttpd/conf-enabled/07-mod_setenv.conf
fi
if lighttpd -tt -f /etc/lighttpd/lighttpd.conf 2>&1 | grep stat-cache >/dev/null; then
rm -f /etc/lighttpd/conf-enabled/47-stat-cache.conf
fi

#lighttpd -tt -f /etc/lighttpd/lighttpd.conf && echo success || true
if lighttpd -tt -f /etc/lighttpd/lighttpd.conf 2>&1 | grep mod_setenv >/dev/null
then
rm -f /etc/lighttpd/conf-available/07-mod_setenv.conf /etc/lighttpd/conf-enabled/07-mod_setenv.conf
fi
#lighttpd -tt -f /etc/lighttpd/lighttpd.conf && echo success || true
if ! lighttpd -tt -f /etc/lighttpd/lighttpd.conf &>/dev/null; then
echo ----------------
echo "Lighttpd error, tar1090 will probably not work correctly:"
lighttpd -tt -f /etc/lighttpd/lighttpd.conf
fi

if grep -qs -e '^compress.cache-dir' /etc/lighttpd/lighttpd.conf; then
echo -----
echo "Disabling compress.cache-dir in /etc/lighttpd/lighttpd.conf due to often causing full disk issues as there is no automatic cleanup mechanism. Add a leading space to the compress.cache-dir line if you don't want tar1090 to mess with it in the future."
echo -----
sed -i -e 's$^compress.cache-dir.*$#\0 # disabled by tar1090, often causes full disk due to not having a cleanup mechanism$' /etc/lighttpd/lighttpd.conf
elif ! grep -qs -e 'disabled by tar1090' /etc/lighttpd/lighttpd.conf; then
sed -i -e 's$^compress.cache-dir.*$# CAUTION, enabling cache-dir and filetype json will cause full disk when using tar1090\n\0$' /etc/lighttpd/lighttpd.conf
fi
if grep -qs -e '^deflate.cache-dir' /etc/lighttpd/lighttpd.conf; then
echo -----
echo "Disabling deflate.cache-dir in /etc/lighttpd/lighttpd.conf due to often causing full disk issues as there is no automatic cleanup mechanism. Add a leading space to the deflate.cache-dir line if you don't want tar1090 to mess with it in the future."
echo -----
sed -i -e 's$^deflate.cache-dir.*$#\0 # disabled by tar1090, often causes full disk due to not having a cleanup mechanism$' /etc/lighttpd/lighttpd.conf
elif ! grep -qs -e 'disabled by tar1090' /etc/lighttpd/lighttpd.conf; then
sed -i -e 's$^deflate.cache-dir.*$# CAUTION, enabling cache-dir and filetype json will cause full disk when using tar1090\n\0$' /etc/lighttpd/lighttpd.conf
fi
if [[ $lighttpd == yes ]] || [[ $nginx == yes ]]; then
true
fi

0 comments on commit 2e72c9b

Please sign in to comment.