chore(yadm): update README and add post-clone bootstrap script

Signed-off-by: Andrei Jiroh Halili <ajhalili2006@andreijiroh.eu.org>
This commit is contained in:
Andrei Jiroh Halili 2023-12-16 10:51:57 +08:00
parent fddff5a696
commit 738b7684cb
No known key found for this signature in database
GPG key ID: 67BFC91B3DA12BE8
2 changed files with 26 additions and 4 deletions

View file

@ -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
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

View file

@ -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 <clone-url-above>` will
scream some errors when attempt to do so after creating a user with their own home directory.