Merge branch 'patch-fix-updaterepourl' into 'master'

[scripts] Fix updateRepoURL

See merge request nullworks/cathook/cathook!1030
This commit is contained in:
BenCat07 2020-07-19 14:59:34 +00:00
commit 656a617e36

View File

@ -54,11 +54,10 @@ function init() {
# #
function updateRepoURL() { function updateRepoURL() {
local URL="$(curl --max-time 10 -Ls -o /dev/null -w %{url_effective} https://cathook.club/s/ch/git || echo error)" local URL="$(curl --max-time 10 -s -o /dev/null -w %{redirect_url} https://cathook.club/s/ch/git || echo error)"
local GIT_REMOTE=$(git config --get remote.origin.url || echo unknown) local GIT_REMOTE=$(git config --get remote.origin.url || echo unknown)
if [ "$URL" != "error" ] && [ "$GIT_REMOTE" != "$URL" ]; then if [ "$URL" != "error" ] && [ "$GIT_REMOTE" != "$URL" ]; then
git remote set-url origin "$URL" git remote set-url origin "$URL" && echo -e "\033[1;33m\n\nMigrations: Updated remote URL to new repo! Welcome to $URL!\n\n\033[0m" || :
echo -e "\033[1;33m\n\nMigrations: Updated remote URL to new repo! Welcome to $URL!\n\n\033[0m"
fi fi
} }