From a3ccd164572621cf5de8a07c910f800bcefb04c0 Mon Sep 17 00:00:00 2001 From: Soispha Date: Sat, 15 Apr 2023 17:08:49 +0200 Subject: Fix(hm/pkgs/scr/update): Streamline output --- home-manager/packages/scripts/small_functions/update | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'home-manager/packages') diff --git a/home-manager/packages/scripts/small_functions/update b/home-manager/packages/scripts/small_functions/update index e4cdbdfd..23408327 100755 --- a/home-manager/packages/scripts/small_functions/update +++ b/home-manager/packages/scripts/small_functions/update @@ -16,10 +16,8 @@ help() { EOF exit "$1"; } -name="$0"; -[ "$name" = "" ] && name=update; +name="update"; tmp=$(mktmp); -git remote show origin | grep 'HEAD' | cut -d':' -f2 | sed -e 's/^ *//g' -e 's/ *$//g' > $tmp & BRANCH=""; while [ "$#" -gt 0 ];do @@ -44,10 +42,14 @@ while [ "$#" -gt 0 ];do done -cd /etc/nixos || die "No /etc/nixos" -git pull --rebase -[ "$BRANCH" = "" ] || git switch "$BRANCH"; -nixos-rebuild switch -git switch "$(cat $tmp)"; +cd /etc/nixos || die "No /etc/nixos"; +git pull --rebase > /dev/null; +if [ "$BRANCH" = "" ];then + git switch "$BRANCH" > /dev/null; + git pull --rebase; +fi +git remote show origin | grep 'HEAD' | cut -d':' -f2 | sed -e 's/^ *//g' -e 's/ *$//g' > $tmp & +nixos-rebuild switch; +git switch "$(cat $tmp)" > /dev/null; # vim: ft=sh -- cgit 1.4.1