* updated kmousetool (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / package / base / sysvinit / parse-config
blob3271d72f53780aff8818243820290e0cd295543b
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
3
4 # T2 SDE: package/.../sysvinit/parse-config
5 # Copyright (C) 2004 - 2005 The T2 SDE Project
6 # Copyright (C) 1998 - 2003 ROCK Linux Project
7
8 # More information can be found in the files COPYING and README.
9
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; version 2 of the License. A copy of the
13 # GNU General Public License can be found in the file COPYING.
14 # --- T2-COPYRIGHT-NOTE-END ---
16 if [ "$SDECFG_INIT" = "sysvinit" ]; then
17         install_init() {
18                 pkg_sysvinit_install_init "$SDECFG_INIT_STYLE" $1 $2
19         }
22 pkg_sysvinit_install_init() {
23         local initstyle="$1" name="$2" file="$3"
24         local condition=
25         set `grep '# Runlevel: ' $file | cut -f3- -d' '`
26         spri=$1 ; kpri=`expr 100 - $spri` ; initdir="$root/etc/rc.d" ; shift
28         grep '^# Install when: ' $file | cut -d: -f2- | while read -r condition; do
29         eval "[ $condition ] || return"
30         done
32         echo -n "Install SysV Init script '$name' ($spri/$kpri): "
33         m4 -Dinitstyle=$initstyle \
34            -D"D_prefix=/$prefix"  -D"D_sysconfdir=$sysconfdir" \
35            -D"D_docdir=$docdir"   -D"D_localstatedir=$localstatedir" \
36            -D"D_datadir=$datadir" -D"D_infodir=$infodir" \
37            -D"D_bindir=$bindir"   -D"D_sbindir=$sbindir" \
38            -D"D_libdir=$libdir"   -D"D_mandir=$mandir" \
39            $base/package/base/sysvinit/init_macros.m4 \
40            $file > $root/sbin/init.d/$name
41         chmod +x $root/sbin/init.d/$name
42         #
43         for runlevel ; do
44                 echo -n " $runlevel"
45                 if [ "$runlevel" != rcX ] ; then
46                         ln -sf ../init.d/$name $initdir/$runlevel.d/S$spri$name
47                         ln -sf ../init.d/$name $initdir/$runlevel.d/K$kpri$name
48                 else
49                         echo "The script '$name' has the priority $pri." \
50                                         > $initdir/rcX.d/X$spri$name
51                 fi
52         done
53         #
54         echo " done."