diff options
| author | Greg <supahgreg@users.noreply.github.com> | 2025-10-08 11:12:24 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-08 11:12:24 -0500 |
| commit | bb1fd07149bd72afc953528a5b7d996678c06361 (patch) | |
| tree | 6cf23cb4dc8326c1eff5c70d38f4f0bac5849ee8 /.docker/app/startup.sh | |
| parent | 68d3a196a7d350143efab17332098ea3ff6e85f4 (diff) | |
| parent | 0da3839fcb9e8a943c9e55d33966a381163efa27 (diff) | |
Merge pull request #13 from tt-rss/feature/migrate-plugins-legacy-origin
Migrate update source for 'official' plugins cloned from 'tt-rss.org' git to GitHub
Diffstat (limited to '.docker/app/startup.sh')
| -rw-r--r-- | .docker/app/startup.sh | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/.docker/app/startup.sh b/.docker/app/startup.sh index fd0569e21..df730c336 100644 --- a/.docker/app/startup.sh +++ b/.docker/app/startup.sh @@ -83,10 +83,41 @@ if [ -z "$TTRSS_NO_STARTUP_PLUGIN_UPDATES" ]; then if [ -d $PLUGIN/.git ]; then echo updating $PLUGIN... - cd $PLUGIN && \ - sudo -u app git config core.filemode false && \ - sudo -u app git config pull.rebase false && \ - sudo -u app git pull origin main || sudo -u app git pull origin master || echo warning: attempt to update plugin $PLUGIN failed. + cd $PLUGIN + + # Unless disallowed, migrate plugins in 'plugins.local' that were pulling from repos on tt-rss.org to their GitHub equivalent. + if [ -z "$SKIP_LEGACY_ORIGIN_REPLACE" ]; then + ORIGIN_URL=$(sudo -u app git config --get remote.origin.url) + + case "$ORIGIN_URL" in + https://git.tt-rss.org/fox/ttrss-*.git) + NEW_ORIGIN_URL="https://github.com/tt-rss/tt-rss-plugin-${ORIGIN_URL#'https://git.tt-rss.org/fox/ttrss-'}" + ;; + https://gitlab.tt-rss.org/tt-rss/plugins/ttrss-*.git) + NEW_ORIGIN_URL="https://github.com/tt-rss/tt-rss-plugin-${ORIGIN_URL#'https://gitlab.tt-rss.org/tt-rss/plugins/ttrss-'}" + ;; + *) + NEW_ORIGIN_URL="" + ;; + esac + + if [ -n "$NEW_ORIGIN_URL" ]; then + if [ $(sudo -u app git branch --show-current) = "master" ]; then + echo "Migrating origin remote from ${ORIGIN_URL} to ${NEW_ORIGIN_URL}" + sudo -u app git remote set-url origin "$NEW_ORIGIN_URL" + sudo -u app git branch -m master main + sudo -u app git fetch origin + sudo -u app git branch --set-upstream-to origin/main main + sudo -u app git remote set-head origin --auto + else + echo "Skipping migration of origin remote from ${ORIGIN_URL} to ${NEW_ORIGIN_URL} (local branch is not 'master')" + fi + fi + fi + + sudo -u app git config core.filemode false && \ + sudo -u app git config pull.rebase false && \ + sudo -u app git pull origin main || sudo -u app git pull origin master || echo warning: attempt to update plugin $PLUGIN failed. fi done else |