#!/bin/bash

readonly Script_Title="Mount Slacko64_6999 Kernel Headers SFS"

Filename____Kernel_Headers="kernel_sources-3.16.43-s64-700.sfs"
	# 08:13:57 12/22/2019.  https://distro.ibiblio.org/puppylinux/pet_packages-slacko6414.1/kernel_sources-3.16.43-s64-700.sfs


Fillepath____Kernel_Headers=""
Temp_Fillepath____Kernel_Headers_Location="/tmp/Kernel_Headers_SFS_Location.txt"

readonly Fillepath____Quickly_Toggle_SFS_Mount="/root/APSK-VBSK VirtualBox Setup Kit/Quickly Toggle SFS Mount/Caution - Running this multiple times too quickly can crash the entire system!/quickly_toggle_sfs_mount"


discdrive_num=0

while [ "$discdrive_num" -lt 4 ]
do
	let "discdrive_num++"
	
	search_results=$(find /mnt/sr$discdrive_num -type f -iname "$Filename____Kernel_Headers" | head -n 1)
	
	if [ ! -z "$search_results" ]
	then
		Fillepath____Kernel_Headers="$search_results"
	fi
done


echo "$Fillepath____Kernel_Headers" > "$Temp_Fillepath____Kernel_Headers_Location"


#sfs_load "$Fillepath____Kernel_Headers"

bash "$Fillepath____Quickly_Toggle_SFS_Mount" "$Fillepath____Kernel_Headers"