mirror of
https://gh.wpcy.net/https://github.com/CaptainCore/captaincore.git
synced 2026-04-18 13:16:01 +08:00
32 lines
No EOL
661 B
Bash
Executable file
32 lines
No EOL
661 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
#
|
|
# Moves zip to rclone remote for cold storage.
|
|
#
|
|
# `captaincore store-snapshot <url|file>`
|
|
#
|
|
|
|
zip=$1
|
|
|
|
while read config; do
|
|
if [[ "$config" == "Error:"* ]]; then
|
|
continue
|
|
fi
|
|
declare "$config"
|
|
done <<< "$(php ${CAPTAINCORE_PATH}/lib/local-scripts/configs.php fetch)"
|
|
|
|
run_command() {
|
|
|
|
if [ -e $zip ]; then
|
|
echo "Found local file $zip"
|
|
rclone move $zip $rclone_archive --progress --stats-one-line --stats=1m
|
|
return 1
|
|
fi
|
|
|
|
zip_filename=$( echo $zip | perl -n -e '/.+\/+(.+\.zip)/&& print $1' )
|
|
wget -O $zip_filename $zip
|
|
rclone move $zip_filename $rclone_archive --progress --stats-one-line --stats=1m
|
|
|
|
}
|
|
|
|
run_command |