about summary refs log tree commit diff stats
path: root/home-manager/packages/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'home-manager/packages/scripts')
-rwxr-xr-xhome-manager/packages/scripts/small_functions/update18
1 files changed, 10 insertions, 8 deletions
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