예제 #1
0
    def test_DistTool(self):
        self.assertTrue(disttool.is_linux())
        self.assertTrue(disttool.is_redhat_based())
        self.assertTrue(disttool.is_fedora())

        self.assertFalse(disttool.is_win())
        self.assertFalse(disttool.is_sun())
        self.assertFalse(disttool.is_debian_based())
예제 #2
0
	def values(self):
		ret = [self.devname, self.mpoint, self.fstype, self.options, \
			 self.dump if self.dump is not None else '', \
			 self.fsckorder if self.fsckorder is not None else '']
		return ['%s' % (v,) for v in ret]
	
		
	def __str__(self):
		return "%s\t%s\t%s\t%s\t%s\t%s" % (
			self.devname, self.mpoint, self.fstype, self.options, 
			self.dump if self.dump is not None else '', 
			self.fsckorder if self.fsckorder is not None else '' 
		)

		
if disttool.is_linux():
	Fstab.LOCATION = "/etc/fstab"	
	Mtab.LOCATION = "/etc/mtab"
	Mtab.LOCAL_FS_TYPES = ('ext2', 'ext3', 'xfs', 'jfs', 'reiserfs', 'tmpfs', 'sysfs', 'proc')
	
elif disttool.is_sun():
	Fstab.LOCATION = "/etc/vfstab"	
	Mtab.LOCATION = "/etc/mnttab"
	Mtab.LOCAL_FS_TYPES = ('ext2', 'ext3', 'xfs', 'jfs', 'reiserfs', 'tmpfs', 
		'ufs', 'sharefs', 'dev', 'devfs', 'ctfs', 'mntfs',
		'proc', 'lofs',   'objfs', 'fd', 'autofs')
	

def mount (device, mpoint = '/mnt', options=None, make_fs=False, fstype='ext3', auto_mount=False):
	if not os.path.exists(mpoint):
		os.makedirs(mpoint)