/usr/share/avifile-0.7/scripts/avicap-boot is in libavifile-0.7-common 1:0.7.48~20090503.ds-14build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | #!/bin/bash
# edit these to match your system
USERNAME=alex
LOGFILE=/var/log/avicap-boot.log
AVICAP_DIR=/etc/avicap
# runlevel startup routine taken from Suse's startup scripts
. /etc/rc.status
rc_reset
echo "avicap-boot: started in runlevel : " ${RUNLEVEL}
check_avicap()
{
if [ "$RUNLEVEL" == "" ] ; then
RUNLEVEL=3
fi
echo "avicap-boot: checking for start or power-off"
mkdir -p $AVICAP_DIR
if test ${RUNLEVEL} == S ; then
# shutdown again in runlevel S/boot time - no need to boot further
if test -e $AVICAP_DIR/first_shutdown ; then
echo "avicp-boot: this system was booted to halt"
echo "avicap-boot: shutdown system"
echo "avicap-boot: mounting / rw, removing $AVICAP_DIR/first_shutdown"
mount -o remount,rw /
sleep 2s
rm -f $AVICAP_DIR/first_shutdown
sync
sleep 2s
mount -o remount,ro /
echo "avicap-boot: shutdown to soft-off"
for i in 10 9 8 7 6 5 4 3 2 1 0 ; do
echo "countdown $i for avicap-boot to power-off system"
sleep 1s
done
sync
echo "avicap-boot: umounting filesystems"
sleep 1s
umount /proc
sleep 1s
umount /
echo "avicap-boot: now doing actual poweroff.."
sleep 1s
halt -p -f
echo "avicap-boot: you should never see me, power-off failed"
fi
elif test ${RUNLEVEL} -eq 3 ; then
# || test ${RUNLEVEL} == "" ; then
# check if we've to start avicap
if test -e $AVICAP_DIR/next_recording ; then
echo "avicap-boot will startup X and avicap -timer"
echo "==============================" >>$LOGFILE
( date ; echo "avicap-boot: starting X/avicap" ) >>$LOGFILE
(
for i in 10 9 8 7 6 5 4 3 2 1 0 ; do
echo "avicap-boot: countdown $i for Avicap start"
sleep 1s
done
( date ; echo "avicap-boot: startx" ) >>$LOGFILE
( su -l $USERNAME -c "startx" ) 2>&1 >>$LOGFILE &
sleep 1m
( date ; echo "avicap-boot: kv4lsetup" ) >>$LOGFILE
export DISPLAY=:0.0
chmod u+s /usr/local/bin/kv4lsetup
/usr/local/bin/kv4lsetup -t=2 2>>$LOGFILE 3>>$LOGFILE 4>>$LOGFILE >>$LOGFILE
sync
sleep 10s
( date ; echo "avicap-boot: avicap -timer" ) >>$LOGFILE
( su -l $USERNAME -c "DISPLAY=:0.0 avicap -timer 2>&1 >>$LOGFILE" ) 2>&1 >>$LOGFILE &
sleep 5s
rm -f $AVICAP_DIR/next_recording
sleep 20s
( date ; echo "avicap-boot: avicap-renicer" ) >>$LOGFILE
/home/alex/sbin/avicap-renicer 2>&1 >>$LOGFILE
unset DISPLAY
( date ; echo "avicap-boot: done" ) >>$LOGFILE
echo "---------------------------" >>$LOGFILE
) &
else
echo "avicap-boot: normal booting, no pending recordings"
fi
fi
}
case "$1" in
start)
echo "avicap-boot: starting..."
check_avicap
rc_status -v
;;
stop)
echo -n "Nothing to stop for Avicap"
rc_status -v
;;
restart)
## If first returns OK call the second, if first or
## second command fails, set echo return value.
$0 stop
$0 start
# Remember status and be quiet
rc_status
;;
status)
echo -n "No status for Avicap"
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload|force-reload}"
exit 1
;;
esac
rc_exit
|