functions 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787
  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. ${ECHO} ${ECHOPARM} -e "${2}${1}" >> /run/var/bootlog
  111. }
  112. boot_mesg_flush()
  113. {
  114. # Reset STRING_LENGTH for next message
  115. STRING_LENGTH="0"
  116. }
  117. echo_ok()
  118. {
  119. ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]"
  120. ${ECHO} -e "${NORMAL}"
  121. boot_mesg_flush
  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. ${ECHO} -e "[ FAIL]" >> /run/var/bootlog
  130. }
  131. echo_warning()
  132. {
  133. ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]"
  134. ${ECHO} -e "${NORMAL}"
  135. boot_mesg_flush
  136. ${ECHO} -e "[ WARN ]" >> /run/var/bootlog
  137. }
  138. echo_skipped()
  139. {
  140. ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} SKIP ${BRACKET}]"
  141. ${ECHO} -e "${NORMAL}"
  142. boot_mesg_flush
  143. ${ECHO} -e " [ SKIP ]" >> /run/var/bootlog
  144. }
  145. wait_for_user()
  146. {
  147. # Wait for the user by default
  148. [ "${HEADLESS=0}" = "0" ] && read ENTER
  149. }
  150. evaluate_retval()
  151. {
  152. error_value="${?}"
  153. if [ ${error_value} = 0 ]; then
  154. echo_ok
  155. else
  156. echo_failure
  157. fi
  158. # This prevents the 'An Unexpected Error Has Occurred' from trivial
  159. # errors.
  160. return 0
  161. }
  162. print_status()
  163. {
  164. if [ "${#}" = "0" ]; then
  165. echo "Usage: ${0} {success|warning|failure}"
  166. return 1
  167. fi
  168. case "${1}" in
  169. success)
  170. echo_ok
  171. ;;
  172. warning)
  173. # Leave this extra case in because old scripts
  174. # may call it this way.
  175. case "${2}" in
  176. running)
  177. ${ECHO} -e -n "${CURS_UP}"
  178. ${ECHO} -e -n "\\033[${STRING_LENGTH}G "
  179. boot_mesg "Already running." ${WARNING}
  180. echo_warning
  181. ;;
  182. not_running)
  183. ${ECHO} -e -n "${CURS_UP}"
  184. ${ECHO} -e -n "\\033[${STRING_LENGTH}G "
  185. boot_mesg "Not running." ${WARNING}
  186. echo_warning
  187. ;;
  188. not_available)
  189. ${ECHO} -e -n "${CURS_UP}"
  190. ${ECHO} -e -n "\\033[${STRING_LENGTH}G "
  191. boot_mesg "Not available." ${WARNING}
  192. echo_warning
  193. ;;
  194. *)
  195. # This is how it is supposed to
  196. # be called
  197. echo_warning
  198. ;;
  199. esac
  200. ;;
  201. failure)
  202. echo_failure
  203. ;;
  204. esac
  205. }
  206. reloadproc()
  207. {
  208. local pidfile=""
  209. local failure=0
  210. while true
  211. do
  212. case "${1}" in
  213. -p)
  214. pidfile="${2}"
  215. shift 2
  216. ;;
  217. -*)
  218. log_failure_msg "Unknown Option: ${1}"
  219. return 2
  220. ;;
  221. *)
  222. break
  223. ;;
  224. esac
  225. done
  226. if [ "${#}" -lt "1" ]; then
  227. log_failure_msg "Usage: reloadproc [-p pidfile] pathname"
  228. return 2
  229. fi
  230. # This will ensure compatibility with previous LFS Bootscripts
  231. if [ -n "${PIDFILE}" ]; then
  232. pidfile="${PIDFILE}"
  233. fi
  234. # Is the process running?
  235. if [ -z "${pidfile}" ]; then
  236. pidofproc -s "${1}"
  237. else
  238. pidofproc -s -p "${pidfile}" "${1}"
  239. fi
  240. # Warn about stale pid file
  241. if [ "$?" = 1 ]; then
  242. boot_mesg -n "Removing stale pid file: ${pidfile}. " ${WARNING}
  243. rm -f "${pidfile}"
  244. fi
  245. if [ -n "${pidlist}" ]; then
  246. for pid in ${pidlist}
  247. do
  248. kill -"${RELOADSIG}" "${pid}" || failure="1"
  249. done
  250. (exit ${failure})
  251. evaluate_retval
  252. else
  253. boot_mesg "Process ${1} not running." ${WARNING}
  254. echo_warning
  255. fi
  256. }
  257. statusproc()
  258. {
  259. local pidfile=""
  260. local base=""
  261. local ret=""
  262. while true
  263. do
  264. case "${1}" in
  265. -p)
  266. pidfile="${2}"
  267. shift 2
  268. ;;
  269. -*)
  270. log_failure_msg "Unknown Option: ${1}"
  271. return 2
  272. ;;
  273. *)
  274. break
  275. ;;
  276. esac
  277. done
  278. if [ "${#}" != "1" ]; then
  279. shift 1
  280. log_failure_msg "Usage: statusproc [-p pidfile] pathname"
  281. return 2
  282. fi
  283. # Get the process basename
  284. base="${1##*/}"
  285. # This will ensure compatibility with previous LFS Bootscripts
  286. if [ -n "${PIDFILE}" ]; then
  287. pidfile="${PIDFILE}"
  288. fi
  289. # Is the process running?
  290. if [ -z "${pidfile}" ]; then
  291. pidofproc -s "${1}"
  292. else
  293. pidofproc -s -p "${pidfile}" "${1}"
  294. fi
  295. # Store the return status
  296. ret=$?
  297. if [ -n "${pidlist}" ]; then
  298. ${ECHO} -e "${INFO}${base} is running with Process"\
  299. "ID(s) ${pidlist}.${NORMAL}"
  300. else
  301. if [ -n "${base}" -a -e "/var/run/${base}.pid" ]; then
  302. ${ECHO} -e "${WARNING}${1} is not running but"\
  303. "/var/run/${base}.pid exists.${NORMAL}"
  304. else
  305. if [ -n "${pidfile}" -a -e "${pidfile}" ]; then
  306. ${ECHO} -e "${WARNING}${1} is not running"\
  307. "but ${pidfile} exists.${NORMAL}"
  308. else
  309. ${ECHO} -e "${INFO}${1} is not running.${NORMAL}"
  310. fi
  311. fi
  312. fi
  313. # Return the status from pidofproc
  314. return $ret
  315. }
  316. # The below functions are documented in the LSB-generic 2.1.0
  317. #*******************************************************************************
  318. # Function - pidofproc [-s] [-p pidfile] pathname
  319. #
  320. # Purpose: This function returns one or more pid(s) for a particular daemon
  321. #
  322. # Inputs: -p pidfile, use the specified pidfile instead of pidof
  323. # pathname, path to the specified program
  324. #
  325. # Outputs: return 0 - Success, pid's in stdout
  326. # return 1 - Program is dead, pidfile exists
  327. # return 2 - Invalid or excessive number of arguments,
  328. # warning in stdout
  329. # return 3 - Program is not running
  330. #
  331. # Dependencies: pidof, echo, head
  332. #
  333. # Todo: Remove dependency on head
  334. # This replaces getpids
  335. # Test changes to pidof
  336. #
  337. #*******************************************************************************
  338. pidofproc()
  339. {
  340. local pidfile=""
  341. local lpids=""
  342. local silent=""
  343. pidlist=""
  344. while true
  345. do
  346. case "${1}" in
  347. -p)
  348. pidfile="${2}"
  349. shift 2
  350. ;;
  351. -s)
  352. # Added for legacy opperation of getpids
  353. # eliminates several '> /dev/null'
  354. silent="1"
  355. shift 1
  356. ;;
  357. -*)
  358. log_failure_msg "Unknown Option: ${1}"
  359. return 2
  360. ;;
  361. *)
  362. break
  363. ;;
  364. esac
  365. done
  366. if [ "${#}" != "1" ]; then
  367. shift 1
  368. log_failure_msg "Usage: pidofproc [-s] [-p pidfile] pathname"
  369. return 2
  370. fi
  371. if [ -n "${pidfile}" ]; then
  372. if [ ! -r "${pidfile}" ]; then
  373. return 3 # Program is not running
  374. fi
  375. lpids=`head -n 1 ${pidfile}`
  376. for pid in ${lpids}
  377. do
  378. if [ "${pid}" -ne "$$" -a "${pid}" -ne "${PPID}" ]; then
  379. kill -0 "${pid}" 2>/dev/null &&
  380. pidlist="${pidlist} ${pid}"
  381. fi
  382. if [ "${silent}" != "1" ]; then
  383. echo "${pidlist}"
  384. fi
  385. test -z "${pidlist}" &&
  386. # Program is dead, pidfile exists
  387. return 1
  388. # else
  389. return 0
  390. done
  391. else
  392. pidlist=`pidof -o $$ -o $PPID -x "$1"`
  393. if [ "${silent}" != "1" ]; then
  394. echo "${pidlist}"
  395. fi
  396. # Get provide correct running status
  397. if [ -n "${pidlist}" ]; then
  398. return 0
  399. else
  400. return 3
  401. fi
  402. fi
  403. if [ "$?" != "0" ]; then
  404. return 3 # Program is not running
  405. fi
  406. }
  407. #*******************************************************************************
  408. # Function - loadproc [-f] [-n nicelevel] [-p pidfile] pathname [args]
  409. #
  410. # Purpose: This runs the specified program as a daemon
  411. #
  412. # Inputs: -f, run the program even if it is already running
  413. # -n nicelevel, specifies a nice level. See nice(1).
  414. # -p pidfile, uses the specified pidfile
  415. # pathname, pathname to the specified program
  416. # args, arguments to pass to specified program
  417. #
  418. # Outputs: return 0 - Success
  419. # return 2 - Invalid of excessive number of arguments,
  420. # warning in stdout
  421. # return 4 - Program or service status is unknown
  422. #
  423. # Dependencies: nice, rm
  424. #
  425. # Todo: LSB says this should be called start_daemon
  426. # LSB does not say that it should call evaluate_retval
  427. # It checks for PIDFILE, which is deprecated.
  428. # Will be removed after BLFS 6.0
  429. # loadproc returns 0 if program is already running, not LSB compliant
  430. #
  431. #*******************************************************************************
  432. loadproc()
  433. {
  434. local pidfile=""
  435. local forcestart=""
  436. local nicelevel="10"
  437. # This will ensure compatibility with previous LFS Bootscripts
  438. if [ -n "${PIDFILE}" ]; then
  439. pidfile="${PIDFILE}"
  440. fi
  441. while true
  442. do
  443. case "${1}" in
  444. -f)
  445. forcestart="1"
  446. shift 1
  447. ;;
  448. -n)
  449. nicelevel="${2}"
  450. shift 2
  451. ;;
  452. -p)
  453. pidfile="${2}"
  454. shift 2
  455. ;;
  456. -*)
  457. log_failure_msg "Unknown Option: ${1}"
  458. return 2 #invalid or excess argument(s)
  459. ;;
  460. *)
  461. break
  462. ;;
  463. esac
  464. done
  465. if [ "${#}" = "0" ]; then
  466. log_failure_msg "Usage: loadproc [-f] [-n nicelevel] [-p pidfile] pathname [args]"
  467. return 2 #invalid or excess argument(s)
  468. fi
  469. if [ -z "${forcestart}" ]; then
  470. if [ -z "${pidfile}" ]; then
  471. pidofproc -s "${1}"
  472. else
  473. pidofproc -s -p "${pidfile}" "${1}"
  474. fi
  475. case "${?}" in
  476. 0)
  477. log_warning_msg "Unable to continue: ${1} is running"
  478. return 0 # 4
  479. ;;
  480. 1)
  481. boot_mesg "Removing stale pid file: ${pidfile}" ${WARNING}
  482. rm -f "${pidfile}"
  483. ;;
  484. 3)
  485. ;;
  486. *)
  487. log_failure_msg "Unknown error code from pidofproc: ${?}"
  488. return 4
  489. ;;
  490. esac
  491. fi
  492. nice -n "${nicelevel}" "${@}"
  493. evaluate_retval # This is "Probably" not LSB compliant,
  494. # but required to be compatible with older bootscripts
  495. return 0
  496. }
  497. #*******************************************************************************
  498. # Function - killproc [-p pidfile] pathname [signal]
  499. #
  500. # Purpose:
  501. #
  502. # Inputs: -p pidfile, uses the specified pidfile
  503. # pathname, pathname to the specified program
  504. # signal, send this signal to pathname
  505. #
  506. # Outputs: return 0 - Success
  507. # return 2 - Invalid of excessive number of arguments,
  508. # warning in stdout
  509. # return 4 - Unknown Status
  510. #
  511. # Dependencies: kill, rm
  512. #
  513. # Todo: LSB does not say that it should call evaluate_retval
  514. # It checks for PIDFILE, which is deprecated.
  515. # Will be removed after BLFS 6.0
  516. #
  517. #*******************************************************************************
  518. killproc()
  519. {
  520. local pidfile=""
  521. local killsig=TERM # default signal is SIGTERM
  522. pidlist=""
  523. # This will ensure compatibility with previous LFS Bootscripts
  524. if [ -n "${PIDFILE}" ]; then
  525. pidfile="${PIDFILE}"
  526. fi
  527. while true
  528. do
  529. case "${1}" in
  530. -p)
  531. pidfile="${2}"
  532. shift 2
  533. ;;
  534. -*)
  535. log_failure_msg "Unknown Option: ${1}"
  536. return 2
  537. ;;
  538. *)
  539. break
  540. ;;
  541. esac
  542. done
  543. if [ "${#}" = "2" ]; then
  544. killsig="${2}"
  545. elif [ "${#}" != "1" ]; then
  546. shift 2
  547. log_failure_msg "Usage: killproc [-p pidfile] pathname [signal]"
  548. return 2
  549. fi
  550. # Is the process running?
  551. if [ -z "${pidfile}" ]; then
  552. pidofproc -s "${1}"
  553. else
  554. pidofproc -s -p "${pidfile}" "${1}"
  555. fi
  556. # Remove stale pidfile
  557. if [ "$?" = 1 ]; then
  558. boot_mesg "Removing stale pid file: ${pidfile}." ${WARNING}
  559. rm -f "${pidfile}"
  560. fi
  561. # If running, send the signal
  562. if [ -n "${pidlist}" ]; then
  563. for pid in ${pidlist}
  564. do
  565. kill -${killsig} ${pid} 2>/dev/null
  566. # Wait up to 3 seconds, for ${pid} to terminate
  567. case "${killsig}" in
  568. TERM|SIGTERM|KILL|SIGKILL)
  569. # sleep in 1/10ths of seconds and
  570. # multiply KILLDELAY by 10
  571. local dtime="${KILLDELAY}0"
  572. while [ "${dtime}" != "0" ]
  573. do
  574. kill -0 ${pid} 2>/dev/null || break
  575. sleep 0.1
  576. dtime=$(( ${dtime} - 1))
  577. done
  578. # If ${pid} is still running, kill it
  579. kill -0 ${pid} 2>/dev/null && kill -KILL ${pid} 2>/dev/null
  580. ;;
  581. esac
  582. done
  583. # Check if the process is still running if we tried to stop it
  584. case "${killsig}" in
  585. TERM|SIGTERM|KILL|SIGKILL)
  586. if [ -z "${pidfile}" ]; then
  587. pidofproc -s "${1}"
  588. else
  589. pidofproc -s -p "${pidfile}" "${1}"
  590. fi
  591. # Program was terminated
  592. if [ "$?" != "0" ]; then
  593. # Remove the pidfile if necessary
  594. if [ -f "${pidfile}" ]; then
  595. rm -f "${pidfile}"
  596. fi
  597. echo_ok
  598. return 0
  599. else # Program is still running
  600. echo_failure
  601. return 4 # Unknown Status
  602. fi
  603. ;;
  604. *)
  605. # Just see if the kill returned successfully
  606. evaluate_retval
  607. ;;
  608. esac
  609. else # process not running
  610. print_status warning not_running
  611. fi
  612. }
  613. #*******************************************************************************
  614. # Function - log_success_msg "message"
  615. #
  616. # Purpose: Print a success message
  617. #
  618. # Inputs: $@ - Message
  619. #
  620. # Outputs: Text output to screen
  621. #
  622. # Dependencies: echo
  623. #
  624. # Todo: logging
  625. #
  626. #*******************************************************************************
  627. log_success_msg()
  628. {
  629. ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
  630. ${ECHO} -e "${SET_COL}""${BRACKET}""[""${SUCCESS}"" OK ""${BRACKET}""]""${NORMAL}"
  631. ${ECHO} -n -e "${@} [ OK ]" >> /run/var/bootlog
  632. return 0
  633. }
  634. #*******************************************************************************
  635. # Function - log_failure_msg "message"
  636. #
  637. # Purpose: Print a failure message
  638. #
  639. # Inputs: $@ - Message
  640. #
  641. # Outputs: Text output to screen
  642. #
  643. # Dependencies: echo
  644. #
  645. # Todo: logging
  646. #
  647. #*******************************************************************************
  648. log_failure_msg() {
  649. ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
  650. ${ECHO} -e "${SET_COL}""${BRACKET}""[""${FAILURE}"" FAIL ""${BRACKET}""]""${NORMAL}"
  651. ${ECHO} -e "${@} [ FAIL ]" >> /run/var/bootlog
  652. return 0
  653. }
  654. #*******************************************************************************
  655. # Function - log_warning_msg "message"
  656. #
  657. # Purpose: print a warning message
  658. #
  659. # Inputs: $@ - Message
  660. #
  661. # Outputs: Text output to screen
  662. #
  663. # Dependencies: echo
  664. #
  665. # Todo: logging
  666. #
  667. #*******************************************************************************
  668. log_warning_msg() {
  669. ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
  670. ${ECHO} -e "${SET_COL}""${BRACKET}""[""${WARNING}"" WARN ""${BRACKET}""]""${NORMAL}"
  671. ${ECHO} -e "${@} [ WARN ]" >> /run/var/bootlog
  672. return 0
  673. }
  674. #*******************************************************************************
  675. # Function - log_skipped_msg "message"
  676. #
  677. # Purpose: print a message that the script was skipped
  678. #
  679. # Inputs: $@ - Message
  680. #
  681. # Outputs: Text output to screen
  682. #
  683. # Dependencies: echo
  684. #
  685. # Todo: logging
  686. #
  687. #*******************************************************************************
  688. log_skipped_msg() {
  689. ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
  690. ${ECHO} -e "${SET_COL}""${BRACKET}""[""${WARNING}"" SKIP ""${BRACKET}""]""${NORMAL}"
  691. ${ECHO} -e "${@} [ SKIP ]" >> /run/var/bootlog
  692. return 0
  693. }
  694. # End boot functions