mirror of
https://ghproxy.net/https://github.com/CaptainCore/captaincore.git
synced 2025-10-04 03:00:07 +08:00
42 lines
No EOL
946 B
Bash
Executable file
42 lines
No EOL
946 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
#
|
|
# Syncs site details to CaptainCore CLI.
|
|
#
|
|
# `captaincore site sync <site_id>`
|
|
#
|
|
# [--update-extras]
|
|
#
|
|
|
|
# Error if no sites specifed
|
|
if [ ${#@} -eq 0 ]; then
|
|
echo -e "${COLOR_RED}Error:${COLOR_NORMAL} Please specify a site."
|
|
exit
|
|
fi
|
|
|
|
while read config; do
|
|
if [[ "$config" == "Error:"* ]]; then
|
|
continue
|
|
fi
|
|
declare "$config"
|
|
done <<< "$(php ${CAPTAINCORE_PATH}/lib/local-scripts/configs.php fetch)"
|
|
|
|
site_id=$1
|
|
|
|
run_command() {
|
|
|
|
cd ${CAPTAINCORE_PATH}/data
|
|
wp eval-file ../lib/local-scripts/site-sync.php site_id=$site_id
|
|
|
|
# Generate rclone keys
|
|
captaincore site key-generate $site_id --captain-id=$CAPTAIN_ID
|
|
|
|
if [ "$CAPTAINCORE_UPDATE_EXTRAS" ]; then
|
|
captaincore site prepare $site_id --captain-id=$CAPTAIN_ID
|
|
captaincore site deploy-defaults ${site_id}-production --global-only --captain-id=$CAPTAIN_ID
|
|
captaincore capture ${site_id}-production --captain-id=$CAPTAIN_ID
|
|
fi
|
|
|
|
}
|
|
|
|
run_command |