diff --git a/liveusb-creator b/liveusb-creator index e110e07..e638b56 100755 --- a/liveusb-creator +++ b/liveusb-creator @@ -31,6 +31,8 @@ def parse_args(): help='Use the "safe, slow and stupid" bootloader') parser.add_option('-n', '--noverify', dest='noverify', action='store_true', help='Skip checksum verification') + parser.add_option('-l', '--label', dest='customlabel', action='store', type='string', + help='Specify a custom label for the disk',metavar='LABEL') parser.add_option('-v', '--verbose', dest='verbose', action='store_true', help='Output extra debugging messages') return parser.parse_args() # (opts, args) diff --git a/liveusb/creator.py b/liveusb/creator.py index 063ef3e..c4c11fd 100755 --- a/liveusb/creator.py +++ b/liveusb/creator.py @@ -331,19 +331,18 @@ class LinuxLiveUSBCreator(LiveUSBCreator): shutil.rmtree(self.dest) self.dest = None - def verifyFilesystem(self): + def verifyFilesystem(self, customlabel=False): if self.fstype not in ('vfat', 'msdos', 'ext2', 'ext3'): raise LiveUSBError("Unsupported filesystem: %s" % self.fstype) if self.drives[self.drive]['label']: self.label = self.drives[self.drive]['label'] else: - self.log.info("Setting label on %s to %s" % (self.drive,self.label)) + self.log.info("Setting label on %s to %s" % (self.drive, (customlabel or self.label))) try: if self.fstype in ('vfat', 'msdos'): - p = self.popen('/sbin/dosfslabel %s %s' % (self.drive, - self.label)) + p = self.popen('dosfslabel %s %s' % (self.drive, (customlabel or self.label))) else: - p = self.popen('/sbin/e2label %s %s' % (self.drive, self.label)) + p = self.popen('e2label %s %s' % (self.drive, (customlabel or self.label))) except LiveUSBError, e: self.log.error("Unable to change volume label: %s" % str(e)) self.label = None @@ -354,20 +353,7 @@ class LinuxLiveUSBCreator(LiveUSBCreator): self.log.info("Extracting ISO to device") self.popen('mount -o loop,ro %s %s' % (self.iso, tmpdir)) try: - tmpliveos = os.path.join(tmpdir, 'LiveOS') - if not os.path.isdir(tmpliveos): - raise LiveUSBError("Unable to find LiveOS on ISO") - liveos = os.path.join(self.dest, 'LiveOS') - if not os.path.exists(liveos): - os.mkdir(liveos) - for img in ('squashfs.img', 'osmin.img'): - self.popen('cp %s %s' % (os.path.join(tmpliveos, img), - os.path.join(liveos, img))) - isolinux = os.path.join(self.dest, 'isolinux') - if not os.path.exists(isolinux): - os.mkdir(isolinux) - self.popen('cp %s/* %s' % (os.path.join(tmpdir, 'isolinux'), - isolinux)) + self.popen('rsync -vaP %s* %s' % (os.path.join(tmpdir, ''), os.path.join(self.dest, ''))) finally: self.popen('umount ' + tmpdir) diff --git a/liveusb/gui.py b/liveusb/gui.py index 650508d..1d5bf1b 100755 --- a/liveusb/gui.py +++ b/liveusb/gui.py @@ -134,10 +134,10 @@ class LiveUSBThread(QtCore.QThread): now = datetime.now() try: self.status("Verifying filesystem...") - self.live.verifyFilesystem() + self.live.verifyFilesystem(customlabel=self.parent.opts.customlabel) if not self.live.uuid and not self.live.label: self.status("Error: Cannot set the label or obtain " - "the UUID of your device. Unable to continue.") + "the UUID of your device. Unable to continue.") self.live.checkFreeSpace() @@ -162,8 +162,8 @@ class LiveUSBThread(QtCore.QThread): self.live.createPersistentOverlay() self.status("Configuring and installing bootloader...") self.live.updateConfigs() - self.live.installBootloader(force=self.parent.opts.force, - safe=self.parent.opts.safe) + #self.live.installBootloader(force=self.parent.opts.force, + # safe=self.parent.opts.safe) duration = str(datetime.now() - now).split('.')[0] self.status("Complete! (%s)" % duration) except LiveUSBError, e: