#!/bin/bash
# Install rclone if not already present
if command -v rclone &> /dev/null; then
  echo "rclone is already installed: $(rclone version | head -1)"
  exit 0
fi

echo "Installing rclone..."
if command -v curl &> /dev/null; then
  curl -s https://rclone.org/install.sh | sudo bash
elif command -v wget &> /dev/null; then
  wget -qO- https://rclone.org/install.sh | sudo bash
else
  echo "WARNING: Neither curl nor wget found. Please install rclone manually:"
  echo "  https://rclone.org/install/"
  exit 0
fi

if command -v rclone &> /dev/null; then
  echo "rclone installed successfully: $(rclone version | head -1)"
else
  echo "WARNING: rclone installation may have failed. Please install manually."
fi
