config: improve system management including systemctl and topgrade

This commit is contained in:
xeruf 2022-09-03 20:09:25 +02:00
parent aee17fb21a
commit 323def710e
4 changed files with 21 additions and 17 deletions

View File

@ -1 +0,0 @@
local.conf##hostname.elephant

View File

@ -159,9 +159,12 @@ alias twtest='( cp -r "$TIMEWARRIORDB" /tmp/tw-bak && TIMEWARRIORDB=/tmp/timewar
alias syslog='less +F /var/log/syslog' alias syslog='less +F /var/log/syslog'
alias sc='sudo systemctl' alias sc='sudo systemctl'
alias sce='sudo systemctl enable --now' # TODO or show log
alias scd='sudo systemctl disable --now' alias scd='sudo systemctl disable --now'
sce() {
sudo systemctl enable --now "$@" ||
sudo systemctl status "$@"
}
unalias scs 2>/dev/null unalias scs 2>/dev/null
scs() { scs() {
( (
@ -170,7 +173,7 @@ scs() {
systemctl --user status "*$1*" systemctl --user status "*$1*"
sudo -E systemctl status "$1" 2>/dev/null || sudo -E systemctl status "$1" 2>/dev/null ||
sudo -E systemctl status "*$1*" sudo -E systemctl status "*$1*"
) | less -F ) # | less -RF
} }
alias scu='systemctl --user' alias scu='systemctl --user'
alias scue='systemctl --user enable --now' alias scue='systemctl --user enable --now'
@ -179,19 +182,19 @@ alias scud='systemctl --user disable --now'
# Reload or restart matching systemctl service # Reload or restart matching systemctl service
unalias scr 2>/dev/null unalias scr 2>/dev/null
scr() { scr() {
echo -n "User: " echo -n "User: " && systemctl --user reload-or-restart "$@" ||
systemctl --user reload-or-restart "$1" || { echo -n "System: " && sudo systemctl reload-or-restart "$@"; } &&
{ echo -n "System: " && sudo systemctl reload-or-restart "$1"; } && echo "Successful reload" ||
echo "Successful reload" scs "$@"
} }
# Restart matching systemctl service with time for adjustments inbetween # Restart matching systemctl service with time for adjustments inbetween
scb() { scb() {
systemctl --user stop --show-transaction "$1" systemctl --user stop --show-transaction "$@"
sudo systemctl stop --show-transaction "$1" sudo systemctl stop --show-transaction "$@"
read read
systemctl --user start --show-transaction "$1" systemctl --user start --show-transaction "$@"
sudo systemctl start --show-transaction "$1" sudo systemctl start --show-transaction "$@"
} }
alias jch='sudo SYSTEMD_LESS=FRKiM journalctl --no-hostname' alias jch='sudo SYSTEMD_LESS=FRKiM journalctl --no-hostname'
@ -233,9 +236,10 @@ del() {
} }
u() { u() {
if test "$(stat /etc/pacman.d/mirrorlist --printf=%y | cut -d' ' -f1)" != "$(date +%F)" if test "$(stat /etc/pacman.d/mirrorlist --printf=%y | cut -d'-' -f1-2)" != "$(date +%Y-%m)"
then command -v pacman-mirrors >/dev/null && then command -v pacman-mirrors >/dev/null &&
sudo pacman-mirrors --geoip sudo pacman-mirrors --geoip ||
sudo touch /etc/pacman.d/mirrorlist
if command -v pacman >/dev/null; then if command -v pacman >/dev/null; then
sudo pacman -Syy --needed base gnupg archlinux-keyring sudo pacman -Syy --needed base gnupg archlinux-keyring
sudo pacman-key --populate sudo pacman-key --populate
@ -244,7 +248,7 @@ u() {
fi fi
if command -v topgrade >/dev/null if command -v topgrade >/dev/null
then then
topgrade topgrade --disable node emacs remotes
if test -d "$XDG_CONFIG_HOME/emacs" if test -d "$XDG_CONFIG_HOME/emacs"
then then
builtin cd $XDG_CONFIG_HOME/emacs builtin cd $XDG_CONFIG_HOME/emacs
@ -254,6 +258,7 @@ u() {
read result read result
test "$result" = "y" && rm -rf "$DOOMLOCALDIR/straight" && doom sync -u test "$result" = "y" && rm -rf "$DOOMLOCALDIR/straight" && doom sync -u
fi fi
pgrep emacsclient && echo -n "^ Emacs client processes. Press enter to restart the emacs server." && read
pkill --full "emacs --daemon" && emacs --daemon & pkill --full "emacs --daemon" && emacs --daemon &
fi fi
else yadm l else yadm l

View File

@ -2,7 +2,7 @@
#assume_yes = true #assume_yes = true
# Disable specific steps - same options as the command line flag # Disable specific steps - same options as the command line flag
disable = ["node", "nix", "config_update", "containers"] disable = ["nix", "containers", "config_update"]
# Ignore failures for these steps # Ignore failures for these steps
#ignore_failures = ["powershell"] #ignore_failures = ["powershell"]
@ -64,7 +64,7 @@ arguments = "--rebase --autostash"
[linux] [linux]
# Arguments to pass yay when updating packages # Arguments to pass yay when updating packages
yay_arguments = "--nodiffmenu --ignore android-studio --ignore clion --ignore intellij-idea-ultimate-edition --ignore intellij-idea-ultimate-edition-jre --ignore webstorm --ignore webstorm-jre --ignore brave-bin" yay_arguments = "--nodiffmenu --ignore android-studio --ignore clion --ignore intellij-idea-ultimate-edition --ignore intellij-idea-ultimate-edition-jre --ignore webstorm --ignore linux"
#trizen_arguments = "--devel" #trizen_arguments = "--devel"
#enable_tlmgr = true #enable_tlmgr = true
#emerge_sync_flags = "-q" #emerge_sync_flags = "-q"

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# Conveniently use sysyadm # Conveniently use sysyadm
unignore="/etc/yadm/unignore" unignore="/etc/yadm/unignore"
test -r "$unignore" && cat "$unignore" | while read f; do eval ls -d $f; done | sysyadm add --intent-to-add --pathspec-from-file=- test -r "$unignore" && cat "$unignore" | while read f; do eval ls -d $f; done | sysyadm add --intent-to-add --pathspec-from-file=- 2>/dev/null
case "$1" in case "$1" in
("") sysyadm s;; ("") sysyadm s;;
(p) sysyadm p;; (p) sysyadm p;;