diff options
-rwxr-xr-x | .config/yadm/bootstrap | 70 | ||||
-rwxr-xr-x | .config/yadm/install-arch | 6 | ||||
-rw-r--r-- | .profile | 2 |
3 files changed, 63 insertions, 15 deletions
diff --git a/.config/yadm/bootstrap b/.config/yadm/bootstrap index 9a03f58..57461bc 100755 --- a/.config/yadm/bootstrap +++ b/.config/yadm/bootstrap @@ -1,26 +1,74 @@ #!/bin/sh +TIMESTART="$(date +%s)" . "$HOME/.profile" +unset LANG # do not display custom locale in TTY + +begintask() { + printf '%s ...' "$1" +} +endtask() { + EXIT_CODE=$? + [ $EXIT_CODE -eq 0 ] && echo ' OK' || echo ' ERROR' + return $EXIT_CODE +} +s() { # s for silent + "$@" 1> /dev/null 2> /dev/null +} # ensure required packages are installed -"$XDG_CONFIG_HOME/yadm/install-arch" +begintask "installing packages" +"$XDG_CONFIG_HOME/yadm/install-arch" > pkgs.log 2>&1 +endtask +[ $? -eq 0 ] && rm -f pkgs.log || echo " (saved output to pkgs.log)" + +begintask "render templated files" +s yadm alt +endtask -# generate templated files -yadm alt +begintask "ensure dynamic theme files" +s ~/.local/share/bin/mode dark +endtask -# create remaining dynamic theme files -~/.local/share/bin/mode dark +begintask "tidy up repository files" +s yadm reflog expire --expire-unreachable=now --all &&\ +s yadm gc --prune=now +endtask -# remove unreachable blobs -yadm reflog expire --expire-unreachable=now --all -yadm gc --prune=now +[ -e "$HOME/readme.md" ] ||\ +[ $(yadm status -s "$HOME/readme.md" | wc -l) -gt 0 ] && ( + begintask "removing readme.md from home" + cd + rm -f readme.md &&\ + yadm update-index --skip-worktree readme.md + endtask +) -# download and build st (terminal) if not present ! command -v st > /dev/null && [ ! -e ~/.local/st ] && ( + begintask "building st (terminal) from source" mkdir -p ~/.local cd ~/.local - git clone https://git.pipeframe.xyz/lonkaars/st + s git clone --depth 1 https://git.pipeframe.xyz/lonkaars/st cd st - make -j + s make -j + endtask +) + +[ "$(find ~/.ssh -name 'id*' | wc -l)" -eq 0 ] && ( + begintask "generating ssh keys" + s ssh-keygen -q -N "" < /dev/zero + endtask ) # TODO: create a second repository for system configuration in /etc + +TIMESTOP="$(date +%s)" +cat << EOF + +bootstrap finished in $(( $TIMESTOP - $TIMESTART ))s! + +follow-up steps to finish setup: + - install GPG keys + - install fonts + - make the switch to microsoft edge + +EOF diff --git a/.config/yadm/install-arch b/.config/yadm/install-arch index 1246dae..e546c92 100755 --- a/.config/yadm/install-arch +++ b/.config/yadm/install-arch @@ -1,13 +1,13 @@ #!/bin/sh # ensure we are running on arch linux -[ ! -e /etc/os-release ] && exit +[ ! -e /etc/os-release ] && exit 0 . /etc/os-release -[ "$ID" != 'arch' ] && exit +[ "$ID" != 'arch' ] && exit 0 # resolve files in this script relative to this script's location cd "$(dirname "$0")" # filter comments and pipe package name list to yay sed -e 's/#.*//g' -e 's/ //g' -e '/^$/d' packages-arch |\ - yay --noconfirm --needed -S - + yay --noprogressbar --quiet --noconfirm --needed -S - @@ -60,7 +60,7 @@ export EDITOR="nvim" export FZF_DEFAULT_COMMAND="find ." export FZF_DEFAULT_OPTS="--color=16" export GOPATH="$HOME/.local/go" -. "$XDG_CONFIG_HOME/gtk-4.0/env" +[ -e "$XDG_CONFIG_HOME/gtk-4.0/env" ] && . "$XDG_CONFIG_HOME/gtk-4.0/env" # use .config/ instead of home directory export ANDROID_SDK_HOME="$XDG_CONFIG_HOME/android" |