librobotcontrol-sys 0.4.0

Rust port of librobotcontrol
Documentation
#!/bin/sh

# Exit on error
set -e

# Source debconf library.
. /usr/share/debconf/confmodule

# if not running in noninteractive mode, ask some questions
if [ ! "$DEBIAN_FRONTEND" = "noninteractive" ]; then

	# check model
	if [ -e /proc/device-tree/model ]
	then
		MODEL="$(cat /proc/device-tree/model)"
	else
		MODEL="UNKNOWN"
	fi
	ISBLACK=false
	ISBLUE=false
	ISCAPE=false
	if [ "$MODEL" = "TI AM335x BeagleBone Blue" ]; then
		ISBLUE=true
	elif [ "$MODEL" = "TI AM335x BeagleBone Black" ]; then
		ISBLACK=true
	elif [ "$MODEL" = "TI AM335x BeagleBone Black Wireless" ]; then
		ISBLACK=true
	elif [ "$MODEL" = "TI AM335x BeagleBone Black RoboticsCape" ]; then
		ISCAPE=true
	elif [ "$MODEL" = "TI AM335x BeagleBone Black Wireless RoboticsCape" ]; then
		ISCAPE=true
	fi

	# first, for Black and Black wireless we need to ask to modify uEnv.txt
	if [ "$ISBLACK" = "true" ]; then
		db_input medium librobotcontrol/q_enable_dt || true
		db_go || true
	fi

	# now get the answer to the last question, if the user requested to enable
	# the DT then set ISCAPE to true as well since it will be after reboot
	# These two lines may not be needed anymore, but they don't hurt so leaving
	db_get librobotcontrol/q_enable_dt || true
	if [ "$RET" = "true" ]; then ISCAPE=true; fi

	# ask for what should run on boot
	db_input medium librobotcontrol/q_runonboot || true
	db_go || true

fi