- doctor [<name>] [--fix]: checks the system (user, programs, folders, zips, units and leftover copies in /etc, sandbox access to moved folders, journal, polkit, daemon, orphaned boot links and schedules) and each instance (ownership, server zip, config paths, mods, ports, failed starts/backups), with a fix for each. --fix applies the safe ones and re-checks them. - backup enable|disable|now|list: a systemd timer per instance (terraria-backup@.timer, Persistent=), saving the world first, into /var/lib/terraria/backups/<name>/ (group-readable), pruning only scheduled backups. rename carries the schedule, delete removes it. upgrade's backups move there too. - fetch vanilla|tmodloader [<version>] [--list] [--upgrade <name>]: downloads from terraria.org / tModLoader's GitHub releases, checks GitHub's sha256 and the zip, names it with its version. - terractld may write /etc/systemd/system, for backup enable and doctor --fix over --host. - Units, tmpfiles, packaging, completion, docs and changelog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8a509f1398
commit
fc2c08d47b
14 files changed
+1118
-56
No files matched your search
@@ -52,6 +52,11 @@ _terractl_instances() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Instance names here, or on remote <host> if one is given
|
||||
_terractl_any_instances() {
|
||||
if [[ -n $1 ]]; then _terractl_remote_instances "$1"; else _terractl_instances; fi
|
||||
}
|
||||
|
||||
# Remotes this user added with 'terractl remote add'
|
||||
_terractl_remotes() {
|
||||
local f=${TERRACTL_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/terractl}/remotes.json
|
||||
@@ -125,7 +130,7 @@ _terractl() {
|
||||
cword=$COMP_CWORD
|
||||
fi
|
||||
|
||||
local commands="new list info start stop restart enable disable attach watch cmd mods upgrade reinstall fix-perms delete rename export import"
|
||||
local commands="new list info start stop restart enable disable attach watch cmd mods upgrade reinstall fix-perms fetch backup doctor delete rename export import"
|
||||
local console="save say playing kick ban motd password time dawn noon dusk midnight settle seed version maxplayers port clear help"
|
||||
|
||||
# terractl --host <remote> <command> ...: the same as on this host, except
|
||||
@@ -149,7 +154,7 @@ _terractl() {
|
||||
return
|
||||
fi
|
||||
|
||||
local command=${words[1]}
|
||||
local command=${words[1]} prev=${words[cword-1]}
|
||||
case $command in
|
||||
list|journal-access|help|-h|--help|version|-V|--version)
|
||||
return ;;
|
||||
@@ -176,6 +181,36 @@ _terractl() {
|
||||
_terractl_reply "enable disable status token revoke"
|
||||
fi
|
||||
return ;;
|
||||
doctor)
|
||||
# doctor [<name>] [--fix]
|
||||
if [[ $cur == -* ]]; then _terractl_reply "--fix"; else _terractl_reply "$(_terractl_any_instances "$host")"; fi
|
||||
return ;;
|
||||
fetch)
|
||||
# fetch vanilla|tmodloader [<version>|latest] [--list] [--upgrade <name>]
|
||||
if (( cword == 2 )); then
|
||||
_terractl_reply "vanilla tmodloader"
|
||||
elif [[ $prev == --upgrade ]]; then
|
||||
_terractl_reply "$(_terractl_any_instances "$host")"
|
||||
elif [[ $cur == -* ]]; then
|
||||
_terractl_reply "--list --upgrade"
|
||||
else
|
||||
_terractl_reply "latest"
|
||||
fi
|
||||
return ;;
|
||||
backup)
|
||||
# backup enable|disable|now|list <name> [--every <when>] [--keep <number>]
|
||||
if (( cword == 2 )); then
|
||||
_terractl_reply "enable disable now list"
|
||||
elif (( cword == 3 )); then
|
||||
_terractl_reply "$(_terractl_any_instances "$host")"
|
||||
elif [[ ${words[2]} == enable ]]; then
|
||||
case $prev in
|
||||
--every) _terractl_reply "daily weekly hourly monthly" ;;
|
||||
--keep) ;;
|
||||
*) _terractl_reply "--every --keep" ;;
|
||||
esac
|
||||
fi
|
||||
return ;;
|
||||
esac
|
||||
|
||||
if (( cword == 2 )); then
|
||||
|
||||
Reference in new issue
Block a user