29
29
floppyDevice = self.device
31
print " Testing on floppy drive %s " % floppyDevice
31
print(" Testing on floppy drive %s " % floppyDevice)
33
print " Error ! No floppy drive found !"
33
print(" Error ! No floppy drive found !")
35
35
# remove temp files if they exist
36
36
os.system("umount /media/floppy 2>/dev/null")
51
51
os.system("umount %s" % self.image_dir)
53
53
(noFloppyDisk, junkOutput1) = \
54
commands.getstatusoutput("dd bs=1c if=%s count=0 2>/dev/null"
54
subprocess.getstatusoutput("dd bs=1c if=%s count=0 2>/dev/null"
56
56
if noFloppyDisk != 0:
57
print "Error ! No floppy disc or bad media in %s !" % floppyDevice
57
print("Error ! No floppy disc or bad media in %s !" % floppyDevice)
61
print " Writing data to floppy disc ... "
61
print(" Writing data to floppy disc ... ")
62
62
(ddStatus, ddOutput) = \
63
commands.getstatusoutput("dd if=%s of=%s bs=1k count=1440"
63
subprocess.getstatusoutput("dd if=%s of=%s bs=1k count=1440"
64
64
% (self.image, floppyDevice))
66
print " Write data to floppy disc done ! "
66
print(" Write data to floppy disc done ! ")
68
print " Error ! Write data to floppy disc error ! "
69
print " Please check if your floppy disc is write-protected !"
68
print(" Error ! Write data to floppy disc error ! ")
69
print(" Please check if your floppy disc is write-protected !")
72
72
os.system("mount %s %s" % (floppyDevice, self.device_dir))
73
73
os.system("mount -o loop %s %s" % (self.image, self.image_dir))
74
print " Comparing files ... "
74
print(" Comparing files ... ")
75
75
fileList = os.listdir(self.image_dir)
77
77
for textFile in fileList:
78
78
file1 = os.path.join(self.device_dir, textFile)
79
79
file2 = os.path.join(self.image_dir, textFile)
80
80
if filecmp.cmp(file1, file2):
81
print " comparing file %s" % textFile
81
print(" comparing file %s" % textFile)
83
print (" -- Error ! File %s comparison failed ! -- "
83
print(" -- Error ! File %s comparison failed ! -- "
86
print " File comparison done ! "
86
print(" File comparison done ! ")
87
87
# remove temp files
88
88
os.system("umount /media/floppy 2>/dev/null")
89
89
os.system("umount %s %s " % (self.image_dir, self.device_dir))
90
90
os.system("rm -rf %s %s %s"
91
91
% (self.device_dir, self.image_dir, self.image))