#!/bin/bash

readonly Script_Title="Do All VirtualBox Setup for Guest GNU/Linux Distro (Probably a Puppy Linux)"

# 22:01:06 01/07/2018.  05:58:47 12/22/2019.  This script should be run inside the guest system.


Wait_for_User_to_Press_Enter_to_Close_Console_Window()
{
	echo
	echo
	echo "Press Enter to close this window."
	read
}


question="Are you sure you want to run APSK-VBSK VirtualBox Setup Kit?"

echo "A GUI xmessage box asks:
   $question"

xmessage -bg yellow -center -buttons Yes,No "$question"
	answer="$?"

echo
echo "answer = $answer"
echo
echo

if [ "$answer" = 101 ]
then
	echo "User clicked 'Yes'"
else
	
	echo "User didn't click 'Yes' - aborting."
	
	
	Wait_for_User_to_Press_Enter_to_Close_Console_Window
	
	
	#!!!!
	exit 0
fi	



readonly Fillepath____This_Script=$(realpath "${BASH_SOURCE[0]}")
readonly Follpath____This_Script=$(dirname "$Fillepath____This_Script" )


readonly DISTRO_NAME_AND_VERSION=$(source /etc/DISTRO_SPECS && echo "$DISTRO_NAME $DISTRO_VERSION")


	
echo
echo
echo "Fillepath____This_Script: $Fillepath____This_Script"
echo "Follpath____This_Script: $Follpath____This_Script"
echo "DISTRO_NAME_AND_VERSION: $DISTRO_NAME_AND_VERSION"
echo
echo

#-----

Follpath____Install_This_App="$Follpath____This_Script/Install This App"

cd "$Follpath____Install_This_App"


bash "Ramize This App to Guest Ramdisk" "silence rsync"


#-----
Follpath____Mount_Virtual_Optical_Discs="$Follpath____This_Script/Mount Virtual Optical Discs"

cd "$Follpath____Mount_Virtual_Optical_Discs"

bash "Mount Virtual Optical Discs 1 thru 3"

#-----

#~ Instructions_for_Mounting_SFS()
#~ {
	#~ this_sfs="$1"
	#~ 
	#~ xmessage -bg pink -center -buttons OK "Instructions for Mounting the $this_sfs SFS with SFS-Load
#~ 
#~ (Keep this popup window open so you can read it while you're running SFS-Load!)
#~ 
#~ 
#~ 1. Click the SFS-Load button.
#~ 
#~ 2. In SFS-Load window which asks you where to save - select NOCOPY
#~ from the dropdown box, and click OK.
#~ 
#~ 3. When SFS-Load asks if you want to add a new mount point, click OK.
#~ 
#~ 4. After the SFS is loaded, when SFS-Load asks if you want to run the
#~ application right now, click the Quit button." &
#~ 
#~ }
#~ 
#~ Instructions_for_Mounting_SFS "DevX"


Follpath____DevX="$Follpath____This_Script/DevX"

cd "$Follpath____DevX"

bash "Mount DevX SFS"

#-----

case "$DISTRO_NAME_AND_VERSION" in

	"Lucid  528")
	
		#Instructions_for_Mounting_SFS "Kernel Headers"
	
		bash "Mount Lupu5284 Kernel Headers SFS"
		;;
	"Slacko64 Puppy 6.9.9.9")
		
		bash "Mount Slacko64_6999 Kernel Headers SFS"
		
		;;
	"xenialpup64 7.5")
		
		bash "Mount Xen64_75 Kernel Headers SFS"
		
		;;
		
esac



#-----

Follpath____Install_Official_VirtualBox_Guest_Additions="$Follpath____This_Script/Install Official VirtualBox Guest Additions"

cd "$Follpath____Install_Official_VirtualBox_Guest_Additions"

bash "Install Official VirtualBox Guest Additions"

#-----

Follpath____For_xinitrc="$Follpath____This_Script/For .xinitrc"

cd "$Follpath____For_xinitrc"

bash "Add Line to .xinitrc - Run VirtualBox Guest Setup for .xinitrc"
bash "VirtualBox Guest Setup for .xinitrc"


#-----

Follpath____Mount_Sharefols="$Follpath____This_Script/Mount Shared Folders"

cd "$Follpath____Mount_Sharefols"

bash "Mount All Shared Folders"


#-----

Follpath____Pinboards="$Follpath____This_Script/Pinboards"

cd "$Follpath____Pinboards"

bash "Install Rox Pinboard"


#-----


if [ "$DISTRO_NAME_AND_VERSION" = "Lucid  528" ]
then
	Follpath____Lupu5284="$Follpath____This_Script/Lupu5284"


	xset s off -dpms
		# 02:40:57 01/10/2018.  Stops the screen from blacking out.
		
	
	Follpath____Xorg="$Follpath____Lupu5284/Xorg Screen Settings so mouse cursor does not disappear"
	
	cd "$Follpath____Xorg"
	
	bash "Install 1024x768 Xorg Settings"
	#bash "Install 800x600 Xorg Settings"
fi



if [ "$DISTRO_NAME_AND_VERSION" = "Lighthouse64 602" ]
then

	Follpath____LH64_602_B2="$Follpath____This_Script/LH64_602_B2"

	Follpath____Screensaver="$Follpath____LH64_602_B2/Screensaver"

	cd "$Follpath____Screensaver"

	bash "Stop Screensaver from Starting at Login/Stop Screensaver from Starting at Login"
	bash "Turn Off Screensaver"

fi

message="APSK-VBSK VirtualBox Setup Kit's guest setup done!"

echo
echo
echo "A GUI message box announces:
   $message"


Xdialog --title "$message" --msgbox "$message" 0 0


Wait_for_User_to_Press_Enter_to_Close_Console_Window