Magellan Linux

Annotation of /trunk/installer-simple/functions/common.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2445 - (hide annotations) (download) (as text)
Tue Jan 7 14:54:35 2014 UTC (10 years, 4 months ago) by niro
File MIME type: application/x-sh
File size: 661 byte(s)
-add common.sh
1 niro 2445 save_screen()
2     {
3     if [ -x $(type -P tput) ]
4     then
5     tput smcup
6     fi
7     }
8    
9     restore_screen()
10     {
11     if [ -x $(type -P tput) ]
12     then
13     tput rmcup
14     fi
15     }
16    
17     clearconfig()
18     {
19     local confdir
20     [[ -z ${CONFIG} ]] && die "No \$CONFIG given!"
21    
22     confdir="$(dirname ${CONFIG})"
23     if [[ ! -d ${confdir} ]]
24     then
25     install -d ${confdir} || die
26     fi
27     : > ${CONFIG}
28     }
29    
30     addconfig()
31     {
32     local confdir
33     local opts
34    
35     [[ -z ${CONFIG} ]] && die "No \$CONFIG given!"
36    
37     confdir="$(dirname ${CONFIG})"
38     if [[ ! -d ${confdir} ]]
39     then
40     install -d ${confdir} || die
41     fi
42    
43     # check for opts
44     case $1 in
45     -n) shift; opts=" -n" ;;
46     -e) shift; opts=" -e" ;;
47     esac
48    
49     echo ${opts} "$@" >> ${CONFIG} || die
50     }