#!/bin/sh
#

load_drivers()
{
	while IFS= read -r line; do
		modprobe $line
	done < "/etc/modules-load.galileo/$1.conf"
}

do_board()
{
	board=$(cat /sys/devices/virtual/dmi/id/board_name)
	case "$board" in
		*"SIMATIC IOT2000" )
			load_drivers "simatic_iot2000" ;;
	
		*"GalileoGen2" )
			load_drivers "galileo_gen2" ;;
		*"Galileo" )
			load_drivers "galileo" ;;
	esac
}

case "$1" in
	start)
		do_board
		;;
	stop)
		;;
	restart|reload)
		;;
	*)
		echo "Usage: $0 {start|stop|restart}"
		exit 1
esac
