File: ltsp_functions

package info (click to toggle)
ltsp 0.99debian11
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 976 kB
  • ctags: 103
  • sloc: sh: 1,320; python: 485; ansic: 436; lex: 152; makefile: 129; yacc: 58
file content (45 lines) | stat: -rw-r--r-- 822 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
get_cfg(){
    #
    # Usage:  get_cfg PARM [DEFAULT]
    #
    VALUE=`getltscfg $1`
    if [ "$#" -gt 1 -a -z "${VALUE}" ]; then
        echo $2
    else
        echo ${VALUE}
    fi
}

pr_warn(){
    if [ -w /proc/progress ]; then
        echo w >/proc/progress
    fi
}

pr_fail(){
    if [ -w /proc/progress ]; then
        echo f >/proc/progress
    fi
}

pr_set(){
    if [ -w /proc/progress ]; then
        echo $1 $2 >/proc/progress
        SLEEP=${SLEEP:-0}
        [ "${SLEEP}" -gt 0 ] && sleep ${SLEEP}
    fi
}

# Store variable.  Where is this info used? [pere 2006-02-12]
reg_info(){
    VAR=$1
    [ -d /tmp/info ] || mkdir /tmp/info
    eval "echo \$${VAR}" >/tmp/info/${VAR}
}

boolean_is_true(){
    case "$(echo $1 | tr 'A-Z' 'a-z')" in
       true|y|yes) return 0 ;; 
       *) return 1 ;; 
    esac
}