# Here's an example of how to start bash as a coprocess from powerman
# and get it to execute commands for you.  powerman.conf should contain:
#
#   include "/etc/powerman/bashfun.dev"
#   device "bf0" "bashfun" "/bin/bash |&"
#   node "b1" "bf0" "1"
#
specification  "bashfun" {
	timeout 5

	plug name { "1" }
 
	script login {
		send "stty -echo"
		send "unset PROMPT_COMMAND\n"
		send "export PS1=P\n"
		expect "P"
		send "echo off >/tmp/state\n"
		expect "P"
	}
	script status {
		send "cat /tmp/state\n"
		expect "(off|on)"
		setplugstate "1" $1 on="on" off="off"
		expect "P"
	}
	script on {
		send "echo on >/tmp/state\n"
		expect "P"
	}
	script off {
		send "echo off >/tmp/state\n"
		expect "P"
	}
}
