1
0
Fork 0
pomodoro/bash_scripts/info_references.sh
2023-12-30 23:37:18 +03:00

27 lines
1.3 KiB
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
echo "Обновление домена удалённого репозитория в перекрёстных ссылках в описаниях."
remote="git.org.ru" && source info_param.sh
# экранируем точки в названии домена
domain="${remote//"."/"\."}"
# название домена в верхнем регистре
DOMAIN="${domain^^}"
cd ../.. # выходим из папки и из репозитория
# обходим все репозитории, расположенные на одном уровне с текущим
find . -type f -name 'README*.md' | sort -r | while read -r file; do
echo "$remote => $file"
# сбрасываем значения параметров
sed -i 's/gitea\.com/tmp_stub/g' "$file"
sed -i 's/GITEA\.COM/TMP_STUB/g' "$file"
sed -i 's/git\.org\.ru/tmp_stub/g' "$file"
sed -i 's/GIT\.ORG\.RU/TMP_STUB/g' "$file"
sed -i 's/hub\.mos\.ru/tmp_stub/g' "$file"
sed -i 's/HUB\.MOS\.RU/TMP_STUB/g' "$file"
# устанавливаем значения параметров
sed -i 's/tmp_stub/'$domain'/g' "$file"
sed -i 's/TMP_STUB/'$DOMAIN'/g' "$file"
if [ "$remote" == "hub.mos.ru" ]; then
sed -i 's/src\/branch/blob/g' "$file"
else
sed -i 's/blob/src\/branch/g' "$file"
fi
done