Update backup and restore scripts
Deploy / Deploy (push) Successful in 2m47s

This commit is contained in:
2026-09-11 14:22:05 +01:00
parent 1a332af63e
commit 7f3c708119
2 changed files with 38 additions and 16 deletions
+6 -3
View File
@@ -161,9 +161,12 @@ backup_velocity() {
docker compose run --rm init sh -c 'mkdir -p "$1"/velocity_data/plugins/dclink-velocity' -- "$BACKUP_DIR" || return 1
docker compose run --rm sqlite_helper \
/velocity_data/plugins/dclink-velocity/dclink.db \
".backup $BACKUP_DIR/velocity_data/plugins/dclink-velocity/dclink.db" || return 1
docker compose run --rm init sh -c '
mkdir -p "$1"/velocity_data/plugins/carbonchat &&
mkdir -p "$1"/velocity_data/plugins/global-whitelist &&
cp -a --reflink=auto /velocity_data/plugins/carbonchat/users "$1"/velocity_data/plugins/carbonchat &&
cp -a --reflink=auto /velocity_data/plugins/global-whitelist/whitelist.json "$1"/velocity_data/plugins/global-whitelist
' -- "$BACKUP_DIR" || return 1
log_info "Finished Velocity backup"
}
+32 -13
View File
@@ -40,7 +40,8 @@ Restore options:
--paper-survival-the-end
--schematics
--velocity
--velocity-dclink
--velocity-carbonchat
--velocity-global-whitelist
Examples:
$SCRIPT_NAME list
@@ -76,7 +77,8 @@ cmd_restore() {
## Schematics
RESTORE_SCHEMATICS=0
## Velocity proxy
RESTORE_VELOCITY_DCLINK=0
RESTORE_VELOCITY_CARBONCHAT=0
RESTORE_VELOCITY_GLOBAL_WHITELIST=0
# Argument parsing
POS_ARGS=""
@@ -96,7 +98,8 @@ cmd_restore() {
RESTORE_PAPER_SURVIVAL_NETHER=1
RESTORE_PAPER_SURVIVAL_THE_END=1
RESTORE_SCHEMATICS=1
RESTORE_VELOCITY_DCLINK=1
RESTORE_VELOCITY_CARBONCHAT=1
RESTORE_VELOCITY_GLOBAL_WHITELIST=1
;;
--fabric)
@@ -188,11 +191,16 @@ cmd_restore() {
;;
--velocity)
RESTORE_VELOCITY_DCLINK=1
RESTORE_VELOCITY_CARBONCHAT=1
RESTORE_VELOCITY_GLOBAL_WHITELIST=1
;;
--velocity-dclink)
RESTORE_VELOCITY_DCLINK=1
--velocity-carbonchat)
RESTORE_VELOCITY_CARBONCHAT=1
;;
--velocity-global-whitelist)
RESTORE_VELOCITY_GLOBAL_WHITELIST=1
;;
--help)
@@ -227,7 +235,7 @@ cmd_restore() {
BACKUP_ID=$(basename "$BACKUP_DIR")
# Validate options
&& [ "$RESTORE_FABRIC_ESSENTIALS" -eq 0 ] \
if [ "$RESTORE_FABRIC_ESSENTIALS" -eq 0 ] \
&& [ "$RESTORE_FABRIC_G4MESPEED" -eq 0 ] \
&& [ "$RESTORE_FABRIC_WORLD" -eq 0 ] \
&& [ "$RESTORE_LUCKPERMS" -eq 0 ] \
@@ -240,7 +248,8 @@ cmd_restore() {
&& [ "$RESTORE_PAPER_SURVIVAL_NETHER" -eq 0 ] \
&& [ "$RESTORE_PAPER_SURVIVAL_THE_END" -eq 0 ] \
&& [ "$RESTORE_SCHEMATICS" -eq 0 ] \
&& [ "$RESTORE_VELOCITY_DCLINK" -eq 0 ]; then
&& [ "$RESTORE_VELOCITY_CARBONCHAT" -eq 0 ] \
&& [ "$RESTORE_VELOCITY_GLOBAL_WHITELIST" -eq 0 ]; then
log_fatal "no restore options specified"
fi
@@ -423,13 +432,23 @@ restore_schematics() {
}
restore_velocity() {
if [ "$RESTORE_VELOCITY_DCLINK" -eq 1 ]; then
echo "Restoring Velocity proxy's dclink database..."
if [ "$RESTORE_VELOCITY_CARBONCHAT" -eq 1 ]; then
echo "Restoring CarbonChat..."
docker compose run --rm init sh -c '
mkdir -p /velocity_data/plugins/dclink-velocity &&
mkdir -p /velocity_data/plugins/carbonchat &&
chown minecraft_server:minecraft_server /velocity_data/plugins &&
chown minecraft_server:minecraft_server /velocity_data/plugins/dclink-velocity &&
cp -a --reflink=auto "$1"/velocity_data/plugins/dclink-velocity/dclink.db /velocity_data/plugins/dclink-velocity
chown minecraft_server:minecraft_server /velocity_data/plugins/carbonchat &&
cp -a --reflink=auto "$1"/velocity_data/plugins/carbonchat/users /velocity_data/plugins/carbonchat
' -- "$BACKUP_DIR" || return 1
fi
if [ "$RESTORE_VELOCITY_GLOBAL_WHITELIST" -eq 1 ]; then
echo "Restoring Global Whitelist..."
docker compose run --rm init sh -c '
mkdir -p /velocity_data/plugins/global-whitelist &&
chown minecraft_server:minecraft_server /velocity_data/plugins &&
chown minecraft_server:minecraft_server /velocity_data/plugins/global-whitelist &&
cp -a --reflink=auto "$1"/velocity_data/plugins/global-whitelist/whitelist.json /velocity_data/plugins/global-whitelist
' -- "$BACKUP_DIR" || return 1
fi
}