boot_beep (2106B)
1 #/bin/bash 2 # ---------------------------------------------------------------------- 3 # 4 # This file is part of microdevuan, a set of scripts to create minimal 5 # devuan live images 6 # 7 # ---------------------------------------------------------------------- 8 # 9 # This program is free software: you can redistribute it and/or modify 10 # it under the terms of the GNU General Public License as published by 11 # the Free Software Foundation, either version 3 of the License, or (at 12 # your option) any later version. 13 # 14 # This program is distributed in the hope that it will be useful, but 15 # WITHOUT ANY WARRANTY; without even the implied warranty of 16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 # General Public License for more details. 18 # 19 # You should have received a copy of the GNU General Public License 20 # along with this program. If not, see <http://www.gnu.org/licenses/>. 21 # 22 # ---------------------------------------------------------------------- 23 # 24 # (c) KatolaZ <katolaz@freaknet.org> (2016) 25 # 26 # ---------------------------------------------------------------------- 27 28 29 ## 30 ## A small daemon that just beeps every second, until the process 31 ## BB_PROCESS is ready... 32 ## 33 34 . /etc/default/boot_beep 35 36 37 ## 38 ## First, daemonize the script 39 ## 40 41 if [ "x$1" != "x--" ]; then 42 $0 -- 1> /dev/null 2> /dev/null & 43 exit 0 44 fi 45 46 47 check_process(){ 48 49 while [ 1 -gt 0 ]; do 50 login_ready=`ps ax | grep -E "${BB_PROCESS}" | grep -v "grep" | wc -l` 51 if [ $((${login_ready})) -ge 1 ]; then 52 ### 53 ### These lines should be put in a separate script, whose name is 54 ### specified in bb_defaults, to allow custom chimes.... 55 ### 56 ### 57 beep -D 50 -l 150 -f 523.25 58 beep -D 50 -l 150 -f 629.25 59 beep -D 50 -l 150 -f 784.00 60 beep -D 50 -l 150 -f 629.25 61 beep -D 50 -l 150 -f 523.25 62 exit 0; 63 else 64 if [[ ${BB_BOOT_BEEP} = "TRUE" ]]; then 65 beep -D 100 -l 250 -f 523.25 66 fi 67 sleep ${BB_INTERVAL}; 68 fi 69 done 70 } 71 72 echo $$ >> ${BB_TMPFILE} 73 74 check_process