OpenSDE Packages Database (without history before r20070)
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.

55 lines
1.8 KiB

  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 - 2006 The T2 SDE Project
  6. # Copyright (C) 1998 - 2003 Clifford Wolf
  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 ---
  15. if [ "$SDECFG_INIT" = "sysvinit" ]; then
  16. install_init() {
  17. pkg_sysvinit_install_init "$SDECFG_INIT_STYLE" $1 $2
  18. }
  19. fi
  20. pkg_sysvinit_install_init() {
  21. local initstyle="$1" name="$2" file="$3"
  22. local condition=
  23. set `grep '# Runlevel: ' $file | cut -f3- -d' '`
  24. spri=$1 ; kpri=`expr 100 - $spri` ; initdir="$root/etc/rc.d" ; shift
  25. grep '^# Install when: ' $file | cut -d: -f2- | while read -r condition; do
  26. eval "[ $condition ] || return"
  27. done
  28. echo -n "Install SysV Init script '$name' ($spri/$kpri): "
  29. m4 -Dinitstyle=$initstyle \
  30. -D"D_prefix=/$prefix" -D"D_sysconfdir=$sysconfdir" \
  31. -D"D_docdir=$docdir" -D"D_localstatedir=$localstatedir" \
  32. -D"D_datadir=$datadir" -D"D_infodir=$infodir" \
  33. -D"D_bindir=$bindir" -D"D_sbindir=$sbindir" \
  34. -D"D_libdir=$libdir" -D"D_mandir=$mandir" \
  35. $base/package/base/sysvinit/init_macros.m4 \
  36. $file > $root/sbin/init.d/$name
  37. chmod +x $root/sbin/init.d/$name
  38. #
  39. for runlevel ; do
  40. echo -n " $runlevel"
  41. if [ "$runlevel" != rcX ] ; then
  42. ln -sf ../init.d/$name $initdir/$runlevel.d/S$spri$name
  43. ln -sf ../init.d/$name $initdir/$runlevel.d/K$kpri$name
  44. else
  45. echo "The script '$name' has the priority $pri." \
  46. > $initdir/rcX.d/X$spri$name
  47. fi
  48. done
  49. #
  50. echo " done."
  51. }