functions 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796
  1. #!/bin/sh
  2. ########################################################################
  3. # Begin boot functions
  4. #
  5. # Description : Run Level Control Functions
  6. #
  7. # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
  8. # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
  9. #
  10. # Version : LFS 7.0
  11. #
  12. # Notes : With code based on Matthias Benkmann's simpleinit-msb
  13. # http://winterdrache.de/linux/newboot/index.html
  14. #
  15. # The file should be located in /lib/boot
  16. #
  17. ########################################################################
  18. # Set any needed environment variables e.g. HEADLESS
  19. [ -r /etc/sysconfig/init_params ] && . /etc/sysconfig/init_params
  20. ## Environmental setup
  21. # Setup default values for environment
  22. umask 022
  23. export PATH="/bin:/usr/bin:/sbin:/usr/sbin"
  24. # Signal sent to running processes to refresh their configuration
  25. RELOADSIG="HUP"
  26. # Number of seconds between STOPSIG and FALLBACK when stopping processes
  27. KILLDELAY="3"
  28. ## Screen Dimensions
  29. # Find current screen size
  30. if [ -z "${COLUMNS}" ]; then
  31. COLUMNS=$(stty size)
  32. COLUMNS=${COLUMNS##* }
  33. fi
  34. # When using remote connections, such as a serial port, stty size returns 0
  35. if [ "${COLUMNS}" = "0" ]; then
  36. COLUMNS=80
  37. fi
  38. ## Measurements for positioning result messages
  39. COL=$((${COLUMNS} - 8))
  40. WCOL=$((${COL} - 2))
  41. ## Provide an echo that supports -e and -n
  42. # If formatting is needed, $ECHO should be used
  43. case "`echo -e -n test`" in
  44. -[en]*)
  45. ECHO=/bin/echo
  46. ;;
  47. *)
  48. ECHO=echo
  49. ;;
  50. esac
  51. ## Set Cursor Position Commands, used via $ECHO
  52. SET_COL="\\033[${COL}G" # at the $COL char
  53. SET_WCOL="\\033[${WCOL}G" # at the $WCOL char
  54. CURS_UP="\\033[1A\\033[0G" # Up one line, at the 0'th char
  55. ## Set color commands, used via $ECHO
  56. # Please consult `man console_codes for more information
  57. # under the "ECMA-48 Set Graphics Rendition" section
  58. #
  59. # Warning: when switching from a 8bit to a 9bit font,
  60. # the linux console will reinterpret the bold (1;) to
  61. # the top 256 glyphs of the 9bit font. This does
  62. # not affect framebuffer consoles
  63. NORMAL="\\033[0;39m" # Standard console grey
  64. SUCCESS="\\033[1;32m" # Success is green
  65. WARNING="\\033[1;33m" # Warnings are yellow
  66. FAILURE="\\033[1;31m" # Failures are red
  67. INFO="\\033[1;36m" # Information is light cyan
  68. BRACKET="\\033[1;34m" # Brackets are blue
  69. STRING_LENGTH="0" # the length of the current message
  70. #*******************************************************************************
  71. # Function - boot_mesg()
  72. #
  73. # Purpose: Sending information from bootup scripts to the console
  74. #
  75. # Inputs: $1 is the message
  76. # $2 is the colorcode for the console
  77. #
  78. # Outputs: Standard Output
  79. #
  80. # Dependencies: - sed for parsing strings.
  81. # - grep for counting string length.
  82. #
  83. # Todo:
  84. #*******************************************************************************
  85. boot_mesg()
  86. {
  87. local ECHOPARM=""
  88. while true
  89. do
  90. case "${1}" in
  91. -n)
  92. ECHOPARM=" -n "
  93. shift 1
  94. ;;
  95. -*)
  96. echo "Unknown Option: ${1}"
  97. return 1
  98. ;;
  99. *)
  100. break
  101. ;;
  102. esac
  103. done
  104. ## Figure out the length of what is to be printed to be used
  105. ## for warning messages.
  106. STRING_LENGTH=$((${#1} + 1))
  107. # Print the message to the screen
  108. ${ECHO} ${ECHOPARM} -e "${2}${1}"
  109. # Log the message
  110. [ -d /run/var ] || return
  111. ${ECHO} ${ECHOPARM} -e "${2}${1}" >> /run/var/bootlog
  112. }
  113. boot_mesg_flush()
  114. {
  115. # Reset STRING_LENGTH for next message
  116. STRING_LENGTH="0"
  117. }
  118. echo_ok()
  119. {
  120. ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]"
  121. ${ECHO} -e "${NORMAL}"
  122. boot_mesg_flush
  123. [ -d /run/var ] || return
  124. ${ECHO} -e "[ OK ]" >> /run/var/bootlog
  125. }
  126. echo_failure()
  127. {
  128. ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]"
  129. ${ECHO} -e "${NORMAL}"
  130. boot_mesg_flush
  131. [ -d /run/var ] || return
  132. ${ECHO} -e "[ FAIL]" >> /run/var/bootlog
  133. }
  134. echo_warning()
  135. {
  136. ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]"
  137. ${ECHO} -e "${NORMAL}"
  138. boot_mesg_flush
  139. [ -d /run/var ] || return
  140. ${ECHO} -e "[ WARN ]" >> /run/var/bootlog
  141. }
  142. echo_skipped()
  143. {
  144. ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} SKIP ${BRACKET}]"
  145. ${ECHO} -e "${NORMAL}"
  146. boot_mesg_flush
  147. [ -d /run/var ] || return
  148. ${ECHO} -e " [ SKIP ]" >> /run/var/bootlog
  149. }
  150. wait_for_user()
  151. {
  152. # Wait for the user by default
  153. [ "${HEADLESS=0}" = "0" ] && read ENTER
  154. }
  155. evaluate_retval()
  156. {
  157. error_value="${?}"
  158. if [ ${error_value} = 0 ]; then
  159. echo_ok
  160. else
  161. echo_failure
  162. fi
  163. # This prevents the 'An Unexpected Error Has Occurred' from trivial
  164. # errors.
  165. return 0
  166. }
  167. print_status()
  168. {
  169. if [ "${#}" = "0" ]; then
  170. echo "Usage: ${0} {success|warning|failure}"
  171. return 1
  172. fi
  173. case "${1}" in
  174. success)
  175. echo_ok
  176. ;;
  177. warning)
  178. # Leave this extra case in because old scripts
  179. # may call it this way.
  180. case "${2}" in
  181. running)
  182. ${ECHO} -e -n "${CURS_UP}"
  183. ${ECHO} -e -n "\\033[${STRING_LENGTH}G "
  184. boot_mesg "Already running." ${WARNING}
  185. echo_warning
  186. ;;
  187. not_running)
  188. ${ECHO} -e -n "${CURS_UP}"
  189. ${ECHO} -e -n "\\033[${STRING_LENGTH}G "
  190. boot_mesg "Not running." ${WARNING}
  191. echo_warning
  192. ;;
  193. not_available)
  194. ${ECHO} -e -n "${CURS_UP}"
  195. ${ECHO} -e -n "\\033[${STRING_LENGTH}G "
  196. boot_mesg "Not available." ${WARNING}
  197. echo_warning
  198. ;;
  199. *)
  200. # This is how it is supposed to
  201. # be called
  202. echo_warning
  203. ;;
  204. esac
  205. ;;
  206. failure)
  207. echo_failure
  208. ;;
  209. esac
  210. }
  211. reloadproc()
  212. {
  213. local pidfile=""
  214. local failure=0
  215. while true
  216. do
  217. case "${1}" in
  218. -p)
  219. pidfile="${2}"
  220. shift 2
  221. ;;
  222. -*)
  223. log_failure_msg "Unknown Option: ${1}"
  224. return 2
  225. ;;
  226. *)
  227. break
  228. ;;
  229. esac
  230. done
  231. if [ "${#}" -lt "1" ]; then
  232. log_failure_msg "Usage: reloadproc [-p pidfile] pathname"
  233. return 2
  234. fi
  235. # This will ensure compatibility with previous LFS Bootscripts
  236. if [ -n "${PIDFILE}" ]; then
  237. pidfile="${PIDFILE}"
  238. fi
  239. # Is the process running?
  240. if [ -z "${pidfile}" ]; then
  241. pidofproc -s "${1}"
  242. else
  243. pidofproc -s -p "${pidfile}" "${1}"
  244. fi
  245. # Warn about stale pid file
  246. if [ "$?" = 1 ]; then
  247. boot_mesg -n "Removing stale pid file: ${pidfile}. " ${WARNING}
  248. rm -f "${pidfile}"
  249. fi
  250. if [ -n "${pidlist}" ]; then
  251. for pid in ${pidlist}
  252. do
  253. kill -"${RELOADSIG}" "${pid}" || failure="1"
  254. done
  255. (exit ${failure})
  256. evaluate_retval
  257. else
  258. boot_mesg "Process ${1} not running." ${WARNING}
  259. echo_warning
  260. fi
  261. }
  262. statusproc()
  263. {
  264. local pidfile=""
  265. local base=""
  266. local ret=""
  267. while true
  268. do
  269. case "${1}" in
  270. -p)
  271. pidfile="${2}"
  272. shift 2
  273. ;;
  274. -*)
  275. log_failure_msg "Unknown Option: ${1}"
  276. return 2
  277. ;;
  278. *)
  279. break
  280. ;;
  281. esac
  282. done
  283. if [ "${#}" != "1" ]; then
  284. shift 1
  285. log_failure_msg "Usage: statusproc [-p pidfile] pathname"
  286. return 2
  287. fi
  288. # Get the process basename
  289. base="${1##*/}"
  290. # This will ensure compatibility with previous LFS Bootscripts
  291. if [ -n "${PIDFILE}" ]; then
  292. pidfile="${PIDFILE}"
  293. fi
  294. # Is the process running?
  295. if [ -z "${pidfile}" ]; then
  296. pidofproc -s "${1}"
  297. else
  298. pidofproc -s -p "${pidfile}" "${1}"
  299. fi
  300. # Store the return status
  301. ret=$?
  302. if [ -n "${pidlist}" ]; then
  303. ${ECHO} -e "${INFO}${base} is running with Process"\
  304. "ID(s) ${pidlist}.${NORMAL}"
  305. else
  306. if [ -n "${base}" -a -e "/var/run/${base}.pid" ]; then
  307. ${ECHO} -e "${WARNING}${1} is not running but"\
  308. "/var/run/${base}.pid exists.${NORMAL}"
  309. else
  310. if [ -n "${pidfile}" -a -e "${pidfile}" ]; then
  311. ${ECHO} -e "${WARNING}${1} is not running"\
  312. "but ${pidfile} exists.${NORMAL}"
  313. else
  314. ${ECHO} -e "${INFO}${1} is not running.${NORMAL}"
  315. fi
  316. fi
  317. fi
  318. # Return the status from pidofproc
  319. return $ret
  320. }
  321. # The below functions are documented in the LSB-generic 2.1.0
  322. #*******************************************************************************
  323. # Function - pidofproc [-s] [-p pidfile] pathname
  324. #
  325. # Purpose: This function returns one or more pid(s) for a particular daemon
  326. #
  327. # Inputs: -p pidfile, use the specified pidfile instead of pidof
  328. # pathname, path to the specified program
  329. #
  330. # Outputs: return 0 - Success, pid's in stdout
  331. # return 1 - Program is dead, pidfile exists
  332. # return 2 - Invalid or excessive number of arguments,
  333. # warning in stdout
  334. # return 3 - Program is not running
  335. #
  336. # Dependencies: pidof, echo, head
  337. #
  338. # Todo: Remove dependency on head
  339. # This replaces getpids
  340. # Test changes to pidof
  341. #
  342. #*******************************************************************************
  343. pidofproc()
  344. {
  345. local pidfile=""
  346. local lpids=""
  347. local silent=""
  348. pidlist=""
  349. while true
  350. do
  351. case "${1}" in
  352. -p)
  353. pidfile="${2}"
  354. shift 2
  355. ;;
  356. -s)
  357. # Added for legacy opperation of getpids
  358. # eliminates several '> /dev/null'
  359. silent="1"
  360. shift 1
  361. ;;
  362. -*)
  363. log_failure_msg "Unknown Option: ${1}"
  364. return 2
  365. ;;
  366. *)
  367. break
  368. ;;
  369. esac
  370. done
  371. if [ "${#}" != "1" ]; then
  372. shift 1
  373. log_failure_msg "Usage: pidofproc [-s] [-p pidfile] pathname"
  374. return 2
  375. fi
  376. if [ -n "${pidfile}" ]; then
  377. if [ ! -r "${pidfile}" ]; then
  378. return 3 # Program is not running
  379. fi
  380. lpids=`head -n 1 ${pidfile}`
  381. for pid in ${lpids}
  382. do
  383. if [ "${pid}" -ne "$$" -a "${pid}" -ne "${PPID}" ]; then
  384. kill -0 "${pid}" 2>/dev/null &&
  385. pidlist="${pidlist} ${pid}"
  386. fi
  387. if [ "${silent}" != "1" ]; then
  388. echo "${pidlist}"
  389. fi
  390. test -z "${pidlist}" &&
  391. # Program is dead, pidfile exists
  392. return 1
  393. # else
  394. return 0
  395. done
  396. else
  397. pidlist=`pidof -o $$ -o $PPID -x "$1"`
  398. if [ "${silent}" != "1" ]; then
  399. echo "${pidlist}"
  400. fi
  401. # Get provide correct running status
  402. if [ -n "${pidlist}" ]; then
  403. return 0
  404. else
  405. return 3
  406. fi
  407. fi
  408. if [ "$?" != "0" ]; then
  409. return 3 # Program is not running
  410. fi
  411. }
  412. #*******************************************************************************
  413. # Function - loadproc [-f] [-n nicelevel] [-p pidfile] pathname [args]
  414. #
  415. # Purpose: This runs the specified program as a daemon
  416. #
  417. # Inputs: -f, run the program even if it is already running
  418. # -n nicelevel, specifies a nice level. See nice(1).
  419. # -p pidfile, uses the specified pidfile
  420. # pathname, pathname to the specified program
  421. # args, arguments to pass to specified program
  422. #
  423. # Outputs: return 0 - Success
  424. # return 2 - Invalid of excessive number of arguments,
  425. # warning in stdout
  426. # return 4 - Program or service status is unknown
  427. #
  428. # Dependencies: nice, rm
  429. #
  430. # Todo: LSB says this should be called start_daemon
  431. # LSB does not say that it should call evaluate_retval
  432. # It checks for PIDFILE, which is deprecated.
  433. # Will be removed after BLFS 6.0
  434. # loadproc returns 0 if program is already running, not LSB compliant
  435. #
  436. #*******************************************************************************
  437. loadproc()
  438. {
  439. local pidfile=""
  440. local forcestart=""
  441. local nicelevel="10"
  442. # This will ensure compatibility with previous LFS Bootscripts
  443. if [ -n "${PIDFILE}" ]; then
  444. pidfile="${PIDFILE}"
  445. fi
  446. while true
  447. do
  448. case "${1}" in
  449. -f)
  450. forcestart="1"
  451. shift 1
  452. ;;
  453. -n)
  454. nicelevel="${2}"
  455. shift 2
  456. ;;
  457. -p)
  458. pidfile="${2}"
  459. shift 2
  460. ;;
  461. -*)
  462. log_failure_msg "Unknown Option: ${1}"
  463. return 2 #invalid or excess argument(s)
  464. ;;
  465. *)
  466. break
  467. ;;
  468. esac
  469. done
  470. if [ "${#}" = "0" ]; then
  471. log_failure_msg "Usage: loadproc [-f] [-n nicelevel] [-p pidfile] pathname [args]"
  472. return 2 #invalid or excess argument(s)
  473. fi
  474. if [ -z "${forcestart}" ]; then
  475. if [ -z "${pidfile}" ]; then
  476. pidofproc -s "${1}"
  477. else
  478. pidofproc -s -p "${pidfile}" "${1}"
  479. fi
  480. case "${?}" in
  481. 0)
  482. log_warning_msg "Unable to continue: ${1} is running"
  483. return 0 # 4
  484. ;;
  485. 1)
  486. boot_mesg "Removing stale pid file: ${pidfile}" ${WARNING}
  487. rm -f "${pidfile}"
  488. ;;
  489. 3)
  490. ;;
  491. *)
  492. log_failure_msg "Unknown error code from pidofproc: ${?}"
  493. return 4
  494. ;;
  495. esac
  496. fi
  497. nice -n "${nicelevel}" "${@}"
  498. evaluate_retval # This is "Probably" not LSB compliant,
  499. # but required to be compatible with older bootscripts
  500. return 0
  501. }
  502. #*******************************************************************************
  503. # Function - killproc [-p pidfile] pathname [signal]
  504. #
  505. # Purpose:
  506. #
  507. # Inputs: -p pidfile, uses the specified pidfile
  508. # pathname, pathname to the specified program
  509. # signal, send this signal to pathname
  510. #
  511. # Outputs: return 0 - Success
  512. # return 2 - Invalid of excessive number of arguments,
  513. # warning in stdout
  514. # return 4 - Unknown Status
  515. #
  516. # Dependencies: kill, rm
  517. #
  518. # Todo: LSB does not say that it should call evaluate_retval
  519. # It checks for PIDFILE, which is deprecated.
  520. # Will be removed after BLFS 6.0
  521. #
  522. #*******************************************************************************
  523. killproc()
  524. {
  525. local pidfile=""
  526. local killsig=TERM # default signal is SIGTERM
  527. pidlist=""
  528. # This will ensure compatibility with previous LFS Bootscripts
  529. if [ -n "${PIDFILE}" ]; then
  530. pidfile="${PIDFILE}"
  531. fi
  532. while true
  533. do
  534. case "${1}" in
  535. -p)
  536. pidfile="${2}"
  537. shift 2
  538. ;;
  539. -*)
  540. log_failure_msg "Unknown Option: ${1}"
  541. return 2
  542. ;;
  543. *)
  544. break
  545. ;;
  546. esac
  547. done
  548. if [ "${#}" = "2" ]; then
  549. killsig="${2}"
  550. elif [ "${#}" != "1" ]; then
  551. shift 2
  552. log_failure_msg "Usage: killproc [-p pidfile] pathname [signal]"
  553. return 2
  554. fi
  555. # Is the process running?
  556. if [ -z "${pidfile}" ]; then
  557. pidofproc -s "${1}"
  558. else
  559. pidofproc -s -p "${pidfile}" "${1}"
  560. fi
  561. # Remove stale pidfile
  562. if [ "$?" = 1 ]; then
  563. boot_mesg "Removing stale pid file: ${pidfile}." ${WARNING}
  564. rm -f "${pidfile}"
  565. fi
  566. # If running, send the signal
  567. if [ -n "${pidlist}" ]; then
  568. for pid in ${pidlist}
  569. do
  570. kill -${killsig} ${pid} 2>/dev/null
  571. # Wait up to 3 seconds, for ${pid} to terminate
  572. case "${killsig}" in
  573. TERM|SIGTERM|KILL|SIGKILL)
  574. # sleep in 1/10ths of seconds and
  575. # multiply KILLDELAY by 10
  576. local dtime="${KILLDELAY}0"
  577. while [ "${dtime}" != "0" ]
  578. do
  579. kill -0 ${pid} 2>/dev/null || break
  580. sleep 0.1
  581. dtime=$(( ${dtime} - 1))
  582. done
  583. # If ${pid} is still running, kill it
  584. kill -0 ${pid} 2>/dev/null && kill -KILL ${pid} 2>/dev/null
  585. ;;
  586. esac
  587. done
  588. # Check if the process is still running if we tried to stop it
  589. case "${killsig}" in
  590. TERM|SIGTERM|KILL|SIGKILL)
  591. if [ -z "${pidfile}" ]; then
  592. pidofproc -s "${1}"
  593. else
  594. pidofproc -s -p "${pidfile}" "${1}"
  595. fi
  596. # Program was terminated
  597. if [ "$?" != "0" ]; then
  598. # Remove the pidfile if necessary
  599. if [ -f "${pidfile}" ]; then
  600. rm -f "${pidfile}"
  601. fi
  602. echo_ok
  603. return 0
  604. else # Program is still running
  605. echo_failure
  606. return 4 # Unknown Status
  607. fi
  608. ;;
  609. *)
  610. # Just see if the kill returned successfully
  611. evaluate_retval
  612. ;;
  613. esac
  614. else # process not running
  615. print_status warning not_running
  616. fi
  617. }
  618. #*******************************************************************************
  619. # Function - log_success_msg "message"
  620. #
  621. # Purpose: Print a success message
  622. #
  623. # Inputs: $@ - Message
  624. #
  625. # Outputs: Text output to screen
  626. #
  627. # Dependencies: echo
  628. #
  629. # Todo: logging
  630. #
  631. #*******************************************************************************
  632. log_success_msg()
  633. {
  634. ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
  635. ${ECHO} -e "${SET_COL}""${BRACKET}""[""${SUCCESS}"" OK ""${BRACKET}""]""${NORMAL}"
  636. [ -d /run/var ] || return 0
  637. ${ECHO} -n -e "${@} [ OK ]" >> /run/var/bootlog
  638. return 0
  639. }
  640. #*******************************************************************************
  641. # Function - log_failure_msg "message"
  642. #
  643. # Purpose: Print a failure message
  644. #
  645. # Inputs: $@ - Message
  646. #
  647. # Outputs: Text output to screen
  648. #
  649. # Dependencies: echo
  650. #
  651. # Todo: logging
  652. #
  653. #*******************************************************************************
  654. log_failure_msg() {
  655. ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
  656. ${ECHO} -e "${SET_COL}""${BRACKET}""[""${FAILURE}"" FAIL ""${BRACKET}""]""${NORMAL}"
  657. [ -d /run/var ] || return 0
  658. ${ECHO} -e "${@} [ FAIL ]" >> /run/var/bootlog
  659. return 0
  660. }
  661. #*******************************************************************************
  662. # Function - log_warning_msg "message"
  663. #
  664. # Purpose: print a warning message
  665. #
  666. # Inputs: $@ - Message
  667. #
  668. # Outputs: Text output to screen
  669. #
  670. # Dependencies: echo
  671. #
  672. # Todo: logging
  673. #
  674. #*******************************************************************************
  675. log_warning_msg() {
  676. ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
  677. ${ECHO} -e "${SET_COL}""${BRACKET}""[""${WARNING}"" WARN ""${BRACKET}""]""${NORMAL}"
  678. [ -d /run/var ] || return 0
  679. ${ECHO} -e "${@} [ WARN ]" >> /run/var/bootlog
  680. return 0
  681. }
  682. #*******************************************************************************
  683. # Function - log_skipped_msg "message"
  684. #
  685. # Purpose: print a message that the script was skipped
  686. #
  687. # Inputs: $@ - Message
  688. #
  689. # Outputs: Text output to screen
  690. #
  691. # Dependencies: echo
  692. #
  693. # Todo: logging
  694. #
  695. #*******************************************************************************
  696. log_skipped_msg() {
  697. ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
  698. ${ECHO} -e "${SET_COL}""${BRACKET}""[""${WARNING}"" SKIP ""${BRACKET}""]""${NORMAL}"
  699. [ -d /run/var ] || return 0
  700. ${ECHO} -e "${@} [ SKIP ]" >> /run/var/bootlog
  701. return 0
  702. }
  703. # End boot functions