You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
2.1 KiB
104 lines
2.1 KiB
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
source "$(dirname "${BASH_SOURCE[0]}")/includes/includes.sh"
|
|
app_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." &> /dev/null && pwd)
|
|
source "$app_dir/etc/config.sh"
|
|
|
|
echo
|
|
echoMainTitle "What do you want to do today?"
|
|
|
|
echo
|
|
echoSelect "[1]" "Databaseupdate"
|
|
echoSelect "[2]" "Fetching Files"
|
|
echoSelect "[3]" "Fetching Public Media"
|
|
echo
|
|
main_selection=$(readConsole "Select: " "Invalid selection" "1 2 3")
|
|
words=(
|
|
'databaseupdate'
|
|
'files'
|
|
'media'
|
|
)
|
|
|
|
for i in "${!words[@]}"
|
|
do
|
|
((cur=i+1))
|
|
if [ $cur == "$main_selection" ]
|
|
then
|
|
main_selection=${words[$i]}
|
|
fi
|
|
done
|
|
|
|
echo $main_selection
|
|
|
|
if [ "$main_selection" == "databaseupdate" ]
|
|
then
|
|
echo
|
|
echoSubTitle "Databaseupdate"
|
|
echo
|
|
echo "From Environment:"
|
|
echo
|
|
echoSelect "[live] " "Live"
|
|
echoSelect "[stage] " "Stage"
|
|
echo
|
|
env=$(readConsole "Select: " "Invalid selection" "live stage")
|
|
|
|
echo
|
|
confirm=$(readConsole "You want to copy the database from $env to local ($env)? [y,n]: " "Invalid selection" "y n")
|
|
|
|
if [ "$confirm" == "y" ]
|
|
then
|
|
source "$app_dir/bin/commands/import_db.sh" "$env"
|
|
else
|
|
echo "Aborted"
|
|
fi
|
|
fi
|
|
|
|
if [ "$main_selection" == "files" ]
|
|
then
|
|
echo
|
|
echoSubTitle "Fetching Files"
|
|
echo
|
|
echo "From Environment:"
|
|
echo
|
|
echoSelect "[live] " "Live"
|
|
echoSelect "[stage] " "Stage"
|
|
echo
|
|
env=$(readConsole "Select: " "Invalid selection" "live stage")
|
|
|
|
echo
|
|
confirm=$(readConsole "You want to copy the /files from $env to local ($env)? [y,n]: " "Invalid selection" "y n")
|
|
|
|
if [ "$confirm" == "y" ]
|
|
then
|
|
source "$app_dir/bin/commands/import_media.sh" "$env" "/files"
|
|
else
|
|
echo "Aborted"
|
|
fi
|
|
fi
|
|
|
|
if [ "$main_selection" == "media" ]
|
|
then
|
|
echo
|
|
echoSubTitle "Fetching public Media"
|
|
echo
|
|
echo "From Environment:"
|
|
echo
|
|
echoSelect "[live] " "Live"
|
|
echoSelect "[stage] " "Stage"
|
|
echo
|
|
env=$(readConsole "Select: " "Invalid selection" "live stage")
|
|
|
|
echo
|
|
confirm=$(readConsole "You want to copy the /public/media from $env to local ($env? [y,n]: " "Invalid selection" "y n")
|
|
|
|
if [ "$confirm" == "y" ]
|
|
then
|
|
source "$app_dir/bin/commands/import_media.sh" "$env" "/public/media"
|
|
else
|
|
echo "Aborted"
|
|
fi
|
|
fi
|
|
|
|
echo
|