diff options
| -rw-r--r-- | README.md | 2 | ||||
| -rwxr-xr-x | scripts/gitrepos.sh | 6 | ||||
| -rwxr-xr-x | scripts/post-install.sh | 117 |
3 files changed, 73 insertions, 52 deletions
@@ -103,7 +103,7 @@ Every field has a default. Set only what you want to change. The config covers: - `DESKTOP_ENV`: `dwm`, `hyprland`, or `none` - `DWM_REPO`, `DMENU_REPO`, `ST_REPO`, `SLOCK_REPO`, `DOTEMACS_REPO`, `ARCHSETUP_REPO`: Git URLs for the suckless tools, the Emacs config, and this repo -> **Forking note:** The upstream defaults point at the original author's personal Git server and assume a particular username. If you're adapting this for yourself, override the `*_REPO` variables in `archsetup.conf` to point at your own forks. Also review `scripts/post-install.sh` and `scripts/gitrepos.sh` — they clone personal repositories you won't want. The `archsetup` header, `init`'s temporary root password, and a handful of dotfiles (`.gitconfig`, `.ssh/config`, etc.) also carry author-specific values. +> **Forking note:** The upstream defaults point at the original author's personal Git server and assume a particular username. If you're adapting this for yourself, override the `*_REPO` variables in `archsetup.conf` to point at your own forks. Also review `scripts/post-install.sh` — it clones personal repositories you won't want. The `archsetup` header, `init`'s temporary root password, and a handful of dotfiles (`.gitconfig`, `.ssh/config`, etc.) also carry author-specific values. ## Dotfile Management diff --git a/scripts/gitrepos.sh b/scripts/gitrepos.sh deleted file mode 100755 index a3df4d4..0000000 --- a/scripts/gitrepos.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -# cjennings -# replaces original http remote repositories with git ones - -cd ~/.emacs.d && git remote remove origin && git remote add origin git@cjennings.net:dotemacs.git && git pull --set-upstream origin main -cd ~/.dotfiles && git remote remove origin && git remote add origin git@cjennings.net:dotfiles.git && git pull --set-upstream origin main diff --git a/scripts/post-install.sh b/scripts/post-install.sh index c3d1022..f184d9d 100755 --- a/scripts/post-install.sh +++ b/scripts/post-install.sh @@ -1,59 +1,86 @@ #!/bin/sh logfile="$HOME/post-install.log" -touch $logfile +touch "$logfile" echo "fixing perms on gpg directory" { - chown -R $(whoami) ~/.gnupg/ - find ~/.gnupg -type f -exec chmod 600 {} \; - find ~/.gnupg -type d -exec chmod 700 {} \; -} >> $logfile 2>&1 + chown -R "$(whoami)" "$HOME/.gnupg/" + find "$HOME/.gnupg" -type f -exec chmod 600 {} \; + find "$HOME/.gnupg" -type d -exec chmod 700 {} \; +} >> "$logfile" 2>&1 echo "fixing remote repositories" { - cd ~/.dotfiles && \ - git remote remove origin && \ - git remote add origin git@cjennings.net:dotfiles.git - - cd ~/.emacs.d && \ - git remote remove origin && \ - git remote add origin git@cjennings.net:dotemacs.git -} + for entry in \ + "$HOME/.dotfiles:git@cjennings.net:dotfiles.git" \ + "$HOME/.emacs.d:git@cjennings.net:dotemacs.git" + do + dir="${entry%%:*}" + url="${entry#*:}" + if [ ! -d "$dir/.git" ]; then + echo "skip: $dir is not a git checkout" + continue + fi + if git -C "$dir" remote | grep -qx origin; then + git -C "$dir" remote set-url origin "$url" + else + git -C "$dir" remote add origin "$url" + fi + git -C "$dir" pull --set-upstream origin main || true + done +} >> "$logfile" 2>&1 echo "cloning git repos" { - git clone cjennings@cjennings.net:git/org.git ~/sync/org - git clone --depth 1 cjennings@cjennings.net:git/wallpaper.git ~/pictures/wallpaper - git clone git@cjennings.net:dwm.git ~/code/dwm - git clone git@cjennings.net:dmenu.git ~/code/dmenu - git clone git@cjennings.net:st.git ~/code/st - git clone git@cjennings.net:slock.git ~/code/slock - git clone git@cjennings.net:pinentry-dmenu.git ~/code/pinentry-dmenu - - git clone git@github.com:cjennings/pocketbook.git ~/code/pocketbook - git clone cjennings@cjennings.net:git/bsdsetup.git ~/code/bsdsetup - git clone git@cjennings.net:git/archsetup.git ~/code/archsetup - git clone git@cjennings.net:dotemacs.git ~/code/dotemacs - - git clone cjennings@cjennings.net:git/wttrin.git ~/code/wttrin.git - git clone cjennings@cjennings.net:git/rsyncshot.git ~/code/rsyncshot.git - - git clone cjennings@cjennings.net:git/exercism.git ~/code/exercism - git clone cjennings@cjennings.net:git/elisp.git ~/code/elisp - git clone cjennings@cjennings.net:git/clisp.git ~/code/clisp - git clone cjennings@cjennings.net:git/lcthw.git ~/code/lcthw - git clone cjennings@cjennings.net:git/100dayspython.git ~/code/100dayspython - - git clone cjennings@cjennings.net:git/documents.git ~/projects/documents - git clone cjennings@cjennings.net:git/kit.git ~/projects/kit - git clone cjennings@cjennings.net:git/clipper.git ~/projects/clipper - git clone cjennings@cjennings.net:git/finances.git ~/projects/finances - git clone cjennings@cjennings.net:git/nasbuild.git ~/projects/nasbuild - git clone cjennings@cjennings.net:git/nextjob.git ~/projects/nextjob - git clone cjennings@cjennings.net:git/elibrary.git ~/projects/elibrary - git clone cjennings@cjennings.net:git/danneel-hoa.git ~/projects/danneel-hoa - git clone cjennings@cjennings.net:git/danneel-remodel.git ~/projects/danneel-remodel -} >> $logfile 2>&1 + mkdir -p "$HOME/sync" "$HOME/pictures" "$HOME/code" "$HOME/projects" + + clone_if_missing() { + _remote="$1" + _dest="$2" + _depth="${3:-}" + if [ -e "$_dest" ]; then + echo "skip: $_dest already exists" + return 0 + fi + if [ -n "$_depth" ]; then + git clone --depth "$_depth" "$_remote" "$_dest" + else + git clone "$_remote" "$_dest" + fi + } + + clone_if_missing cjennings@cjennings.net:git/org.git "$HOME/sync/org" + clone_if_missing cjennings@cjennings.net:git/wallpaper.git "$HOME/pictures/wallpaper" 1 + clone_if_missing git@cjennings.net:dwm.git "$HOME/code/dwm" + clone_if_missing git@cjennings.net:dmenu.git "$HOME/code/dmenu" + clone_if_missing git@cjennings.net:st.git "$HOME/code/st" + clone_if_missing git@cjennings.net:slock.git "$HOME/code/slock" + clone_if_missing git@cjennings.net:pinentry-dmenu.git "$HOME/code/pinentry-dmenu" + + clone_if_missing git@github.com:cjennings/pocketbook.git "$HOME/code/pocketbook" + clone_if_missing cjennings@cjennings.net:git/bsdsetup.git "$HOME/code/bsdsetup" + clone_if_missing git@cjennings.net:git/archsetup.git "$HOME/code/archsetup" + clone_if_missing git@cjennings.net:dotemacs.git "$HOME/code/dotemacs" + + clone_if_missing cjennings@cjennings.net:git/wttrin.git "$HOME/code/wttrin.git" + clone_if_missing cjennings@cjennings.net:git/rsyncshot.git "$HOME/code/rsyncshot.git" + + clone_if_missing cjennings@cjennings.net:git/exercism.git "$HOME/code/exercism" + clone_if_missing cjennings@cjennings.net:git/elisp.git "$HOME/code/elisp" + clone_if_missing cjennings@cjennings.net:git/clisp.git "$HOME/code/clisp" + clone_if_missing cjennings@cjennings.net:git/lcthw.git "$HOME/code/lcthw" + clone_if_missing cjennings@cjennings.net:git/100dayspython.git "$HOME/code/100dayspython" + + clone_if_missing cjennings@cjennings.net:git/documents.git "$HOME/projects/documents" + clone_if_missing cjennings@cjennings.net:git/kit.git "$HOME/projects/kit" + clone_if_missing cjennings@cjennings.net:git/clipper.git "$HOME/projects/clipper" + clone_if_missing cjennings@cjennings.net:git/finances.git "$HOME/projects/finances" + clone_if_missing cjennings@cjennings.net:git/nasbuild.git "$HOME/projects/nasbuild" + clone_if_missing cjennings@cjennings.net:git/nextjob.git "$HOME/projects/nextjob" + clone_if_missing cjennings@cjennings.net:git/elibrary.git "$HOME/projects/elibrary" + clone_if_missing cjennings@cjennings.net:git/danneel-hoa.git "$HOME/projects/danneel-hoa" + clone_if_missing cjennings@cjennings.net:git/danneel-remodel.git "$HOME/projects/danneel-remodel" +} >> "$logfile" 2>&1 printf "\n\nDone.\n\n" |
