#!/bin/bash

    << CHANGELOG
    2021-03-10: Template Created & Added to GIT
    2021-03-13: Forked from template. Used to quickly mount \\N40L\Public
    2022-12-11: Add file to show when not mounted
CHANGELOG


if [[ "$EUID" -ne 0 ]]; then
	echo "This script needs to be run with superuser privileges."
	exit
fi




echo -e "
$(tput setaf 3; tput setab 0)
    >> # [Public-01] - Basic Dependencies (Install nfs-common)
$(tput sgr 0)
"

apt -qq update && apt -qq install -y nfs-common 




echo -e "
$(tput setaf 3; tput setab 0)
    >> # [Public-02] - 1-time mount of \\N40L\Public
$(tput sgr 0)
"


mkdir -pvm a=rwx /mnt/Public && sudo touch /mnt/Public/NOT_MOUNTED && mount -t nfs N40L:/volume1/Public /mnt/Public




<< 'SKIPPED'
echo -e "
$(tput setaf 3; tput setab 0)
    >> # [Public-12] - Script Cleanup
$(tput sgr 0)
"

if ! command -v realpath &> /dev/null
then
    echo -e "COMMAND 'realpath' could not be found. $(tput setaf 3; tput setab 0)Please move script manually.$(tput sgr 0)"
else
    SCRIPT=`realpath -s $0` && \
    DESTINATION=~/Deploy && \
    mkdir -p ${DESTINATION} && \
    mv ${SCRIPT} ${DESTINATION} && \
    ls -laR ${DESTINATION}
fi

SKIPPED