diff --git a/.config/yadm/bootstrap.d/00-post-clone-repo.sh b/.config/yadm/bootstrap.d/00-post-clone-repo.sh index 8f34be9..827a8d8 100755 --- a/.config/yadm/bootstrap.d/00-post-clone-repo.sh +++ b/.config/yadm/bootstrap.d/00-post-clone-repo.sh @@ -1,9 +1,15 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash -if [ ! -d "$HOME/.git" ]; then +set -x + +if [ ! -d "$HOME/.git" ] && [ -d "$HOME/.local/share/yadm/repo.git" ]; then echo "Symlinking ~/.git to ~/.local/share/yadm/repo.git for compatibility" ln -s ~/.local/share/yadm/repo.git ~/.git +elif [ -d "$HOME/.git" ] && [ ! -d "$HOME/.local/share/yadm/repo.git" ]; then + echo "Symlinking ~/.local/share/yadm/repo.git to ~/.git for compatibility" + ln -s ~/.git ~/.local/share/yadm/repo.git fi -git remote set-url origin ssh://git@mau.dev/andreijiroh.dev/dotfiles -git remote add hut ssh://git@git.sr.ht/~ajhalili2006/dotfiles \ No newline at end of file +echo "Setting git remote URLs to SSH" +git remote set-url origin ssh://git@mau.dev/andreijiroh.dev/dotfiles || true +git remote set-url hut ssh://git@git.sr.ht/~ajhalili2006/dotfiles || true diff --git a/README.md b/README.md index 50683fc..ace3c1d 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,22 @@ to how mirroring work and usualy pushed there first) ## Setup +### With yadm + +```shell +# on a Alpine Linux sandbox VM (or chroot) +apk add yadm git gnupg + +yadm clone https://mau.dev/andreijiroh.dev/dotfiles +yadm restore --staged $HOME +yadm checkout -- $HOME + +# run the bootstrap script +yadm bootstrap +``` + +### Without yadm + It's easy, although this will be different because `git clone ` will scream some errors when attempt to do so after creating a user with their own home directory.