~ubuntu-branches/ubuntu/quantal/lsb/quantal-proposed

« back to all changes in this revision

Viewing changes to remove_initd

  • Committer: Bazaar Package Importer
  • Author(s): Chris Lawrence
  • Date: 2005-03-27 21:42:24 UTC
  • mto: (1.1.3 squeeze)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20050327214224-ptr2vsz557dpai0d
Tags: 2.0-7
Fix Replaces line to use the correct version in lsb-base.
(Closes: #301694, RC; Closes: #301747)

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
if len(sys.argv) > 1:
6
6
    initfile = sys.argv[1]
 
7
    # If the absolute path isn't specified, assume it's relative to
 
8
    # cwd; if that doesn't exist, try /etc/init.d
 
9
    ap = os.path.abspath(initfile)
 
10
    if os.path.exists(ap):
 
11
        initfile = ap
 
12
    else:
 
13
        initfile = os.path.join('/etc/init.d', initfile)
7
14
else:
8
15
    print >> sys.stderr, 'Usage: %s /etc/init.d/<init-script>' % sys.argv[0]
9
16
    sys.exit(1)
13
20
provides = headers.get('Provides')
14
21
if provides:
15
22
    facilities = initdutils.load_facilities()
 
23
    depends = initdutils.load_depends()
16
24
 
17
25
    for facility in provides:
18
 
        if facilities.has_key(facility):
19
 
            entries = []
20
 
            for entry in facilities[facility]:
 
26
        if facility in facilities:
 
27
            entries = {}
 
28
            for entry in facilities[facility].items():
21
29
                if entry[0] != initfile:
22
 
                    entries.append(entry)
 
30
                    entries[entry[0]] = entry[1]
23
31
            facilities[facility] = entries
24
32
 
 
33
    for (initscript, needed) in depends.iteritems():
 
34
        for facility in needed:
 
35
            if facility[0] == "$":
 
36
                continue
 
37
            if not facilities.get(facility) and facility in provides:
 
38
                print >> sys.stderr, 'Unable to remove %s: %s needs %s\n' % (
 
39
                    initfile, initscript, facility)
 
40
                sys.exit(1)
 
41
 
 
42
    if initfile in depends:
 
43
        del depends[initfile]
 
44
        initdutils.save_depends(depends)
 
45
 
25
46
    initdutils.save_facilities(facilities)
26
47
 
27
48
initfile = initfile.replace('/etc/init.d/', '')