You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.8 KiB

# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../sysvinit/parse-config
# Copyright (C) 2004 - 2006 The T2 SDE Project
# Copyright (C) 1998 - 2003 Clifford Wolf
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---
if [ "$SDECFG_INIT" = "sysvinit" ]; then
install_init() {
pkg_sysvinit_install_init "$SDECFG_INIT_STYLE" $1 $2
}
fi
pkg_sysvinit_install_init() {
local initstyle="$1" name="$2" file="$3"
local condition=
set `grep '# Runlevel: ' $file | cut -f3- -d' '`
spri=$1 ; kpri=`expr 100 - $spri` ; initdir="$root/etc/rc.d" ; shift
grep '^# Install when: ' $file | cut -d: -f2- | while read -r condition; do
eval "[ $condition ] || return"
done
echo -n "Install SysV Init script '$name' ($spri/$kpri): "
m4 -Dinitstyle=$initstyle \
-D"D_prefix=/$prefix" -D"D_sysconfdir=$sysconfdir" \
-D"D_docdir=$docdir" -D"D_localstatedir=$localstatedir" \
-D"D_datadir=$datadir" -D"D_infodir=$infodir" \
-D"D_bindir=$bindir" -D"D_sbindir=$sbindir" \
-D"D_libdir=$libdir" -D"D_mandir=$mandir" \
$base/package/base/sysvinit/init_macros.m4 \
$file > $root/sbin/init.d/$name
chmod +x $root/sbin/init.d/$name
#
for runlevel ; do
echo -n " $runlevel"
if [ "$runlevel" != rcX ] ; then
ln -sf ../init.d/$name $initdir/$runlevel.d/S$spri$name
ln -sf ../init.d/$name $initdir/$runlevel.d/K$kpri$name
else
echo "The script '$name' has the priority $pri." \
> $initdir/rcX.d/X$spri$name
fi
done
#
echo " done."
}