2024-06-02 22:13:33 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
SC_COMMAND="$0 $@"
|
2024-06-06 02:00:49 +02:00
|
|
|
SC_LIB=${SC_LIB:-/usr/lib/sc}
|
|
|
|
. $SC_LIB/setup-env
|
2024-06-02 22:13:33 +02:00
|
|
|
|
|
|
|
show_welcome_header
|
|
|
|
|
|
|
|
[ $# -lt 1 ] && fatal_log "usage: $0 <command>"
|
|
|
|
command=$1
|
|
|
|
shift
|
|
|
|
|
|
|
|
case $command in
|
2024-06-06 02:00:49 +02:00
|
|
|
install-dotfiles)
|
|
|
|
[ -d "$HOME/.dotfiles" ] && fatal_log "dotfiles already exist"
|
|
|
|
LOGI installing dotfiles...
|
|
|
|
git clone https://git.saluco.nl/strix/dotfiles $HOME/.dotfiles
|
|
|
|
cd $HOME/.dotfiles
|
|
|
|
./dot a
|
2024-06-02 22:13:33 +02:00
|
|
|
;;
|
|
|
|
run)
|
|
|
|
if [ -z "$@" ]; then
|
|
|
|
if command -v zsh >/dev/null; then
|
|
|
|
zsh
|
|
|
|
elif command -v bash >/dev/null; then
|
|
|
|
bash
|
|
|
|
else
|
|
|
|
sh
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
$@
|
|
|
|
fi
|
|
|
|
;;
|
2024-06-06 02:00:49 +02:00
|
|
|
|
|
|
|
pm)
|
|
|
|
. $SC_LIB/pm
|
|
|
|
case $1 in
|
|
|
|
upgrade) pm_upgrade_packages ;;
|
|
|
|
install) shift; pm_install_packages $@ ;;
|
|
|
|
remove) shift; pm_remove_packages $@ ;;
|
|
|
|
esac
|
2024-06-02 22:13:33 +02:00
|
|
|
;;
|
2024-06-06 02:00:49 +02:00
|
|
|
eval)
|
|
|
|
LOGD "evaluating: $@..."
|
|
|
|
$@
|
2024-06-02 22:13:33 +02:00
|
|
|
;;
|
2024-06-06 02:00:49 +02:00
|
|
|
check) exit 0 ;;
|
|
|
|
*) fatal_log "invalid command" ;;
|
2024-06-02 22:13:33 +02:00
|
|
|
esac
|