bash/platform/arch.sh
2026-10-27 13:32:57 +00:00

56 lines
1.3 KiB
Bash

#!/bin/sh
# Interactive Bash commands specific to this Arch Linux workstation.
_ARCH_GREEN='\033[0;32m'
_ARCH_BLUE='\033[0;34m'
_ARCH_NC='\033[0m'
alias backup='sudo borgmatic create --verbosity 1 --files'
alias cs='lxc list -c ns4b,user.comment:comment'
pc() {
nohup pcmanfm . >/dev/null 2>&1 &
}
# Expand aliases for commands following sudo.
alias sudo='sudo '
alias speak='/usr/local/src/kokora/speak'
alias ls='LC_COLLATE=C ls --color=auto -h --group-directories-first --time-style=+"%d.%m.%Y %H:%M" -F'
alias cp='cp -irv'
alias mkdir='mkdir -vp'
alias mv='mv -iv'
alias rm='rm -dv'
alias grep='grep --colour=auto'
dusort() {
if [ "$#" -gt 1 ]; then
printf '%s\n' 'Usage: dusort [path]' >&2
return 2
fi
_dusort_path=${1:-.}
if [ ! -e "$_dusort_path" ]; then
printf 'dusort: path does not exist: %s\n' "$_dusort_path" >&2
unset _dusort_path
return 1
fi
if sudo du -h -d 2 -- "$_dusort_path" | sort -h; then
unset _dusort_path
return 0
fi
unset _dusort_path
return 1
}
update() {
printf 'Executing "%bpacman -Syu%b" via "%barchnews_wrap%b" wrapper\n' \
"$_ARCH_GREEN" "$_ARCH_NC" "$_ARCH_BLUE" "$_ARCH_NC"
sudo "$HOME/.src/archnews/archnews_wrap" -Syu || return
systemctl --user start --no-block package-status-refresh.service >/dev/null 2>&1 || true
}