#!/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" echo main_selection=$(readConsole "Select: " "Invalid selection" "1 2") words=( 'databaseupdate' 'files' ) 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" env=$(readConsole "Select: " "Invalid selection" "live stage") echoSubTitle "Select a directory:" echo echoSelect "[1] " "/files" echoSelect "[2] " "/public/media" echoSelect "[3] " ".. custom .." files_selection=$(readConsole "Select: " "Invalid selection" "1 2 3") values=( "/files" "/public/media" ) if [ "$files_selection" -gt "${#values[@]}" ] then files_selection=$(readConsole "Please give a subpath to the shopware root on $env: ", "Invalid selection", true) else for i in "${!values[@]}" do ((cur=i+1)) if [ "$cur" == "$files_selection" ] then files_selection="${values[$i]}" fi done fi 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_selection" else echo "Aborted" fi fi