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
|
set -eu
|
||||||
|
|
||||||
PULL_BASE="https://adamgoldsmith.name/cgit"
|
PULL_BASE="https://git.adamgoldsmith.name"
|
||||||
PUSH_BASE="ag:/srv/git"
|
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() {
|
function do_get() {
|
||||||
target="$1"
|
target="$1"
|
||||||
@ -12,11 +25,7 @@ function do_get() {
|
|||||||
echo "$target already exists, not getting"
|
echo "$target already exists, not getting"
|
||||||
else
|
else
|
||||||
echo "Getting $target"
|
echo "Getting $target"
|
||||||
git clone "$PULL_BASE/dotfiles/$target.git" --recurse-submodules
|
git clone "$DOTFILES_PULL_BASE/$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 ..
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,6 +101,10 @@ do
|
|||||||
quiet=true
|
quiet=true
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--sync-urls)
|
||||||
|
sync_urls
|
||||||
|
exit
|
||||||
|
;;
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
@ -107,10 +120,9 @@ done
|
|||||||
|
|
||||||
if [ "$bootstrap" = true ]
|
if [ "$bootstrap" = true ]
|
||||||
then
|
then
|
||||||
git clone "$PULL_BASE/bootstrap.git" .dotfiles
|
git clone "$BOOTSTRAP_URL" .dotfiles
|
||||||
cd .dotfiles
|
cd .dotfiles
|
||||||
git remote set-url origin "$PULL_BASE/bootstrap.git"
|
git remote set-url origin "$BOOTSTRAP_URL"
|
||||||
git remote set-url --push origin "$PUSH_BASE/bootstrap.git"
|
|
||||||
else
|
else
|
||||||
cd "$(dirname ${BASH_SOURCE[0]})"
|
cd "$(dirname ${BASH_SOURCE[0]})"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user