1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
4 # T2 SDE: package/.../sysvinit/parse-config
5 # Copyright (C) 2004 - 2005 The T2 SDE Project
6 # Copyright (C) 1998 - 2003 ROCK Linux Project
8 # More information can be found in the files COPYING and README.
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
18 pkg_sysvinit_install_init "$SDECFG_INIT_STYLE" $1 $2
22 pkg_sysvinit_install_init() {
23 local initstyle="$1" name="$2" file="$3"
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"
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
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
49 echo "The script '$name' has the priority $pri." \
50 > $initdir/rcX.d/X$spri$name