functions 19 KB

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