#!/bin/bash

echo "This will set up file sharing over a network for user $(whoami)." &&
echo "You will be prompted for your password, then required components will be" &&
echo "installed if they aren't already. Finally, you will be prompted for a" &&
echo "\"New SMB Password\". This is the password you will use to access" &&
echo "shared folders from other locations on your local network." &&
echo "You MUST be connected to the internet for this installer to work." &&
read -p "Press Enter to continue. " &&
sudo apt update &&
sudo apt install -y samba caja-share &&
sudo usermod -G sambashare -a $(whoami) &&
sudo smbpasswd -a $(whoami) &&
setfacl -m u:nobody:rx /home/$(whoami) &&
rm /home/$(whoami)/Desktop/Set\ Up\ Network\ Folder\ Sharing.desktop &&
echo "The setup is now complete. For this to take effect, you must log out" &&
echo "and log back in." &&
read -p "Press Enter to close this window. " &&
exit
