From 8727c421a2a84332b7a18a636c3ab470bda996e6 Mon Sep 17 00:00:00 2001
From: Xiao Pan <gky44px1999@gmail.com>
Date: Fri, 19 Apr 2024 19:56:03 -0700
Subject: move u from cfgl to fsh, better and more automated u

---
 Makefile |  2 +-
 sh/u     | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100755 sh/u

diff --git a/Makefile b/Makefile
index be80ad6..3568ed7 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@
 # For a command not to echo itself, prefix @ to the command
 # https://unix.stackexchange.com/a/740226/459013
 
-SH = alarm backlight bell ccgp cfg chmodef curlqb dateft dirnameall gita gitfork gitmetap gitmetar gitpu grrc il lastarg loop lsp mll mmi mpra mpva mpvy mvln mvtr mvtu news o orgext pa pq px qg qw rate reco rfp sbar ta time-uuid topa upd vinfo wh wtr xmq prp vip vpn dnd cgm ggm ccp
+SH = alarm backlight bell ccgp cfg chmodef curlqb dateft dirnameall gita gitfork gitmetap gitmetar gitpu grrc il lastarg loop lsp mll mmi mpra mpva mpvy mvln mvtr mvtu news o orgext pa pq px qg qw rate reco rfp sbar ta time-uuid topa upd vinfo wh wtr xmq prp vip vpn dnd cgm ggm ccp u
 PACMAN_HOOKS = setcap-intel_gpu_top.hook setcap-iotop-c.hook setcap-nethogs.hook
 PREFIX = /usr/local
 
diff --git a/sh/u b/sh/u
new file mode 100755
index 0000000..e169af1
--- /dev/null
+++ b/sh/u
@@ -0,0 +1,18 @@
+#!/bin/sh
+# temporary solution before rewriting upd anc cfg to be better and more automated
+
+ssh-add -l || ssh-add
+
+for host in ca ka ia studio pp; do
+	# alacritty use -T to change window name so I can identify different servers
+	# need to invoke bash afterwards for manual things like reboot if linux upgrades and pacdiff
+	# maybe can automate further so no need manual things
+	# need `bash -l` to invoke as login shell, so no need source .profile and inputrc/readline also works
+	# https://superuser.com/questions/306530/run-remote-ssh-command-with-full-login-shell
+	# maybe another way:
+	# https://superuser.com/questions/241187/how-do-i-reload-inputrc
+	# because I invoke bash, no need alacritty --hold
+	o alacritty -T "$host" -e ssh -t "$host" '. "$HOME/.profile" && upd; exec "$SHELL" -l'
+done
+
+upd
-- 
cgit v1.2.3-70-g09d2