#!/bin/sh # # Set timeout for the dialog # TIMEOUT=15 rm -f /etc/xdm-choice-ttys.* case $1 in start) # # XXX This should probably be set some better way, but I have no idea # of what that way might be. # export TERM=cons25 # # Run dialog with timeout # sh -c "(sleep $TIMEOUT && kill -9 \$\$ > /dev/null 2>&1) & exec dialog --yesno \"Enable XDM for this session?\" 6 60" retval=$? if [ "$retval" = "0" ]; then sed 's|^#*\(.*xdm.*\)|\1|g' < /etc/ttys > /etc/xdm-choice-ttys.$$ mv /etc/xdm-choice-ttys.$$ /etc/ttys kill -HUP 1 elif [ "$retval" = "1" ]; then sed 's|^#*\(.*xdm.*\)|#\1|g' < /etc/ttys > /etc/xdm-choice-ttys.$$ mv /etc/xdm-choice-ttys.$$ /etc/ttys kill -HUP 1 else # Reset terminal after having had to kill dialog. # XXX Why the HECK does dialog return the same value after a # kill as after a "No" response? Shoot the designer. tset -Q fi ;; *) ;; esac