forked from LengKundee/MQL5-Google-Onedrive
- Created RUN-GOOGLE-DRIVE-SETUP.bat for Windows users - Created scripts/google_drive_setup.sh for Linux/WSL users - Updated scripts/knowledge_base_helper.py to include Google Drive resources - Documented Google Drive streaming mode in docs/KNOWLEDGE_BASE_INTEGRATION.md - Verified repository stability with validation and integration tests
90 lines
2.9 KiB
Bash
Executable file
90 lines
2.9 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# ============================================================
|
|
# MQL5 Google Drive Setup & Streaming Mode (Linux/WSL)
|
|
# ============================================================
|
|
|
|
# Colors
|
|
GREEN='\033[0;32m'
|
|
RED='\033[0;31m'
|
|
BLUE='\033[0;34m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m'
|
|
|
|
GDRIVE_GIT_URL="https://drive.google.com/drive/folders/14qZgVQOnh7lNQreV1Nq7wlAiqBoc7OFc"
|
|
GDRIVE_CURSIR_URL="https://drive.google.com/drive/folders/1vG7mPy5KETtatMqVUnkqgXDoXmtpzCO1"
|
|
|
|
echo -e "${BLUE}============================================================${NC}"
|
|
echo -e "${BLUE} MQL5 Google Drive Setup${NC}"
|
|
echo -e "${BLUE}============================================================${NC}"
|
|
echo ""
|
|
|
|
# Check for rclone
|
|
if ! command -v rclone &> /dev/null; then
|
|
echo -e "${RED}[ERROR] rclone not found.${NC}"
|
|
echo "Please install rclone: sudo apt-get install rclone"
|
|
echo ""
|
|
echo "Alternatively, access folders directly:"
|
|
echo "GIT: $GDRIVE_GIT_URL"
|
|
echo "CURSIR: $GDRIVE_CURSIR_URL"
|
|
exit 1
|
|
fi
|
|
|
|
echo -e "${GREEN}[INFO] rclone found.${NC}"
|
|
echo ""
|
|
echo "Options:"
|
|
echo " 1) Configure Google Drive remote (rclone config)"
|
|
echo " 2) Start Streaming Mode (Mount Google Drive to ~/google-drive)"
|
|
echo " 3) Sync MQL5 to Google Drive"
|
|
echo " 4) Open Google Drive folders in browser"
|
|
echo " 0) Exit"
|
|
echo ""
|
|
|
|
read -p "Enter your choice [0-4]: " choice
|
|
|
|
case $choice in
|
|
1)
|
|
echo -e "${BLUE}[INFO] Starting rclone config...${NC}"
|
|
echo "Follow prompts to create a remote named 'google-drive' (type 'drive')."
|
|
rclone config
|
|
;;
|
|
2)
|
|
echo -e "${BLUE}[INFO] Starting Streaming Mode...${NC}"
|
|
MOUNT_POINT="$HOME/google-drive"
|
|
mkdir -p "$MOUNT_POINT"
|
|
echo "Attempting to mount 'google-drive:' to $MOUNT_POINT"
|
|
|
|
# Run mount in background
|
|
rclone mount google-drive: "$MOUNT_POINT" --vfs-cache-mode full --vfs-cache-max-age 24h --dir-cache-time 5m &
|
|
|
|
echo -e "${GREEN}[SUCCESS] Mount command issued in background.${NC}"
|
|
echo "Your Google Drive should appear at: $MOUNT_POINT"
|
|
;;
|
|
3)
|
|
echo -e "${BLUE}[INFO] Syncing mt5/MQL5 to Google Drive...${NC}"
|
|
rclone sync mt5/MQL5 google-drive:MQL5 --progress
|
|
;;
|
|
4)
|
|
echo -e "${BLUE}[INFO] Opening Google Drive folders...${NC}"
|
|
if command -v xdg-open &> /dev/null; then
|
|
xdg-open "$GDRIVE_GIT_URL"
|
|
xdg-open "$GDRIVE_CURSIR_URL"
|
|
elif command -v explorer.exe &> /dev/null; then
|
|
explorer.exe "$GDRIVE_GIT_URL"
|
|
explorer.exe "$GDRIVE_CURSIR_URL"
|
|
else
|
|
echo "Direct links:"
|
|
echo "GIT: $GDRIVE_GIT_URL"
|
|
echo "CURSIR: $GDRIVE_CURSIR_URL"
|
|
fi
|
|
;;
|
|
0)
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo -e "${RED}[ERROR] Invalid option.${NC}"
|
|
;;
|
|
esac
|
|
|
|
echo ""
|
|
read -n 1 -s -r -p "Press any key to exit..."
|
|
echo ""
|