#!/bin/bash

readonly Script_Title="Mount Lupu5284 Kernel Headers 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 *kernel_src_L4-2.6.33.2-patched.sfs | 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"