source: freewrt/package/fwifupdown/files/mprint.sh@ f8c14cc

Last change on this file since f8c14cc was 4624b5d, checked in by Christian Fischer <spaetzle@…>, 19 years ago

Added package fwifupdown, added busybox ifupdown patch

git-svn-id: svn://www.freewrt.org/trunk/freewrt@2373 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 1.6 KB
Line 
1#!/bin/sh
2#
3# This file is part of the FreeWRT project. FreeWRT is copyrighted
4# material, please see the LICENCE file in the top-level directory
5# or at http://www.freewrt.org/licence for details.
6#
7# Christian Fischer <spaetzle@freewrt.org>
8#
9
10GOOD='\x1B[32;01m'
11WARN='\x1B[33;01m'
12BAD='\x1B[31;01m'
13HILITE='\x1B[36;01m'
14BRACKET='\x1B[34;01m'
15NORMAL='\x1B[0m'
16
17TAB=2
18ENDCOL='\x1B[200C\x1B[6D'
19FIRSTCOL='\x0D'
20MP_GOOD=" ${GOOD}*${NORMAL} "
21MP_BAD=" ${BAD}*${NORMAL} "
22MP_NONE='\x1B[3C'
23ME_GOOD="${ENDCOL}${BRACKET}[ ${GOOD}ok${BRACKET} ]"
24ME_BAD="${ENDCOL}${BRACKET}[ ${BAD}!!${BRACKET} ]"
25
26
27mprint() {
28 local opt msg logmsg color chars savelastlog
29 case $1 in
30 -n)
31 shift
32 opt='-ne'
33# msg="${MPREFIX}${STARTCOL}${MCOLOR}${1}"
34 msg="${FIRSTCOL}${MP_GOOD}${STARTCOL}${MCOLOR}${1}"
35
36 logmsg=$1
37 savelastlog=1
38 ;;
39 -d)
40 shift
41 opt='-e'
42 #msg="${MPREFIX}${STARTCOL}${MCOLOR}${1} ..."
43 msg="${FIRSTCOL}${MP_GOOD}${STARTCOL}${MCOLOR}${1} ..."
44 logmsg=$1
45 ;;
46 -e)
47 shift
48 opt='-e'
49 case "$1" in
50 0)
51 msg="${FIRSTCOL}${MP_GOOD}${ME_GOOD}"
52 logmsg="ok"
53 ;;
54 *)
55 msg="${FIRSTCOL}${MP_BAD}${ME_BAD}"
56 logmsg="!!"
57 ;;
58 esac
59 ;;
60 *)
61 opt='-e'
62# msg="${MPREFIX}${STARTCOL}${MCOLOR}${1}"
63# msg="${FIRSTCOL}${MP_GOOD}${STARTCOL}${MCOLOR}${1}"
64 msg="${FIRSTCOL}${MP_NONE}${STARTCOL}${1}${2}${NORMAL}"
65 logmsg=$2
66 ;;
67 esac
68
69 config $FWIFUD_RT_STDOUT && echo $opt ${msg}${NORMAL}
70
71 if config $FWIFUD_RT_SYSLOG
72 then
73 # if config $savelastlog
74 # then
75 logger -t ifupdown "$logmsg"
76 # sed -i -e "s/LASTLOG=*/LASTLOG=$logmsg/g" $ENVFILE
77 # else
78 # logger -t ifupdown "$LASTLOG : $logmsg"
79 # fi
80 fi
81
82 MPREFIX=$MP_GOOD
83}
84
85
86
87# vim:ts=4
Note: See TracBrowser for help on using the repository browser.