Update source URLs, add --sync-urls
flag/function
This commit is contained in:
parent
6ca107babf
commit
97b399681e
32
dup
32
dup
@ -2,8 +2,21 @@
|
||||
|
||||
set -eu
|
||||
|
||||
PULL_BASE="https://adamgoldsmith.name/cgit"
|
||||
PUSH_BASE="ag:/srv/git"
|
||||
PULL_BASE="https://git.adamgoldsmith.name"
|
||||
DOTFILES_PULL_BASE="${PULL_BASE}/dotfiles"
|
||||
BOOTSTRAP_URL="${PULL_BASE}/adam/bootstrap.git"
|
||||
|
||||
function sync_urls() {
|
||||
cd "$(dirname ${BASH_SOURCE[0]})"
|
||||
git remote set-url origin "$BOOTSTRAP_URL"
|
||||
git remote set-url --push --delete origin '.*' || true
|
||||
|
||||
for dir in */
|
||||
do
|
||||
git -C "$dir" remote set-url origin "$DOTFILES_PULL_BASE/${dir%/}.git"
|
||||
git -C "$dir" remote set-url --push --delete origin '.*' || true
|
||||
done
|
||||
}
|
||||
|
||||
function do_get() {
|
||||
target="$1"
|
||||
@ -12,11 +25,7 @@ function do_get() {
|
||||
echo "$target already exists, not getting"
|
||||
else
|
||||
echo "Getting $target"
|
||||
git clone "$PULL_BASE/dotfiles/$target.git" --recurse-submodules
|
||||
cd $target
|
||||
git remote set-url origin "$PULL_BASE/dotfiles/$target.git"
|
||||
git remote set-url --push origin "$PUSH_BASE/dotfiles/$target.git"
|
||||
cd ..
|
||||
git clone "$DOTFILES_PULL_BASE/$target.git" --recurse-submodules
|
||||
fi
|
||||
}
|
||||
|
||||
@ -92,6 +101,10 @@ do
|
||||
quiet=true
|
||||
shift
|
||||
;;
|
||||
--sync-urls)
|
||||
sync_urls
|
||||
exit
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
@ -107,10 +120,9 @@ done
|
||||
|
||||
if [ "$bootstrap" = true ]
|
||||
then
|
||||
git clone "$PULL_BASE/bootstrap.git" .dotfiles
|
||||
git clone "$BOOTSTRAP_URL" .dotfiles
|
||||
cd .dotfiles
|
||||
git remote set-url origin "$PULL_BASE/bootstrap.git"
|
||||
git remote set-url --push origin "$PUSH_BASE/bootstrap.git"
|
||||
git remote set-url origin "$BOOTSTRAP_URL"
|
||||
else
|
||||
cd "$(dirname ${BASH_SOURCE[0]})"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user