root/current/host/trunk/emdebian-tools/trunk/pbuilder/update-rc.d

Revision 4834, 1.3 kB (checked in by codehelp, 4 months ago)

pbuilder/update-rc.d : Use two digit prefixes to set the correct
order during boot

  • Property svn:executable set to *
Line 
1#!/bin/sh
2#
3# Copyright 2008 Hands.com Ltd <phil@hands.com>
4# Copyright 2008 Neil Williams <codehelp@debian.org>
5#
6#  This program is free software; you can redistribute it and/or modify
7#  it under the terms of the GNU General Public License as published by
8#  the Free Software Foundation; either version 3 of the License, or
9#  (at your option) any later version.
10
11initd="/etc/init.d"
12etcd="/etc/rc.d"
13bn=$1;shift
14if [ "$bn" = '-f' ]; then
15        bn=$1
16        shift
17fi
18
19defaults () {
20        makelinks "S${1:-20}"
21        makelinks "K${2:-${1:-20}}"
22}
23
24makelinks () {
25        echo " Adding symlink for $initd/$bn ...";
26        echo "${etcd}/${1}${bn} -> ../init.d/$bn"
27        ln -s "../init.d/$bn" "${etcd}/${1}${bn}"
28}
29
30if [ -z "$bn" -o -z "$1" ]; then
31        echo "Insufficient arguments"
32        exit 1
33fi
34if [ ! -f "$initd/$bn" ]; then
35        echo "update-rc.d: $initd/$bn: file does not exist\n"
36        exit 1
37fi
38if [ "$1" = 'remove' ]; then
39        shift
40        echo "rm -f /etc/rc.d/*${bn}"
41        rm -f "/etc/rc.d/*${bn}"
42        exit;
43elif [ "$1" = 'defaults' ]; then
44        makelinks "S${2:-20}"
45        makelinks "K${3:-${2:-20}}"
46        exit 0;
47else
48        if [ "$1" = 'start' ]
49        then
50                shift
51                num=$1
52                # use two digit prefixes
53                if [ $num -lt 10 ]; then
54                        num="0${num}"
55                fi
56                makelinks "S${num}"
57                while [ "$1" != "." ]
58                do
59                        shift
60                done
61                shift
62                if [ "$1" = 'stop' ]; then
63                        shift
64                        makelinks "K${1}"
65                fi
66        fi
67        exit 0;
68fi
Note: See TracBrowser for help on using the browser.