docker-ttrss/root/srv/update-ttrss.sh

80 lines
1.8 KiB
Bash
Raw Normal View History

#!/bin/sh
TTRSS_PATH=/var/www/ttrss
update_ttrss()
{
if [ -n "$TTRSS_GIT_TAG" ]; then
echo "Updating Tiny Tiny RSS disabled (using tag '$TTRSS_GIT_TAG')"
return
fi
echo "Updating: Tiny Tiny RSS"
( cd ${TTRSS_PATH} && git pull origin HEAD )
}
update_plugin_mobilize()
{
echo "Updating: Mobilize plugin"
( cd ${TTRSS_PATH}/plugins/mobilize && git pull origin HEAD )
2015-09-15 21:46:44 +02:00
# Patch ttrss-mobilize plugin for getting it to work.
sed -i -e "s/<?$/<?php/g" ${TTRSS_PATH}/plugins/mobilize/m.php
}
update_plugin_feediron()
{
echo "Updating: FeedIron"
( cd ${TTRSS_PATH}/plugins/feediron && git pull origin HEAD )
}
update_theme_feedly()
{
echo "Updating: Feedly theme"
( cd ${TTRSS_PATH}/themes/feedly-git && git pull origin HEAD )
# Link theme to TTRSS.
ln -f -s ${TTRSS_PATH}/themes/feedly-git/feedly ${TTRSS_PATH}/themes/feedly
ln -f -s ${TTRSS_PATH}/themes/feedly-git/feedly.css ${TTRSS_PATH}/themes/feedly.css
}
update_common()
{
if [ -z "$MY_ROOT_UID" ]; then
MY_ROOT_UID=0
fi
if [ -z "$MY_ROOT_GID" ]; then
MY_ROOT_GID=0
fi
echo "Updating: Updating permissions"
for CUR_DIR in /etc/nginx /etc/php7 /var/lib/nginx /etc/services.d; do
chown -R ${MY_ROOT_UID}:${MY_ROOT_GID} ${CUR_DIR}
done
chown -R www-data:www-data ${TTRSS_PATH}
echo "Updating: Updating permissions done"
}
update_ttrss
update_plugin_mobilize
update_plugin_feediron
update_theme_feedly
update_common
2015-09-15 22:38:26 +02:00
echo "Update: Done"
2015-09-15 22:38:26 +02:00
if [ "$1" != "--no-start" ]; then
echo "Update: Starting all ..."
2015-09-15 22:38:26 +02:00
fi
2015-09-15 22:38:26 +02:00
if [ "$1" = "--wait-exit" ]; then
UPDATE_WAIT_TIME=$2
if [ -z "$UPDATE_WAIT_TIME" ]; then
UPDATE_WAIT_TIME=24h # Default is to check every day (24 hours).
fi
echo "Update: Sleeping for $UPDATE_WAIT_TIME ..."
sleep ${UPDATE_WAIT_TIME}
fi