bin: shortcut adjustments

This commit is contained in:
xeruf 2022-09-27 22:08:48 +02:00
parent b870fa0681
commit 76682c7c84
3 changed files with 4 additions and 2 deletions

View File

@ -188,6 +188,7 @@ alias scud='systemctl --user disable --now'
# Reload or restart matching systemctl service
unalias scr 2>/dev/null
scr() {
systemctl --user daemon-reload
echo -n "User: " && systemctl --user reload-or-restart "$@" ||
{ echo -n "System: " && sudo systemctl reload-or-restart "$@"; } &&
echo "Successful reload" ||
@ -298,7 +299,7 @@ sshl() {
local authcache="/var/tmp/ssh-keys"
mkdir -p "$authcache"
local file="$authcache/$1"
test "$all" && pass scp ~/.bash_aliases "$@:"
test "$all" && pass scp ~/.bash_aliases "$@:" # TODO also add sourcing to bashrc if needed
if ssh -G "$1" | grep --silent "^user root$" && ! [[ "$1" =~ "pve*" ]]
then pass ssh "$@"
else

View File

@ -1,4 +1,4 @@
#!/bin/bash -ex
#!/bin/bash -e
# Shortcut for mathematical calculations
# Converts german numbers such as 1.000,5
calc="$(echo "$@" | sed -e 's/p/+/g' -e 's/\.\(.*,\)/\1/g' -e 's/,/./g' -e 's/x/*/g' -e 's/m/-/g')"

View File

@ -33,6 +33,7 @@ case "$sel" in
(/etc/caddy/*) sudoedit "$sel" && caddy validate --config /etc/caddy/Caddyfile && sudo systemctl reload-or-restart caddy;;
(/etc/ssh/*) sudoedit "$sel" && sudo systemctl reload-or-restart sshd;;
(/etc/network/interfaces*) sudoedit "$sel" && sudo service networking reload;;
(/etc/samba/smb.conf) sudoedit "$sel" && testparm;;
(*) edit "$sel";;
esac
echo "$sel" | cat - "$conf_cache" | head -20 >"$conf_tmp" && mv "$conf_tmp" "$conf_cache"