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

View File

@ -2,7 +2,7 @@
#assume_yes = true
# 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 = ["powershell"]
@ -64,7 +64,7 @@ arguments = "--rebase --autostash"
[linux]
# 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"
#enable_tlmgr = true
#emerge_sync_flags = "-q"

View File

@ -1,7 +1,7 @@
#!/bin/sh
# Conveniently use sysyadm
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
("") sysyadm s;;
(p) sysyadm p;;