* perform all operations on git repositories under 'app' user

* initially clone master repo with --depth 1 to reduce first startup time
 * only check updates for actual git repos in plugins.local/
testing-php81
Andrew Dolgov 3 years ago
parent 95ac4a70f9
commit cc648eb878

@ -34,14 +34,18 @@ PSQL="psql -q -h $TTRSS_DB_HOST -U $TTRSS_DB_USER $TTRSS_DB_NAME"
if [ ! -d $DST_DIR/.git ]; then if [ ! -d $DST_DIR/.git ]; then
mkdir -p $DST_DIR mkdir -p $DST_DIR
chown -R $OWNER_UID:$OWNER_GID $DST_DIR
echo cloning tt-rss source from $SRC_REPO to $DST_DIR... echo cloning tt-rss source from $SRC_REPO to $DST_DIR...
git clone $SRC_REPO $DST_DIR || echo error: failed to clone master repository. sudo -u app git clone --depth 1 $SRC_REPO $DST_DIR || echo error: failed to clone master repository.
else else
echo updating tt-rss source in $DST_DIR from $SRC_REPO... echo updating tt-rss source in $DST_DIR from $SRC_REPO...
chown -R $OWNER_UID:$OWNER_GID $DST_DIR
cd $DST_DIR && \ cd $DST_DIR && \
git config core.filemode false && \ sudo -u app git config core.filemode false && \
git config pull.rebase false && \ sudo -u app git config pull.rebase false && \
git pull origin master || echo error: unable to update master repository. sudo -u app git pull origin master || echo error: unable to update master repository.
fi fi
if [ ! -e $DST_DIR/index.php ]; then if [ ! -e $DST_DIR/index.php ]; then
@ -51,26 +55,29 @@ fi
if [ ! -d $DST_DIR/plugins.local/nginx_xaccel ]; then if [ ! -d $DST_DIR/plugins.local/nginx_xaccel ]; then
echo cloning plugins.local/nginx_xaccel... echo cloning plugins.local/nginx_xaccel...
git clone https://git.tt-rss.org/fox/ttrss-nginx-xaccel.git \ sudo -u app git clone https://git.tt-rss.org/fox/ttrss-nginx-xaccel.git \
$DST_DIR/plugins.local/nginx_xaccel || echo warning: failed to clone nginx_xaccel. $DST_DIR/plugins.local/nginx_xaccel || echo warning: failed to clone nginx_xaccel.
else else
if [ -z "$TTRSS_NO_STARTUP_PLUGIN_UPDATES" ]; then if [ -z "$TTRSS_NO_STARTUP_PLUGIN_UPDATES" ]; then
echo updating all local plugins... echo updating all local plugins...
find $DST_DIR/plugins.local/ -maxdepth 1 -mindepth 1 -type d | while read PLUGIN; do find $DST_DIR/plugins.local/ -maxdepth 1 -mindepth 1 -type d | while read PLUGIN; do
if [ -d $PLUGIN/.git ]; then
echo updating $PLUGIN... echo updating $PLUGIN...
cd $PLUGIN && \ cd $PLUGIN && \
git config core.filemode false && \ sudo -u app git config core.filemode false && \
git config pull.rebase false && \ sudo -u app git config pull.rebase false && \
git pull origin master || echo warning: attempt to update plugin $PLUGIN failed. sudo -u app git pull origin master || echo warning: attempt to update plugin $PLUGIN failed.
fi
done done
else else
echo updating plugins.local/nginx_xaccel... echo updating plugins.local/nginx_xaccel...
cd $DST_DIR/plugins.local/nginx_xaccel && \ cd $DST_DIR/plugins.local/nginx_xaccel && \
git config core.filemode false && \ sudo -u app git config core.filemode false && \
git config pull.rebase false && \ sudo -u app git config pull.rebase false && \
git pull origin master || echo warning: attempt to update plugin nginx_xaccel failed. sudo -u app git pull origin master || echo warning: attempt to update plugin nginx_xaccel failed.
fi fi
fi fi

Loading…
Cancel
Save