aboutsummaryrefslogtreecommitdiffstats
path: root/lib/isodumper.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/isodumper.py')
-rwxr-xr-xlib/isodumper.py186
1 files changed, 0 insertions, 186 deletions
diff --git a/lib/isodumper.py b/lib/isodumper.py
index 98f47c5..9b95b11 100755
--- a/lib/isodumper.py
+++ b/lib/isodumper.py
@@ -55,18 +55,6 @@ class UDisks2(object):
raise NoUDisks2()
raise
- def node_mountpoint(self,node):
-
- def de_mangle(raw):
- return raw.replace('\\040', ' ').replace('\\011', '\t').replace('\\012',
- '\n').replace('\\0134', '\\')
-
- for line in open('/proc/mounts').readlines():
- line = line.split()
- if line[0] == node:
- return de_mangle(line[1])
- return None
-
def device(self, device_node_path):
device_node_path = os.path.realpath(device_node_path)
devname = device_node_path.split('/')[-1]
@@ -134,52 +122,11 @@ class UDisks2(object):
list.append(item)
return list
- def mount(self, device_node_path):
- try:
- d = self.device(device_node_path)
- mount_options = ['rw', 'noexec', 'nosuid',
- 'nodev','uid=%d'%os.geteuid(), 'gid=%d'%os.getegid()]
- r=d.Mount(
- {
- 'auth.no_user_interaction':True,
- 'options':','.join(mount_options)
- },
- dbus_interface=self.FILESYSTEM)
- return unicode(r)
- except:
- # May be already mounted, check
- mp = self.node_mountpoint(str(device_node_path))
- print mp, sys.exc_info()[0]
- if mp is None:
- raise ValueError(sys.exc_info()[0])
- return mp
-
def unmount(self, device_node_path):
d = self.device(device_node_path)
d.Unmount({'force':True, 'auth.no_user_interaction':True},
dbus_interface=self.FILESYSTEM)
- def drive_for_device(self, device):
- drive = device.Get(self.BLOCK, 'Drive',
- dbus_interface='org.freedesktop.DBus.Properties')
- return self.bus.get_object('org.freedesktop.UDisks2', drive)
-
- def eject(self, device_node_path):
- drive = self.drive_for_device(self.device(device_node_path))
- drive.Eject({'auth.no_user_interaction':True},
- dbus_interface=self.DRIVE)
-#
-#def countFiles(directory):
-# files = []
-# if os.path.isdir(directory):
-# for path, dirs, filenames in os.walk(directory):
-# files.extend(filenames)
-# return len(files)
-#
-#def makedirs(dest):
-# if not os.path.exists(dest):
-# os.makedirs(dest)
-
class IsoDumper:
def __init__(self,user):
APP="isodumper"
@@ -460,9 +407,6 @@ class IsoDumper:
source = self.chooser.get_filename()
target = self.dev.split('(')[1].split(')')[0]
dialog = self.wTree.get_widget("confirm_dialog")
-# if self.backup.get_active() :
-# backup_dest=self.backup_select.get_label()
-# self.logger(_('Image: ')+source)
self.logger(_('Target Device: ')+self.dev)
b = os.path.getsize(source)
if b > (self.deviceSize):
@@ -485,61 +429,6 @@ class IsoDumper:
self.do_umount(target)
dialog.hide()
# Writing step
-# # Iso dump or Uefi preparation
-# uefi_checkbox=self.wTree.get_widget("uefi_check")
-# if uefi_checkbox.get_active():
-# #uefi mode : formats FAT32, names MGALIVE, copies the ISO
-# target = self.dev.split('(')[1].split(')')[0]
-# dev_name="MGALIVE"
-# rc=self.raw_format(target, 'fat32', dev_name)
-# if rc == 5:
-# message = _("An error occurred while creating a partition.")
-# self.logger(message)
-# self.emergency()
-# elif rc == 127:
-# message = _('Authentication error.')
-# self.logger(message)
-# self.emergency()
-# elif rc == 0:
-# message = _('The device was formatted successfully.')
-# self.logger(message)
-## time.sleep(2)
-# seen=False
-# part=target+'1'
-# while(not seen):
-# try:
-# self.u.device(part)
-# seen=True
-# except:
-# seen=False
-# time.sleep(.5)
-# try:
-# dest=self.u.mount(part)
-# except:
-# self.logger(_("Error mounting the partition %s")%part)
-# self.emergency()
-# return
-# if dest!="":
-# self.logger(_("Mounted in: ")+dest)
-# self.returncode=0
-# task = self.files_write(source, dest, b)
-# gobject.idle_add(task.next)
-# self.operation=False
-# while gtk.events_pending():
-# gtk.main_iteration(True)
-# if self.returncode==0:
-# self.success()
-# else:
-# self.logger(_("Error copying files"))
-# self.emergency()
-# else:
-# self.operation=False
-# self.logger(_("Error mounting the partition %s")%part)
-# self.emergency()
-# else:
-# message = _('An error occurred.')
-# self.emergency()
-# else:
#Dump mode
self.returncode=0
b=os.path.getsize(source)
@@ -704,77 +593,12 @@ class IsoDumper:
progress.set_fraction(1.0)
yield False
-# def files_write(self, source, dest, size):
-# self.operation=True
-# self.logger(time.ctime(time.time()))
-# temp_dir='/mnt/MGALIVE'
-# makedirs(temp_dir)
-# self.process=Popen(['mount', '-o', 'loop',source,temp_dir ], shell=False, stdout=PIPE)
-# working=True
-# while working:
-# time.sleep(0.5)
-# self.process.poll()
-# rc=self.process.returncode
-# if rc is None:
-# working=True
-# else:
-# self.process = None
-# working=False
-# self.logger(_('ISO image mounted in ')+temp_dir)
-# progress = self.wTree.get_widget("progressbar")
-# progress.set_sensitive(True)
-# progress.set_text(_('Writing ')+source.split('/')[-1]+_(' to ')+dest)
-# self.logger(_('Executing copy from ')+source+_(' to ')+dest)
-# while gtk.events_pending():
-# gtk.main_iteration(True)
-# total_files=countFiles(temp_dir)
-# self.logger(_("%s file(s) to copy."%total_files))
-# cumuled_size=0
-# if total_files > 0:
-# for path, dirs, filenames in os.walk(temp_dir):
-# for directory in dirs:
-# destDir = path.replace(temp_dir,dest)
-# makedirs(os.path.join(destDir, directory))
-# for sfile in filenames:
-# srcFile = os.path.join(path, sfile)
-# destFile = os.path.join(path.replace(temp_dir, dest), sfile)
-# try:
-# with open(srcFile, 'rb') as fsrc:
-# with open(destFile, 'wb') as fdst:
-# while 1:
-# buf = fsrc.read(256*1024)
-# if not buf:
-# os.fsync(fdst)
-# break
-# fdst.write(buf)
-# cumuled_size += len(buf)
-# progress.set_fraction(min(float(cumuled_size)/size,1))
-# print float(cumuled_size)/size
-# while gtk.events_pending():
-# gtk.main_iteration(True)
-# except:
-# self.returncode=1
-# return
-# while gtk.events_pending():
-# gtk.main_iteration(True)
-# yield True
-# self.process = Popen(['umount', temp_dir ], shell=False, stdout=PIPE)
-# while True :
-# self.process.poll()
-# if self.process.returncode != None:
-# break
-# self.logger(_('Image ')+source.split('/')[-1]+_(' successfully written to ')+dest)
-# self.logger(time.ctime(time.time()))
-# else:
-# self.returncode=1
-#
def success(self):
self.operation=False
dialog = self.wTree.get_widget("success_dialog")
self.final_unsensitive()
resp = dialog.run()
if resp:
-# exit(0)
dialog.hide()
@@ -802,7 +626,6 @@ class IsoDumper:
resp = dialog.run()
if resp:
dialog.hide()
-# self.close()
def final_unsensitive(self):
self.chooser.set_sensitive(False)
@@ -843,11 +666,8 @@ class IsoDumper:
self.log.insert_at_cursor(text+"\n")
def activate_devicelist(self, widget):
-# label = self.wTree.get_widget("to_label")
expander = self.wTree.get_widget("detail_expander")
-# self.devicelist.set_sensitive(True)
expander.set_sensitive(True)
-# label.set_sensitive(True)
self.img_name = self.chooser.get_filename()
write_button = self.wTree.get_widget("write_button")
write_button.set_sensitive(True)
@@ -857,12 +677,6 @@ class IsoDumper:
def activate_backup(self, widget):
self.backup_img_name = self.backup_dir.get_filename()
-# def expander_control(self, widget):
-# # this is darn ugly but still better than the UI behavior of
-# # the unexpanded expander which doesnt reset the window size
-# if widget.get_expanded():
-# gobject.timeout_add(130, lambda: self.window.reshow_with_initial_size())
-
def help_dialog(self, widget):
dialog = self.wTree.get_widget("help_dialog")
dialog.run()