about summary refs log tree commit diff stats
path: root/home-manager/packages/scripts/small_functions
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-04-15 14:39:17 +0200
committerSoispha <soispha@vhack.eu>2023-05-09 19:30:40 +0200
commitd59d2b8c8e487d97b44ecf8219433df06b336991 (patch)
tree612d502385b8568f82ab9fbe84dc9f332d69853c /home-manager/packages/scripts/small_functions
parentFeat(flake): Add shellcheck to the development env (diff)
downloadnixos-config-d59d2b8c8e487d97b44ecf8219433df06b336991.tar.gz
nixos-config-d59d2b8c8e487d97b44ecf8219433df06b336991.zip
Fix(hm/pkgs/scr/update): Reset branch after update
Diffstat (limited to 'home-manager/packages/scripts/small_functions')
-rwxr-xr-xhome-manager/packages/scripts/small_functions/update.sh (renamed from home-manager/packages/scripts/small_functions/update)6
1 files changed, 4 insertions, 2 deletions
diff --git a/home-manager/packages/scripts/small_functions/update b/home-manager/packages/scripts/small_functions/update.sh
index 7b7b2e01..a8a838e8 100755
--- a/home-manager/packages/scripts/small_functions/update
+++ b/home-manager/packages/scripts/small_functions/update.sh
@@ -10,7 +10,8 @@ help() {
 EOF
     exit "$1";
 }
-
+tmp=$(mktmp);
+git remote show origin | grep 'HEAD' | cut -d':' -f2 | sed -e 's/^ *//g' -e 's/ *$//g' > $tmp &
 BRANCH="";
 
 while [ "$#" -gt 0 ];do
@@ -36,6 +37,7 @@ done
 
 
 cd /etc/nixos || die "No /etc/nixos"
-[ "$BRANCH" = "" ] || git switch "$BRANCH";
 git pull --rebase
+[ "$BRANCH" = "" ] || git switch "$BRANCH";
 nixos-rebuild switch
+git switch "$(cat $tmp)";