SHA256
1
0
forked from pool/rpmlint
rpmlint/suse-rclink-check.diff

46 lines
1.6 KiB
Diff
Raw Normal View History

--- InitScriptCheck.py
+++ InitScriptCheck.py
@@ -51,7 +51,7 @@
return
initscript_list = []
-
+ rclinks = set()
# check chkconfig call in %post and %preun
postin = pkg[rpm.RPMTAG_POSTIN] or pkg[rpm.RPMTAG_POSTINPROG]
@@ -60,6 +60,9 @@
for fname, pkgfile in pkg.files().items():
+ if stat.S_ISLNK(pkgfile.mode) and fname.startswith("/usr/sbin/rc"):
+ rclinks.add(fname.partition('/rc')[2])
+
if not fname.startswith('/etc/init.d/') and \
not fname.startswith('/etc/rc.d/init.d/'):
continue
@@ -199,6 +202,12 @@
if not subsys_regex_found:
printError(pkg, 'subsys-not-used', fname)
+ for script in initscript_list:
+ if script.startswith("rc") or script.startswith("boot."):
+ continue
+ if not script in rclinks:
+ printWarning(pkg, 'suse-missing-rclink', script)
+
goodnames = (pkg.name.lower(), pkg.name.lower() + 'd')
if len(initscript_list) == 1 and initscript_list[0] not in goodnames:
printWarning(pkg, 'incoherent-init-script-name', initscript_list[0],
@@ -229,6 +238,10 @@
'''The package contains an init script but doesn't contain a %postun
with a call to %insserv_cleanup-postun''',
+'suse-missing-rclink',
+'''The package contains an init script with the given name but does not
+have contain the SUSE policy symlink /usr/sbin/rcFOO -> /etc/init.d/FOO''',
+
'preun-without-chkconfig',
'''The package contains an init script but doesn't call chkconfig in its
%preun script.''',