aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSARL ENR-68 <david@david.david>2014-05-09 14:20:39 +0200
committerSARL ENR-68 <david@david.david>2014-05-09 14:20:39 +0200
commitd4d6c7665d51a0100201049e004e4a0b29a57d23 (patch)
treebd99a34ed1edbabdfa26fc8a05489d210b7e7f11
parent41774d166676112ae8cfda11387ea9642fb7d8e0 (diff)
downloadisodumper-d4d6c7665d51a0100201049e004e4a0b29a57d23.tar
isodumper-d4d6c7665d51a0100201049e004e4a0b29a57d23.tar.gz
isodumper-d4d6c7665d51a0100201049e004e4a0b29a57d23.tar.bz2
isodumper-d4d6c7665d51a0100201049e004e4a0b29a57d23.tar.xz
isodumper-d4d6c7665d51a0100201049e004e4a0b29a57d23.zip
Merge branch '0.30' of https://github.com/papoteur-mga/isodumper
- from 0.30 branch to master branch
-rw-r--r--CHANGELOG13
-rw-r--r--Makefile3
-rw-r--r--README.md1
-rw-r--r--isodumper.spec3
-rwxr-xr-xlib/find_devices21
-rwxr-xr-xlib/find_devices.sh33
-rwxr-xr-xlib/isodumper.py174
-rw-r--r--lib/raw_format.py157
-rw-r--r--share/isodumper/isodumper.glade507
9 files changed, 729 insertions, 183 deletions
diff --git a/CHANGELOG b/CHANGELOG
index c6420b5..7ff92e2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,13 +1,18 @@
The initial state comes from https://launchpad.net/usb-imagewriter
The modifications are:
+IsoDumper 0.30
+------------
+ - added function to format the device in Fat32, ntfs or ext4.
+ - separated backup from writing.
+
IsoDumper 0.21
------------
- added an "About isodumper" window "GtkAboutDialog".
- Integration of find_devices in the main file.
- - fix of the behaviour of windows, not closing the application after escape from the confirmation dialog.
- - fix transmission of the user name to write the log file at the good place.
- - update all translations for new changes.
+ - fix of the behaviour of windows, not closing the application after escape from the confirmation dialog.
+ - fix transmission of the user name to write the log file at the good place.
+ - update all translations for new changes.
IsoDumper 0.20
------------
@@ -20,7 +25,7 @@ IsoDumper 0.20
- fix an error space on a translation string (#: lib/isodumper.py:270)
- added and update Estonian, Danish, Czech, Greek and English (United Kingdom) translations.
- updated de,fr,id,ro,sl,sv,zh_TW,tr,uk,pt_BR,ru,ro,es,it and pl translations.
-
+
IsoDumper 0.13
------------
- added and update Polish and German translations.
diff --git a/Makefile b/Makefile
index f53eb3b..1a73fe3 100644
--- a/Makefile
+++ b/Makefile
@@ -54,9 +54,10 @@ install: all
mkdir -p $(DESTDIR)$(POLKITPOLICYDIR)
install -m 644 polkit/org.mageia.isodumper.policy $(DESTDIR)$(POLKITPOLICYDIR)
- # for LIBFILES isodumper.py find_devices
+ # for LIBFILES isodumper.py raw_format.py
mkdir -p $(DESTDIR)$(LIBDIR)/isodumper
install -m 755 lib/isodumper.py $(DESTDIR)$(LIBDIR)/isodumper
+ install -m 755 lib/raw_format.py $(DESTDIR)$(LIBDIR)/isodumper
# for DATADIR isodumper.py header.png
mkdir -p $(DESTDIR)$(DATADIR)/isodumper
diff --git a/README.md b/README.md
index f0ca375..1ce82e1 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,7 @@ Requirements
- procps
- pygtk2.0-libglade
- python
+- python-parted
- udisks
- xterm
diff --git a/isodumper.spec b/isodumper.spec
index 94934ed..95b80e2 100644
--- a/isodumper.spec
+++ b/isodumper.spec
@@ -1,5 +1,5 @@
Name: isodumper
-Version: 0.21
+Version: 0.30
Release: %mkrel 1
Summary: Tool for writing ISO images on a USB stick
Summary(fr_FR): Outil pour écrire des images ISO sur une clé USB
@@ -19,6 +19,7 @@ Requires: polkit
Requires: procps
Requires: pygtk2.0-libglade
Requires: python
+Requires: python-parted
Requires: udisks
Requires: xterm
diff --git a/lib/find_devices b/lib/find_devices
deleted file mode 100755
index 0b32eac..0000000
--- a/lib/find_devices
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/python
-
-import dbus
-import sys
-
-bus = dbus.SystemBus()
-proxy = bus.get_object("org.freedesktop.UDisks", "/org/freedesktop/UDisks")
-iface = dbus.Interface(proxy, "org.freedesktop.UDisks")
-
-devs = iface.EnumerateDevices()
-
-for dev in devs:
- dev_obj = bus.get_object("org.freedesktop.UDisks", dev)
- dev = dbus.Interface(dev_obj, "org.freedesktop.DBus.Properties")
-
- if str(dev.Get('', 'DriveConnectionInterface')) == 'usb' and not str(dev.Get('', 'PartitionType')) and str(dev.Get('', 'DeviceIsMediaAvailable')) == '1':
- path = str(dev.Get('', 'DeviceFile'))
- vend = str(dev.Get('', 'DriveVendor'))
- model = str(dev.Get('', 'DriveModel'))
- size = str(dev.Get('', 'DeviceSize'))
- print vend + ' ' + model + ', ' +path+', ' + size
diff --git a/lib/find_devices.sh b/lib/find_devices.sh
deleted file mode 100755
index b371be0..0000000
--- a/lib/find_devices.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-#
-# Copyright 2007-2009 Canonical Ltd.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
-
-for device in $(hal-find-by-capability --capability storage); do
- VENDOR=$(hal-get-property --udi $device --key storage.vendor)
- NAME=$(hal-get-property --udi $device --key storage.model)
- PLUGGABLE=$(hal-get-property --udi $device --key storage.hotpluggable)
- TYPE=$(hal-get-property --udi $device --key storage.drive_type)
- DEVPATH=$(hal-get-property --udi $device --key block.device)
- AVAIL=$(hal-get-property --udi $device --key storage.removable.media_available)
-
- if [ "${AVAIL}" = true ] && [ "${PLUGGABLE}" = true ] && \
- ( [ "${TYPE}" = "disk" ] || [ "${TYPE}" = "sd_mmc" ] ); then
- VENDOR=${VENDOR:-"Unknown"}
- NAME=${NAME:-"Unknown"}
- echo "$VENDOR $NAME, $DEVPATH"
- fi
-done
diff --git a/lib/isodumper.py b/lib/isodumper.py
index 17edf2c..e259b58 100755
--- a/lib/isodumper.py
+++ b/lib/isodumper.py
@@ -21,6 +21,8 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+# Requires python-parted
+
import gtk
import gtk.glade
import gobject
@@ -28,7 +30,8 @@ import os
import io
import gettext
from gettext import gettext as _
-from subprocess import call
+from subprocess import call, Popen, PIPE
+import time
def find_devices():
import dbus
@@ -51,25 +54,26 @@ def find_devices():
item.append(path)
item.append(size)
list.append(item)
- print list
return list
class IsoDumper:
- def __init__(self, user):
+ def __init__(self,user):
APP="isodumper"
DIR="/usr/share/locale"
- RELEASE="v0.21"
- # for the localisation of log file
- self.user=user
+ RELEASE="v0.30"
gettext.bindtextdomain(APP, DIR)
gettext.textdomain(APP)
gtk.glade.bindtextdomain(APP, DIR)
gtk.glade.textdomain(APP)
+ # for the localisation of log file
+ self.user=user
+
# get glade tree
self.gladefile = "/usr/share/isodumper/isodumper.glade"
+# self.gladefile = "/documents/isodumper-dev/share/isodumper/isodumper.glade"
self.wTree = gtk.glade.XML(self.gladefile)
# get globally needed widgets
@@ -91,7 +95,7 @@ class IsoDumper:
self.chooser.set_filter(filt)
- # optionnal backup of the device
+ # optionnal backup of the device
self.backup_select = self.wTree.get_widget("backup_select")
self.backup_name = self.wTree.get_widget("backup_name")
self.backup = self.wTree.get_widget("backup")
@@ -102,17 +106,20 @@ class IsoDumper:
# set callbacks
dict = { "on_main_dialog_destroy" : self.close,
"on_cancel_button_clicked" : self.close,
- "on_emergency_button_clicked" : self.close,
+ "on_emergency_button_clicked" : self.restore,
"on_success_button_clicked" : self.close,
+ "on_confirm_cancel_button_clicked": self.restore,
"on_filechooserbutton_file_set" : self.activate_devicelist,
- "on_backup_name_file_set" : self.activate_backup,
"on_detail_expander_activate" : self.expander_control,
"on_device_combobox_changed" : self.device_selected,
"on_nodev_close_clicked" : self.close,
- "on_backup_toggled" : self.enable_backup,
+ "on_backup_button_clicked" : self.backup_go,
"on_backup_select_clicked" : self.backup_sel,
"on_select_clicked" : self.backup_choosed,
"on_about_button_clicked" : self.about,
+ "on_format_button_clicked" : self.format_dialog,
+ "on_format_cancel_clicked" : self.format_cancel,
+ "on_format_go_clicked" : self.do_format,
"on_write_button_clicked" : self.do_write}
self.wTree.signal_autoconnect(dict)
@@ -130,39 +137,127 @@ class IsoDumper:
if (exit_dialog==2) :
dialog.destroy()
exit(0)
- self.combo = self.wTree.get_widget("device_combobox")
+# self.combo = self.wTree.get_widget("device_combobox")
for name, path, size in list:
self.deviceSize=size
# convert in Mbytes
sizeM=str(int(size)/(1024*1024))
- self.combo.append_text(name+' ('+path.lstrip()+') '+sizeM+_('Mb'))
+ self.devicelist.append_text(name+' ('+path.lstrip()+') '+sizeM+_('Mb'))
dialog.destroy()
def device_selected(self, widget):
- write_button = self.wTree.get_widget("write_button")
- write_button.set_sensitive(True)
- self.dev = self.combo.get_active_text()
-
- def enable_backup(self,widget) :
- self.backup_select.set_sensitive(not self.backup_select.get_sensitive())
+ self.dev = self.devicelist.get_active_text()
+ self.backup_select.set_sensitive(True)
+ self.wTree.get_widget("format_button").set_sensitive(True)
+ self.wTree.get_widget("filechooserbutton").set_sensitive(True)
def backup_sel(self,widget):
self.choose.show_all()
def backup_choosed(self, widget):
exit_dialog=self.backup_bname.get_filename()
- if exit_dialog == None:
- # No backup file name indicated
- # Unckeck the choice to backup
- self.backup.set_active(0)
- else:
+ if exit_dialog != None:
# Add .iso if not specified
if not exit_dialog.lower().endswith('.iso'):
exit_dialog=exit_dialog+".iso"
self.backup_select.set_label(exit_dialog)
+ self.wTree.get_widget("backup_button").set_sensitive(True)
self.choose.hide()
+ def format_dialog(self,widget):
+ self.backup_select.set_sensitive(False)
+ format_button=self.wTree.get_widget("format_button")
+ format_button.set_sensitive(False)
+ filechooserbutton=self.wTree.get_widget("filechooserbutton")
+ filechooserbutton.set_sensitive(False)
+ write_button = self.wTree.get_widget("write_button")
+ write_button.set_sensitive(False)
+ self.devicelist.set_sensitive(False)
+ dialog=self.wTree.get_widget("format")
+ dialog.present()
+ self.wTree.get_widget("format_device").set_text(self.dev)
+ self.wTree.get_widget("format_name").set_text(self.dev.split('(')[0])
+ exit_dialog=dialog.show_all()
+ if exit_dialog==0:
+ dialog.hide()
+
+ def do_format(self, widget) :
+ target = self.dev.split('(')[1].split(')')[0]
+ dialog = self.wTree.get_widget("confirm_dialog")
+ resp = dialog.run()
+ dev_name=self.wTree.get_widget("format_name").get_text()
+ if resp:
+ dialog.hide()
+ if self.wTree.get_widget("format_fat").get_active():
+ self.raw_format(target, 'fat32', dev_name.upper()[:11])
+ if self.wTree.get_widget("format_ntfs").get_active():
+ self.raw_format(target, 'ntfs', dev_name[:32])
+ if self.wTree.get_widget("format_ext4").get_active():
+ self.raw_format(target, 'ext4', dev_name)
+ else:
+ dialog.hide()
+
+ def restore(self,widget):
+ self.backup_select.set_sensitive(True)
+ self.wTree.get_widget("format_button").set_sensitive(True)
+ self.wTree.get_widget("filechooserbutton").set_sensitive(True)
+ self.devicelist.set_sensitive(True)
+ self.write_logfile()
+ self.wTree.get_widget("emergency_dialog").hide()
+
+ def raw_format(self, usb_path, fstype, label):
+ if os.geteuid() > 0:
+ launcher='pkexec'
+ self.process = Popen([launcher,'/usr/bin/python', '-u', '/usr/lib/isodumper/raw_format.py','-d',usb_path,'-f',fstype, '-l', label, '-u', str(os.geteuid()), '-g', str(os.getgid())], shell=False, stdout=PIPE, preexec_fn=os.setsid)
+ else:
+ self.process = Popen(['/usr/bin/python', '-u', '/usr/lib/isodumper/raw_format.py','-d',usb_path,'-f',fstype, '-l', label, '-u', str(os.geteuid()), '-g', str(os.getgid())], shell=False, stdout=PIPE, preexec_fn=os.setsid)
+ working=True
+ while working:
+ time.sleep(0.5)
+ self.process.poll()
+ rc=self.process.returncode
+ if rc is None:
+ working=True
+ else:
+ if rc == 0:
+ message = _('The device was formatted successfully.')
+ self.logger(message)
+ self.success()
+ elif rc == 5:
+ message = _("An error occured while creating a partition.")
+ elif rc == 127:
+ message = _('Authentication error.')
+ else:
+ message = _('An error occurred.')
+ self.wTree.get_widget("format").hide()
+ self.logger(message)
+ self.emergency()
+ self.process = None
+ working= False
+ self.backup_select.set_sensitive(True)
+ self.wTree.get_widget("format_button").set_sensitive(True)
+ self.wTree.get_widget("filechooserbutton").set_sensitive(True)
+
+ def format_cancel(self, widget):
+ dialog=self.wTree.get_widget("format")
+ dialog.hide()
+ self.backup_select.set_sensitive(True)
+ format_button=self.wTree.get_widget("format_button")
+ filechooserbutton=self.wTree.get_widget("filechooserbutton")
+ format_button.set_sensitive(True)
+ filechooserbutton.set_sensitive(True)
+ self.devicelist.set_sensitive(True)
+
+ def backup_go(self,widget):
+ dest = self.backup_select.get_label()
+ source = self.dev.split('(')[1].split(')')[0]
+ self.logger(_('Backup in:')+' '+dest)
+ task = self.raw_write(source, dest, eval(self.deviceSize))
+ gobject.idle_add(task.next)
+ while gtk.events_pending():
+ gtk.main_iteration(True)
+
def do_write(self, widget):
write_button = self.wTree.get_widget("write_button")
write_button.set_sensitive(False)
@@ -171,9 +266,8 @@ 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(_('Backup in:')+' '+backup_dest)
+# 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)
@@ -193,17 +287,11 @@ class IsoDumper:
# self.close('dummy')
self.emergency()
dialog.hide()
- self.backup_select.set_sensitive(False)
- self.backup.set_sensitive(False)
+# self.backup_select.set_sensitive(False)
+# self.backup.set_sensitive(False)
self.chooser.set_sensitive(False)
self.do_umount(target)
dialog.hide()
- # Backup step
- if self.backup.get_active() :
- task = self.raw_write(target, backup_dest, eval(self.deviceSize))
- gobject.idle_add(task.next)
- while gtk.events_pending():
- gtk.main_iteration(True)
# Writing step
task = self.raw_write(source, target, os.path.getsize(source))
gobject.idle_add(task.next)
@@ -251,7 +339,7 @@ class IsoDumper:
try:
ifc=io.open(source, "rb",1)
except:
- self.logger(_('Reading error.'))
+ self.logger(_('Reading error.')+ source)
self.emergency()
else:
try:
@@ -324,8 +412,8 @@ class IsoDumper:
self.logview.scroll_to_mark(mark, 0.05, True, 0.0, 1.0)
resp = dialog.run()
if resp:
- dialog.destroy()
- self.close()
+ dialog.hide()
+# self.close()
def final_unsensitive(self):
self.chooser.set_sensitive(False)
@@ -334,6 +422,7 @@ class IsoDumper:
write_button.set_sensitive(False)
progress = self.wTree.get_widget("progressbar")
progress.set_sensitive(False)
+ self.backup_select.set_sensitive(False)
def close(self, widget):
self.write_logfile()
@@ -344,7 +433,7 @@ class IsoDumper:
start = self.log.get_start_iter()
end = self.log.get_end_iter()
if (self.user != 'root') and (self.user !=''):
- home='/home/'+self.user
+ home='/home/'+self.user
else:
home='/root'
if not(os.path.isdir(home+'/.isodumper')):
@@ -357,12 +446,14 @@ class IsoDumper:
self.log.insert_at_cursor(text+"\n")
def activate_devicelist(self, widget):
- label = self.wTree.get_widget("to_label")
+# label = self.wTree.get_widget("to_label")
expander = self.wTree.get_widget("detail_expander")
- self.devicelist.set_sensitive(True)
+# self.devicelist.set_sensitive(True)
expander.set_sensitive(True)
- label.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)
def activate_backup(self, widget):
self.backup_img_name = self.backup_dir.get_filename()
@@ -380,7 +471,6 @@ class IsoDumper:
resp = dialog.run()
if resp:
dialog.hide()
- #exit(0)
if __name__ == "__main__":
import sys
diff --git a/lib/raw_format.py b/lib/raw_format.py
new file mode 100644
index 0000000..8ef036b
--- /dev/null
+++ b/lib/raw_format.py
@@ -0,0 +1,157 @@
+#!/usr/bin/python
+#
+# imported from project Mintstick, by Clement Lefebvre
+#
+# Copyright (C) 2013 THE isodumper'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the isodumper package.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author isodumper software= papoteur <papoteur@mageialinux-online.org>
+
+import os, sys
+import getopt
+import parted
+from subprocess import call
+
+sys.path.append('/usr/lib/isodumper')
+
+def do_umount(target):
+ mounts = get_mounted(target)
+ if mounts:
+ print 'Unmounting all partitions of '+target+':'
+ for mount in mounts:
+ print 'Trying to unmount '+mount[0]+'...'
+ try:
+ retcode = call('umount '+mount[0], shell=True)
+ if retcode < 0:
+ print 'Error, umount '+mount[0]+' was terminated by signal '+str(retcode)
+ sys.exit(6)
+ else:
+ if retcode == 0:
+ print mount[0]+' successfully unmounted'
+ else:
+ print 'Error, umount '+mount[0]+' returned '+str(retcode)
+ sys.exit(6)
+ except OSError, e:
+ print 'Execution failed: '+str(e)
+ sys.exit(6)
+
+
+def get_mounted(target):
+ try:
+ lines = [line.strip("\n").split(" ") for line in open ("/etc/mtab", "r").readlines()]
+ return [mount for mount in lines if mount[0].startswith(target)]
+ except:
+ print 'Could not read mtab !'
+ sys.exit(6)
+
+def raw_format(device_path, fstype, volume_label, uid, gid):
+
+ do_umount(device_path)
+
+ # First erase MBR and partition table , if any
+ os.system ("dd if=/dev/zero of=%s bs=512 count=1 >/dev/null 2>&1" % device_path)
+
+ device = parted.getDevice(device_path)
+
+ # Create a default partition set up
+ disk = parted.freshDisk(device, 'msdos')
+ disk.commit()
+ regions = disk.getFreeSpaceRegions()
+
+ if len(regions) > 0:
+ #print "Build partition"
+ # Define size
+ start = parted.sizeToSectors(1, "MiB", device.sectorSize)
+ #print "start %s" % start
+ end = device.getLength() - start - 1024
+ #print end
+
+ # Alignment
+ #cylinder = device.endSectorToCylinder(end)
+ #end = device.endCylinderToSector(cylinder)
+ #print end
+ try:
+ geometry = parted.Geometry(device=device, start=start, end=end)
+ except:
+ print "Geometry error - Can't create partition"
+ sys.exit(5)
+
+ # fstype
+ fs = parted.FileSystem(type=fstype, geometry=geometry)
+
+ # Create partition
+ partition = parted.Partition(disk=disk, type=parted.PARTITION_NORMAL, geometry=geometry, fs=fs)
+ constraint = parted.Constraint(exactGeom=geometry)
+ disk.addPartition(partition=partition, constraint=constraint)
+ disk.commit()
+
+ # Format partition according to the fstype specified
+ if fstype == "fat32":
+ os.system("mkdosfs -F 32 -n \"%s\" %s >/dev/null 2>&1" % (volume_label, partition.path))
+ if fstype == "ntfs":
+ os.system("mkntfs -f -L \"%s\" %s >/dev/null 2>&1" % (volume_label, partition.path))
+ elif fstype == "ext4":
+ os.system("mkfs.ext4 -E root_owner=%s:%s -L \"%s\" %s >/dev/null 2>&1" % (uid, gid, volume_label, partition.path))
+ sys.exit(0)
+
+
+
+
+
+def main():
+ # parse command line options
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "hd:f:l:u:g:", ["help", "device=","filesystem=","label=","uid=","gid="])
+ except getopt.error, msg:
+ print msg
+ print "for help use --help"
+ sys.exit(2)
+
+ for o, a in opts:
+ if o in ("-h", "--help"):
+ print "Usage: %s -d device -f filesystem -l volume_label\n" % sys.argv[0]
+ print "-d|--device : device path"
+ print "-f|--filesystem : filesystem\n"
+ print "-l|--label : volume label\n"
+ print "-u|--uid : uid of user\n"
+ print "-g|--gid : gid of user\n"
+ print "Example : %s -d /dev/sdj -f fat32 -l \"USB Stick\" -u 1000 -g 1000" % sys.argv[0]
+ sys.exit(0)
+ elif o in ("-d"):
+ device = a
+ elif o in ("-f"):
+ if a not in [ "fat32", "ntfs", "ext4" ]:
+ print "Specify fat32, ntfs or ext4"
+ sys.exit(3)
+ fstype = a
+ elif o in ("-l"):
+ label = a
+ elif o in ("-u"):
+ uid = a
+ elif o in ("-g"):
+ gid = a
+
+ argc = len(sys.argv)
+ if argc < 11:
+ print "Too few arguments"
+ print "for help use --help"
+ exit(2)
+
+ raw_format(device, fstype, label, uid, gid)
+
+if __name__ == "__main__":
+ main()
diff --git a/share/isodumper/isodumper.glade b/share/isodumper/isodumper.glade
index f977070..eefa1cc 100644
--- a/share/isodumper/isodumper.glade
+++ b/share/isodumper/isodumper.glade
@@ -11,7 +11,7 @@
<property name="type_hint">dialog</property>
<property name="has_separator">True</property>
<property name="program_name">IsoDumper</property>
- <property name="version">v0.21</property>
+ <property name="version">v0.30</property>
<property name="copyright">© 2013-2014 Mageia</property>
<property name="comments" translatable="yes">A tool for writing ISO images on a USB stick. It's a fork of usb-imagewriter.</property>
<property name="website">https://github.com/papoteur-mga/isodumper</property>
@@ -491,6 +491,7 @@ Public License instead of this License.
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
+ <signal name="clicked" handler="on_confirm_cancel_button_clicked" swapped="no"/>
</widget>
<packing>
<property name="expand">False</property>
@@ -656,6 +657,174 @@ Public License instead of this License.
</widget>
</child>
</widget>
+ <widget class="GtkWindow" id="format">
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">Formatting the device</property>
+ <property name="window_position">center</property>
+ <property name="default_width">350</property>
+ <property name="icon_name">isodumper</property>
+ <child>
+ <widget class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkLabel" id="format_device">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">label</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Label for the device:</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="format_name">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="width_chars">32</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVButtonBox" id="vbuttonbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkRadioButton" id="format_fat">
+ <property name="label" translatable="yes">FAT 32 (Windows)</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip" translatable="yes">The standard. The size of files are limited to 4Gb</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="format_ntfs">
+ <property name="label" translatable="yes">NTFS (Windows)</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip" translatable="yes">To handle files bigger than 4Gb</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">format_fat</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="format_ext4">
+ <property name="label" translatable="yes">ext4 (Linux)</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip" translatable="yes">Only for Linux systems</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">format_fat</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkButton" id="format_go">
+ <property name="label">gtk-execute</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="on_format_go_clicked" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="format_cancel">
+ <property name="label">gtk-undo</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="on_format_cancel_clicked" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
<widget class="GtkWindow" id="main_dialog">
<property name="can_focus">False</property>
<property name="title" translatable="yes">IsoDumper</property>
@@ -698,12 +867,12 @@ Public License instead of this License.
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <widget class="GtkLabel" id="label2">
+ <widget class="GtkLabel" id="to_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="xpad">5</property>
- <property name="label" translatable="yes">Write Image:</property>
+ <property name="label" translatable="yes">Device to work on:</property>
</widget>
<packing>
<property name="expand">False</property>
@@ -712,72 +881,136 @@ Public License instead of this License.
</packing>
</child>
<child>
- <widget class="GtkFileChooserButton" id="filechooserbutton">
- <property name="width_request">180</property>
+ <widget class="GtkComboBox" id="device_combobox">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="has_tooltip">True</property>
- <property name="tooltip" translatable="yes">Select an image file to be written to the device</property>
- <property name="title" translatable="yes">Select Image</property>
- <signal name="file_set" handler="on_filechooserbutton_file_set" swapped="no"/>
+ <property name="tooltip" translatable="yes">Select target device to write the image to</property>
+ <property name="items" translatable="yes"/>
+ <signal name="changed" handler="on_device_combobox_changed" swapped="no"/>
</widget>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="padding">10</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHSeparator" id="hseparator6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="homogeneous">True</property>
<child>
- <widget class="GtkLabel" id="to_label">
+ <widget class="GtkLabel" id="label2">
<property name="visible">True</property>
- <property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="xpad">5</property>
- <property name="label" translatable="yes">to</property>
+ <property name="label" translatable="yes">Write Image:</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">2</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <widget class="GtkComboBox" id="device_combobox">
+ <widget class="GtkFileChooserButton" id="filechooserbutton">
+ <property name="width_request">180</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
- <property name="tooltip" translatable="yes">Select target device to write the image to</property>
- <property name="items" translatable="yes"></property>
- <signal name="changed" handler="on_device_combobox_changed" swapped="no"/>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip" translatable="yes">Select an image file to be written to the device</property>
+ <property name="title" translatable="yes">Select Image</property>
+ <signal name="file_set" handler="on_filechooserbutton_file_set" swapped="no"/>
</widget>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">3</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="write_button">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="on_write_button_clicked" swapped="no"/>
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-execute</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="padding">5</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Write to device</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
</packing>
</child>
</widget>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="fill">True</property>
- <property name="padding">10</property>
- <property name="position">0</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="backup">
- <property name="label" translatable="yes">Create a backup of the device as image to restore it later</property>
+ <widget class="GtkHSeparator" id="hseparator3">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="on_backup_toggled" swapped="no"/>
+ <property name="can_focus">False</property>
</widget>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">3</property>
</packing>
</child>
<child>
@@ -788,6 +1021,10 @@ Public License instead of this License.
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip" translatable="yes">Create a backup of the device as image to restore it later</property>
+ <property name="xalign">0</property>
+ <property name="xpad">5</property>
<property name="label" translatable="yes">Backup in:</property>
</widget>
<packing>
@@ -803,8 +1040,10 @@ Public License instead of this License.
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
<property name="tooltip" translatable="yes">Select a folder in which to write the backup image</property>
<property name="image_position">right</property>
+ <signal name="activate" handler="on_backup_select_activate" swapped="no"/>
<signal name="clicked" handler="on_backup_select_clicked" swapped="no"/>
</widget>
<packing>
@@ -813,11 +1052,163 @@ Public License instead of this License.
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <widget class="GtkButton" id="backup_button">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="on_backup_button_clicked" swapped="no"/>
+ <child>
+ <widget class="GtkHBox" id="hbox6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-execute</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="padding">5</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Backup the device</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">2</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHSeparator" id="hseparator1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHSeparator" id="hseparator5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">6</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox7">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="xpad">5</property>
+ <property name="label" translatable="yes">Format the device in FAT, NTFS or ext:</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="format_button">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip" translatable="yes">Choose the format. The device will be formatted in one partition</property>
+ <signal name="clicked" handler="on_format_button_clicked" swapped="no"/>
+ <child>
+ <widget class="GtkHBox" id="hbox8">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-execute</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="padding">5</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Format the device</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">7</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHSeparator" id="hseparator4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">8</property>
</packing>
</child>
<child>
@@ -832,7 +1223,7 @@ Public License instead of this License.
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">5</property>
- <property name="position">3</property>
+ <property name="position">9</property>
</packing>
</child>
<child>
@@ -844,7 +1235,7 @@ Public License instead of this License.
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">5</property>
- <property name="position">4</property>
+ <property name="position">10</property>
</packing>
</child>
<child>
@@ -887,7 +1278,7 @@ Public License instead of this License.
<property name="expand">True</property>
<property name="fill">True</property>
<property name="padding">5</property>
- <property name="position">5</property>
+ <property name="position">11</property>
</packing>
</child>
</widget>
@@ -942,52 +1333,6 @@ Public License instead of this License.
<property name="position">1</property>
</packing>
</child>
- <child>
- <widget class="GtkButton" id="write_button">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <signal name="clicked" handler="on_write_button_clicked" swapped="no"/>
- <child>
- <widget class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <widget class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-execute</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="padding">5</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Write to device</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
</widget>
<packing>
<property name="expand">False</property>