#!/bin/bash
################################################################################
# OwnCloud VM Setup - Install SMB Client
# Run from Jupiter Unraid server
################################################################################

echo "Connecting to OwnCloud VM console..."
echo "Commands to run in the VM console:"
echo ""
echo "==================================================================="
cat << 'VMCMDS'
# Login as root / Paper123!@#-unifi!

# 1. Check if SSH is running
systemctl status sshd

# 2. If not running, start it
systemctl enable sshd --now

# 3. Install SMB client packages
dnf install -y samba-client cifs-utils

# 4. Verify installation
which smbclient
rpm -qa | grep samba

# 5. Restart Apache/httpd for OwnCloud
systemctl restart httpd

# 6. Check OwnCloud service
systemctl status httpd

# 7. Exit console
exit
VMCMDS
echo "==================================================================="
echo ""
echo "Access VM console via:"
echo "  Option 1: Jupiter WebGUI (http://172.16.3.20) → VMs → OwnCloud → VNC"
echo "  Option 2: Run below command on Jupiter:"
echo ""
echo "ssh root@172.16.3.20 'virsh console OwnCloud'"
echo ""
echo "After installation, refresh OwnCloud admin page."
echo "SMB/CIFS should appear in External Storage dropdown."
