File: 24_fsckfix.py

package info (click to toggle)
selinux-basics 0.5.0
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 140 kB
  • sloc: python: 279; sh: 217; perl: 43; makefile: 26
file content (26 lines) | stat: -rw-r--r-- 658 bytes parent folder | download | duplicates (4)
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
class TestFSCKFix(TestBase):
	"""
	Suggest to use FSCKFIX in /etc/default/rcS
	"""
	class ErrorFSCKFix(ErrorBase):
		def __str__(self):
			return "FSCKFIX is not enabled - not serious, but could prevent system from booting..."

	@staticmethod
	def test():
		import os, re
		r = re.compile(r'^\s*FSCKFIX=.*yes')

		if os.access("/etc/default/rcS", os.F_OK):
			fsckfix = False
			f = open("/etc/default/rcS","r")
			for line in f.readlines():
				if r.match(line):
					fsckfix = True
			f.close()
			if not fsckfix:
				return [TestFSCKFix.ErrorFSCKFix()]
		else:
			raise "/etc/default/rcS not found, is this Debian?"
		return []
register_test(TestFSCKFix)