forked from openSUSE/rpmlint-checks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCheckSysVinitOnSystemd.py
61 lines (50 loc) · 1.73 KB
/
CheckSysVinitOnSystemd.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#############################################################################
# File : CheckSysVinitOnSystemd.py
# Package : rpmlint
# Author : Werner Fink
# Created on : Tue Feb 21 17:34:50 2017
# Purpose : Check on systemd systems for required insserv package
#############################################################################
from Filter import addDetails, printError
import AbstractCheck
import Config
import os
insserv_tag = 'suse-obsolete-insserv-requirement'
etcinit_tag = 'suse-deprecated-init-script'
bootscr_tag = 'suse-deprecated-boot-script'
class CheckSysVinitOnSystemd(AbstractCheck.AbstractFilesCheck):
def __init__(self):
self.map = []
AbstractCheck.AbstractCheck.__init__(self, 'CheckSysVinitOnSystemd')
def check(self, pkg):
if pkg.isSource():
return
for req in pkg.requires() + pkg.prereq():
if req[0] == 'insserv':
printError(pkg, insserv_tag)
for fn, pkgfile in pkg.files().items():
if not fn.startswith('/etc/init.d'):
continue
if os.path.basename(fn).startswith('boot.'):
printError(pkg, bootscr_tag, fn)
else:
printError(pkg, etcinit_tag, fn)
check = CheckSysVinitOnSystemd()
if Config.info:
addDetails(
insserv_tag,
'''In systemd based distributions insserv is obsolete.
Please remove dependencies on insserv.''',
etcinit_tag,
'''SysV init scripts are deprecated. Please migrate to
systemd service files.''',
bootscr_tag,
'''SysV boot scripts are deprecated. Please migrate to
systemd service files.''',
)
# Local variables:
# indent-tabs-mode: nil
# py-indent-offset: 4
# End:
# -*- coding: utf-8 -*-
# vim:sw=4:et: