From bf05f9f175e5117fb93925ec04e11533fc29d0db Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Thu, 2 Dec 2021 23:47:44 +0100 Subject: [PATCH] config: fix bootstrap issues --- .config/shell/functions | 9 ++++++--- .config/yadm/bootstrap | 2 +- .local/bin/scripts/sy | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.config/shell/functions b/.config/shell/functions index 0cf5321..3c20ede 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -70,12 +70,15 @@ edshell() { (prof*) file="$HOME/.zprofile";; (-f) grepfile="$(grep --recursive "\(^$2()\|alias $2=\)" $CONFIG_SHELLS -n -m 1)" file="$(echo "$grepfile" | cut -d':' -f1)" - line="$(echo "$grepfile" | cut -d':' -f2)";; + line="$(echo "$grepfile" | cut -d':' -f2)" + test -f "$file" || return 2;; (*) file="$(find $CONFIG_SHELLS -name "$1*" | head -1 | grep . || echo "$CONFIG_SHELLS/$1")";; esac - test -f "$file" || checksum="$(md5sum "$file")" + test -f "$file" && checksum="$(md5sum "$file")" $EDITOR "$(test "$line" && echo "+normal! ${line}ggzx" || echo "--")" "${file%:*}" - test "$checksum" != "$(md5sum $file)" && source "$HOME/.zprofile" && exec $SHELL + #test -f "$file" || return 1 + test "$checksum" != "$(md5sum $file)" && + source "$HOME/.zprofile" && exec $SHELL } diff --git a/.config/yadm/bootstrap b/.config/yadm/bootstrap index 960d5ba..8ced0e0 100755 --- a/.config/yadm/bootstrap +++ b/.config/yadm/bootstrap @@ -29,7 +29,7 @@ test -d "/etc/yadm" || sy clone ## Software section "Software" link() { - test -e "$2" || $(checkacess -w "$2" || echo sudo) ln -sv "$@" + test -e "$2" || $(checkaccess -w "$2" || echo sudo) ln -sv "$@" } mkdir -p .config/audacity diff --git a/.local/bin/scripts/sy b/.local/bin/scripts/sy index 4bd46e3..b0b1f68 100755 --- a/.local/bin/scripts/sy +++ b/.local/bin/scripts/sy @@ -6,8 +6,8 @@ case "$1" in ("") sysyadm s;; (p) sysyadm p;; (l) sysyadm fetch && sy rebase main --onto origin/main;; - (clone) sysyadm clone -w / git.jfischer.org:xeruf/etc.git --bootstrap;; - (init) sysyadm init -b main -w /;; + (clone) sudo -E sysyadm clone -w / git.jfischer.org:xeruf/etc.git --bootstrap;; + (init) sudo -E sysyadm init -b main -w /;; (*) sudo -E sysyadm "$@";; esac sudo chown -R $USER /etc/yadm