diff --git a/src/actions/rebuild.py b/src/actions/rebuild.py
index ce39d8b..e646f3c 100644
--- a/src/actions/rebuild.py
+++ b/src/actions/rebuild.py
@@ -1,6 +1,6 @@
#!/usr/bin/python2
-import sys, os, glob, shutil, re, hashlib
+import sys, os, glob, shutil, re
import lib.misc as misc
import lib.config as config
@@ -256,10 +256,8 @@ def main():
continue
if sfile.endswith('SHA256SUMS'):
continue
-
- # FIXME: read in chunks
message.sub_debug('MD5 Checksumming', sfile)
- checksum = hashlib.md5(misc.read_file(sfile)).hexdigest()
+ checksum = misc.generate_hash_for_file('md5', sfile)
misc.append_file(md5sums_file, checksum + ' .' + \
sfile.replace(config.ISO_DIR, '') +'\n')
@@ -273,10 +271,8 @@ def main():
continue
if sfile.endswith('SHA256SUMS'):
continue
-
- # FIXME: read in chunks
message.sub_debug('SHA256 Checksumming', sfile)
- checksum = hashlib.sha256(misc.read_file(sfile)).hexdigest()
+ checksum = misc.generate_hash_for_file('sha256', sfile)
misc.append_file(shasums_file, checksum + ' .' + \
sfile.replace(config.ISO_DIR, '') +'\n')
@@ -290,15 +286,15 @@ def main():
'-cache-inodes', '-input-charset', 'utf-8', '.'))
message.sub_info('Creating ISO checksums')
- md5checksum = hashlib.md5(misc.read_file(iso_file)).hexdigest()
+ md5checksum = misc.generate_hash_for_file('md5', iso_file)
message.sub_info('ISO md5 checksum', md5checksum)
misc.append_file(md5sum_iso_file, md5checksum + ' .' + \
iso_file.replace(config.WORK_DIR, '') +'\n')
- sha1checksum = hashlib.sha1(misc.read_file(iso_file)).hexdigest()
+ sha1checksum = misc.generate_hash_for_file('sha1', iso_file)
message.sub_info('ISO sha1 checksum', sha1checksum)
misc.append_file(sha1sum_iso_file, sha1checksum + ' .' + \
iso_file.replace(config.WORK_DIR, '') +'\n')
- sha256checksum = hashlib.sha256(misc.read_file(iso_file)).hexdigest()
+ sha256checksum = misc.generate_hash_for_file('sha256', iso_file)
message.sub_info('ISO sha256 checksum', sha256checksum)
misc.append_file(sha256sum_iso_file, sha256checksum + ' .' + \
iso_file.replace(config.WORK_DIR, '') +'\n')
diff --git a/src/actions/xnest.py b/src/actions/xnest.py
index b1fcb7d..5e2f957 100644
--- a/src/actions/xnest.py
+++ b/src/actions/xnest.py
@@ -27,7 +27,7 @@ def main():
x = subprocess.Popen((misc.whereis('Xephyr'), '-ac', '-screen', \
config.RESOLUTION, '-br', ':13'))
x.poll()
- if x.returncode > 0:
+ if x.returncode is not None and x.returncode > 0:
raise(message.exception('Failed to start Xephyr', x.returncode))
try:
diff --git a/src/gui.py.in b/src/gui.py.in
index 8d55ad5..9dc1a04 100755
--- a/src/gui.py.in
+++ b/src/gui.py.in
@@ -4,7 +4,7 @@
# This is quick and dirty written GUI! #
############### END NOTE ###############
-import sys, os, atexit, subprocess
+import sys, os, atexit, subprocess, imp
sys.path.append("@PREFIX@/share/customizer")
import gui_ui
@@ -12,6 +12,7 @@ from PyQt4 import QtCore, QtGui
import lib.config as config
import lib.misc as misc
+import lib.message as message
import actions.common as common
import actions.extract as extract
import actions.deb as deb
@@ -44,7 +45,7 @@ def msg_warning(msg):
QtGui.QMessageBox.warning(MainWindow, app.tr('Warning'), msg)
def msg_critical(msg):
- QtGui.QMessageBox.critical(MainWindow, app.tr('Critical'), str(msg).decode('utf-8'))
+ QtGui.QMessageBox.critical(MainWindow, app.tr('Critical'), u''.format(msg))
# limit instances to one
lock = '/run/lock/customizer'
@@ -65,7 +66,6 @@ else:
if int(sys.version_info[0]) >= 3:
msg_critical(app.tr('You are attempting to run Customizer with Python 3.'))
- sys.exit()
class Thread(QtCore.QThread):
''' Worker thread '''
@@ -153,18 +153,21 @@ def setup_gui():
ui.extraCustomizationBox.setEnabled(False)
def run_core(args, terminal=True):
+ message.sub_debug('GUI Running', 'customizer ' + args)
if terminal:
terminal = None
for term in ('xterm', 'lxterminal', 'xfce4-terminal', 'terminal',
'konsole', 'mate-terminal', 'gnome-terminal', 'terminator', \
- 'sakura', 'urxterm', 'aterm', 'Eterm'):
+ 'sakura', 'urxterm', 'aterm', 'Eterm', 'x-terminal-emulator'):
spath = misc.whereis(term)
if spath:
terminal = spath
+ message.sub_debug('Found terminal', terminal)
if not terminal:
msg_critical(app.tr('No supported terminal emulator detected.'))
return
+ message.sub_debug('Selected last found terminal', terminal)
try:
if terminal and terminal.endswith('konsole'):
@@ -188,14 +191,15 @@ def change_value(sec, var, val):
conf = open('/etc/customizer.conf', 'w')
if not config.conf.has_section(sec):
config.conf.add_section(sec)
- config.conf.set(sec, var, val.encode('utf-8'))
+ config.conf.set(sec, var, u'{}'.format(val))
+ message.debug('Writing Configuration file', '/etc/customizer.conf')
config.conf.write(conf)
except Exception as detail:
msg_critical(detail)
finally:
if conf:
conf.close()
- reload(config)
+ imp.reload(config)
def worker_started():
ui.progressBar.setRange(0, 0)
@@ -229,27 +233,31 @@ def run_extract():
config.ISO, app.tr('ISO Files (*.iso);;All Files (*)'))
if not sfile:
return
- sfile = unicode(sfile)
+ sfile = u'{}'.format(sfile)
change_value('saved', 'iso', sfile)
extract.config.ISO = sfile
+ message.sub_debug('Extracting ISO', sfile)
try:
worker(extract.main)
except Exception as detail:
msg_critical(detail)
def run_rebuild():
+ message.sub_debug('Starting Rebuild...')
try:
worker(rebuild.main)
except Exception as detail:
msg_critical(detail)
def run_clean():
+ message.sub_debug('Starting Cleaning...')
try:
worker(clean.main)
except Exception as detail:
msg_critical(detail)
def edit_sources():
+ message.sub_debug('Trying to edit sources...')
editor = None
for edit in ('mousepad', 'leafpad', 'pluma', 'gedit', 'kate', 'kwrite', \
'medit', 'nedit', 'geany', 'bluefish', 'ultraedit'):
@@ -275,14 +283,16 @@ def run_deb():
config.DEB, app.tr('Deb Files (*.deb);;All Files (*)'))
if not sfile:
return
- sfile = unicode(sfile)
+ sfile = u'{}'.format(sfile)
change_value('saved', 'deb', sfile)
deb.config.DEB = sfile
+ message.sub_debug('Installing DEB package', sfile)
worker(deb.main)
except Exception as detail:
msg_critical(detail)
def run_pkgm():
+ message.sub_debug('Starting Graphical Package Manager...')
run_core('-p')
def run_hook():
@@ -291,31 +301,36 @@ def run_hook():
config.HOOK, app.tr('Shell Scripts (*.sh);;All Files (*)'))
if not sfile:
return
- sfile = unicode(sfile)
+ sfile = u'{}'.format(sfile)
change_value('saved', 'hook', sfile)
hook.config.HOOK = sfile
+ message.sub_debug('Attempting to run hook', sfile)
worker(hook.main)
except Exception as detail:
msg_critical(detail)
def run_chroot():
+ message.sub_debug('Opening terminal...')
run_core('-c')
def run_xnest():
+ message.sub_debug('Opening Nested GUI Desktop...')
try:
worker(xnest.main)
except Exception as detail:
msg_critical(detail)
def run_qemu():
+ message.sub_debug('Starting qemu...')
try:
worker(qemu.main)
except Exception as detail:
msg_critical(detail)
def change_user():
+ message.sub_debug('Attempting to change username...')
try:
- value = unicode(ui.userEdit.text())
+ value = u'{}'.format(ui.userEdit.text())
if not value.strip():
msg_critical(app.tr('Live user can not be empty.'))
ui.userEdit.setText('ubuntu')
@@ -326,41 +341,48 @@ def change_user():
msg_critical(detail)
def change_hostname():
+ message.sub_debug('Attempting to change hostname...')
try:
common.set_value(misc.join_paths(config.FILESYSTEM_DIR, \
- 'etc/casper.conf'), 'export HOST=', unicode(ui.hostnameEdit.text()))
+ 'etc/casper.conf'), 'export HOST=', u'{}'.format(ui.hostnameEdit.text()))
except Exception as detail:
msg_critical(detail)
def change_work_dir():
+ message.sub_debug('Attempting to change hostname...')
try:
spath = QtGui.QFileDialog.getExistingDirectory(MainWindow, \
'Directory', config.WORK_DIR)
if not spath:
return
- spath = unicode(spath)
+ spath = u'{}'.format(spath)
change_value('preferences', 'work_dir', spath)
ui.workDirEdit.setText(spath)
except Exception as detail:
msg_critical(detail)
def change_locales():
- current = unicode(ui.localesBox.currentText())
+ message.sub_debug('Attempting to change Locales...')
+ current = u'{}'.format(ui.localesBox.currentText())
change_value('preferences', 'locales', current)
def change_resolution():
- current = unicode(ui.resolutionBox.currentText())
+ message.sub_debug('Attempting to change qemu resolution...')
+ current = u'{}'.format(ui.resolutionBox.currentText())
change_value('preferences', 'resolution', current)
def change_vram():
- current = unicode(ui.vramBox.currentText())
+ message.sub_debug('Attempting to change qemu VRAM size...')
+ current = u'{}'.format(ui.vramBox.currentText())
change_value('preferences', 'vram', current)
def change_compression():
- current = unicode(ui.compressionBox.currentText())
+ message.sub_debug('Attempting to change compression type...')
+ current = u'{}'.format(ui.compressionBox.currentText())
change_value('preferences', 'compression', current)
def browse_dir(sdir):
+ message.sub_debug('Attempting to open GUI file browser for', sdir)
try:
manager = None
for term in ('dolphin', 'thunar', 'pcmanfm', 'nautilus', 'emelfm', \
diff --git a/src/lib/config.py b/src/lib/config.py
index a8cd8ea..b95c6ec 100644
--- a/src/lib/config.py
+++ b/src/lib/config.py
@@ -1,6 +1,10 @@
#!/usr/bin/python2
-import os, ConfigParser
+import os
+try: # Importing python3 style first.
+ import configparser as ConfigParser
+except: # Fall back to python2.
+ import ConfigParser
import lib.message as message
@@ -18,22 +22,24 @@
)
if not os.path.isfile('/etc/customizer.conf'):
- message.warning('Configuration file does not exists', '/etc/customizer.conf')
+ message.warning('Configuration file does not exist', '/etc/customizer.conf')
conf.read('/etc/customizer.conf')
+message.info('Read Configuration file', '/etc/customizer.conf')
for section in ('preferences', 'saved'):
if not conf.has_section(section):
conf.add_section(section)
-WORK_DIR = conf.get('preferences', 'WORK_DIR')
-LOCALES = conf.get('preferences', 'LOCALES')
-RESOLUTION = conf.get('preferences', 'RESOLUTION')
-COMPRESSION = conf.get('preferences', 'COMPRESSION')
-VRAM = conf.get('preferences', 'VRAM')
+# Make sure these end up to be strings in both python2 and python3.
+WORK_DIR = '{}'.format(conf.get('preferences', 'WORK_DIR'))
+LOCALES = '{}'.format(conf.get('preferences', 'LOCALES'))
+RESOLUTION = '{}'.format(conf.get('preferences', 'RESOLUTION'))
+COMPRESSION = '{}'.format(conf.get('preferences', 'COMPRESSION'))
+VRAM = '{}'.format(conf.get('preferences', 'VRAM'))
-ISO = conf.get('saved', 'ISO')
-DEB = conf.get('saved', 'DEB')
-HOOK = conf.get('saved', 'HOOK')
+ISO = '{}'.format(conf.get('saved', 'ISO'))
+DEB = '{}'.format(conf.get('saved', 'DEB'))
+HOOK = '{}'.format(conf.get('saved', 'HOOK'))
MOUNT_DIR = '/media'
FILESYSTEM_DIR = os.path.join(WORK_DIR, 'FileSystem')
diff --git a/src/lib/message.py b/src/lib/message.py
index d92a798..494b6f5 100644
--- a/src/lib/message.py
+++ b/src/lib/message.py
@@ -47,75 +47,75 @@ def __getattr__(self, attr):
def info(msg, marker=None):
''' Print message with INFO status '''
if not marker is None:
- print('%s* %s%s: %s%s%s' % \
- (cmarker, cnormal, msg, cinfo, marker, cnormal))
+ print('{}* {}{}: {}{}{}'.format( \
+ cmarker, cnormal, msg, cinfo, marker, cnormal))
else:
- print('%s* %s%s' % (cmarker, cnormal, msg))
+ print('{}* {}{}'.format(cmarker, cnormal, msg))
def warning(msg, marker=None):
''' Print message with WARNING status '''
if not marker is None:
- sys.stderr.write('%s* %s%s: %s%s%s\n' % \
- (cwarning, cnormal, msg, cwarning, marker, cnormal))
+ sys.stderr.write('{}* {}{}: {}{}{}\n'.format( \
+ cwarning, cnormal, msg, cwarning, marker, cnormal))
else:
- sys.stderr.write('%s* %s%s\n' % (cwarning, cnormal, msg))
+ sys.stderr.write('{}* {}{}\n'.format(cwarning, cnormal, msg))
def critical(msg, marker=None):
''' Print message with CRITICAL status '''
if not marker is None:
- sys.stderr.write('%s* %s%s: %s%s%s\n' % \
- (ccritical, cnormal, msg, ccritical, marker, cnormal))
+ sys.stderr.write('{}* {}{}: {}{}{}\n'.format( \
+ ccritical, cnormal, msg, ccritical, marker, cnormal))
else:
- sys.stderr.write('%s* %s%s\n' % (ccritical, cnormal, msg))
+ sys.stderr.write('{}* {}{}\n'.format(ccritical, cnormal, msg))
def debug(msg, marker=None):
''' Print message with DEBUG status '''
if DEBUG:
if not marker is None:
- print('%s* %s%s: %s%s%s' % \
- (cdebug, cnormal, msg, cdebug, marker, cnormal))
+ print('{}* {}{}: {}{}{}'.format( \
+ cdebug, cnormal, msg, cdebug, marker, cnormal))
else:
- print('%s* %s%s' % (cdebug, cnormal, msg))
+ print('{}* {}{}'.format(cdebug, cnormal, msg))
def sub_info(msg, marker=None):
''' Print sub-message with INFO status '''
if not marker is None:
- print('%s => %s%s: %s%s%s' % \
- (cmarker, cnormal, msg, cinfo, marker, cnormal))
+ print('{} => {}{}: {}{}{}'.format( \
+ cmarker, cnormal, msg, cinfo, marker, cnormal))
else:
- print('%s => %s%s' % (cmarker, cnormal, msg))
+ print('{} => {}{}'.format(cmarker, cnormal, msg))
def sub_warning(msg, marker=None):
''' Print sub-message with WARNING status '''
if not marker is None:
- sys.stderr.write('%s => %s%s: %s%s%s\n' % \
- (cwarning, cnormal, msg, cwarning, marker, cnormal))
+ sys.stderr.write('{} => {}{}: {}{}{}\n'.format( \
+ cwarning, cnormal, msg, cwarning, marker, cnormal))
else:
- sys.stderr.write('%s => %s%s\n' % (cwarning, cnormal, msg))
+ sys.stderr.write('{} => {}{}\n'.format(cwarning, cnormal, msg))
def sub_critical(msg, marker=None):
''' Print sub-message with CRITICAL status '''
if not marker is None:
- sys.stderr.write('%s => %s%s: %s%s%s\n' % \
- (ccritical, cnormal, msg, ccritical, marker, cnormal))
+ sys.stderr.write('{} => {}{}: {}{}{}\n'.format( \
+ ccritical, cnormal, msg, ccritical, marker, cnormal))
else:
- sys.stderr.write('%s => %s%s\n' % (ccritical, cnormal, msg))
+ sys.stderr.write('{} => {}{}\n'.format(ccritical, cnormal, msg))
def sub_debug(msg, marker=None):
''' Print sub-message with DEBUG status '''
if DEBUG:
if not marker is None:
- print('%s => %s%s: %s%s%s' % \
- (cdebug, cnormal, msg, cdebug, marker, cnormal))
+ print('{} => {}{}: {}{}{}'.format( \
+ cdebug, cnormal, msg, cdebug, marker, cnormal))
else:
- print('%s => %s%s' % (cdebug, cnormal, msg))
+ print('{} => {}{}'.format(cdebug, cnormal, msg))
class exception(Exception):
pass
diff --git a/src/lib/misc.py b/src/lib/misc.py
index 7d94654..9471298 100644
--- a/src/lib/misc.py
+++ b/src/lib/misc.py
@@ -1,6 +1,12 @@
#!/usr/bin/python2
-import os, re, shutil, shlex, subprocess
+import os, re, shutil, shlex, subprocess, time, hashlib
+
+import lib.message as message
+CMD_DEBUG = False
+CHROOT_DEBUG = False
+FILE_DEBUG = False
+MOUNT_DEBUG = False
import lib.config as config
CATCH = False
@@ -29,21 +35,33 @@ def join_paths(*paths):
result = os.path.join(result, p.lstrip('/'))
return os.path.normpath(result)
+def join_work_path(*paths):
+ return join_paths(config.WORK_DIR, paths)
+
+def join_iso_path(*paths):
+ return join_paths(config.ISO_DIR, paths)
+
+def join_fs_path(*paths):
+ return join_paths(config.FILESYSTEM_DIR, paths)
+
''' File operations '''
def read_file(sfile):
+ if FILE_DEBUG: message.sub_debug('Reading entire file', sfile)
rfile = open(sfile, 'r')
content = rfile.read()
rfile.close()
return content
def readlines_file(sfile):
+ if FILE_DEBUG: message.sub_debug('Reading lines from', sfile)
rfile = open(sfile, 'r')
content = rfile.readlines()
rfile.close()
return content
def write_file(sfile, content):
+ if FILE_DEBUG: message.sub_debug('Writing data to', sfile)
dirname = os.path.dirname(sfile)
if not os.path.isdir(dirname):
os.makedirs(dirname)
@@ -62,6 +80,7 @@ def write_file(sfile, content):
wfile.close()
def append_file(sfile, content):
+ if FILE_DEBUG: message.sub_debug('Appending data to', sfile)
dirname = os.path.dirname(sfile)
if not os.path.isdir(dirname):
os.makedirs(dirname)
@@ -71,11 +90,22 @@ def append_file(sfile, content):
afile.close()
def copy_file(source, destination):
+ if FILE_DEBUG: message.sub_debug('File {} copied to'.format(source), destination)
base = os.path.dirname(destination)
if not os.path.isdir(base):
os.makedirs(base)
shutil.copyfile(source, destination)
+def generate_hash_for_file(hashtype, filename, blocksize=2**20):
+ m = hashlib.new(hashtype)
+ with open(filename, "rb") as f:
+ while True:
+ buf = f.read(blocksize)
+ if not buf:
+ break
+ m.update(buf)
+ return m.hexdigest()
+
''' System operations '''
def get_output(command):
pipe = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -93,9 +123,11 @@ def search_string(string, string2, exact=False, escape=True):
return re.findall(string, str(string2))
def search_file(string, sfile, exact=False, escape=True):
+ if FILE_DEBUG: message.sub_debug('Searching {} for'.format(sfile), string)
return search_string(string, read_file(sfile), exact=exact, escape=escape)
def list_files(directory):
+ if FILE_DEBUG: message.sub_debug('Listing files in', directory)
slist = []
if not os.path.exists(directory):
return slist
@@ -112,6 +144,7 @@ def dir_current():
return cwd
def system_command(command, shell=False, cwd=None, env=None):
+ if CMD_DEBUG: message.sub_debug('Executing system command', command)
if not cwd:
cwd = dir_current()
elif not os.path.isdir(cwd):
@@ -131,19 +164,22 @@ def system_command(command, shell=False, cwd=None, env=None):
return subprocess.check_call(command, shell=shell, cwd=cwd, env=env)
def chroot_exec(command, prepare=True, mount=True, output=False, xnest=False, shell=False, cwd=None):
+ if CHROOT_DEBUG: message.sub_debug('Trying to set up chroot command', command)
out = None
- resolv = '%s/etc/resolv.conf' % config.FILESYSTEM_DIR
- hosts = '%s/etc/hosts' % config.FILESYSTEM_DIR
+ resolv = '{}/etc/resolv.conf'.format(config.FILESYSTEM_DIR)
+ hosts = '{}/etc/hosts'.format(config.FILESYSTEM_DIR)
+ inhibit = '{}/usr/sbin/policy-rc.d'.format(config.FILESYSTEM_DIR)
mount = whereis('mount')
umount = whereis('umount')
chroot = whereis('chroot')
if isinstance(command, str):
- chroot_command = '%s %s %s' % (chroot, config.FILESYSTEM_DIR, command)
+ chroot_command = '{} {} {}'.format(chroot, config.FILESYSTEM_DIR, command)
else:
chroot_command = [chroot, config.FILESYSTEM_DIR]
chroot_command.extend(command)
try:
if prepare:
+ if CHROOT_DEBUG: message.sub_debug('Preparing chroot environment for networking')
if os.path.isfile('/etc/resolv.conf') and not os.path.islink(resolv):
copy_file('/etc/resolv.conf', resolv)
elif os.path.islink(resolv):
@@ -155,10 +191,11 @@ def chroot_exec(command, prepare=True, mount=True, output=False, xnest=False, sh
copy_file('/etc/resolv.conf', resolv)
if os.path.isfile('/etc/hosts'):
if os.path.isfile(hosts):
- copy_file(hosts, '%s.backup' % hosts)
+ copy_file(hosts, '{}.backup'.format(hosts))
copy_file('/etc/hosts', hosts)
if mount:
+ if CHROOT_DEBUG: message.sub_debug('Mounting paths inside chroot')
pseudofs = ['/proc', '/dev', '/dev/pts', '/dev/shm', '/sys', '/tmp', '/var/lib/dbus']
if os.path.islink(config.FILESYSTEM_DIR + '/var/run'):
pseudofs.append('/run/dbus')
@@ -171,17 +208,23 @@ def chroot_exec(command, prepare=True, mount=True, output=False, xnest=False, sh
if not os.path.ismount(sdir):
if not os.path.isdir(sdir):
os.makedirs(sdir)
+ if MOUNT_DEBUG: message.sub_debug('Mounting --bind {}'.format(s), sdir)
system_command((mount, '--bind', s, sdir))
if prepare:
- mtab = '%s/etc/mtab' % config.FILESYSTEM_DIR
+ if MOUNT_DEBUG: message.sub_debug('Creating mtab inside chroot')
+ mtab = '{}/etc/mtab'.format(config.FILESYSTEM_DIR)
if not os.path.isfile(mtab) and not os.path.islink(mtab):
os.symlink('../../proc/mounts', mtab)
-
+ if not os.path.isfile(inhibit):
+ write_file(inhibit, "exit 101")
+ os.chmod(inhibit, 0o755)
+
if not config.LOCALES == 'C':
system_command(('locale-gen', config.LOCALES))
+ if CHROOT_DEBUG: message.sub_debug('Enumerating environment variables')
# all operations on reference to os.environ change the environment!
environment = {}
for item in os.environ:
@@ -212,19 +255,28 @@ def chroot_exec(command, prepare=True, mount=True, output=False, xnest=False, sh
environment['DEBCONF_NOWARNINGS'] = 'true'
if output:
+ if CHROOT_DEBUG: message.sub_debug('Entering chroot')
out = get_output(chroot_command)
+ if CHROOT_DEBUG: message.sub_debug('Exiting chroot')
else:
+ if CHROOT_DEBUG: message.sub_debug('Entering chroot')
system_command(chroot_command, shell=shell, \
env=environment, cwd=cwd)
+ if CHROOT_DEBUG: message.sub_debug('Exiting chroot')
finally:
if prepare:
- if os.path.isfile('%s.backup' % hosts):
- copy_file('%s.backup' % hosts, hosts)
- os.unlink('%s.backup' % hosts)
+ if os.path.isfile('{}.backup'.format(hosts)):
+ copy_file('{}.backup'.format(hosts), hosts)
+ os.unlink('{}.backup'.format(hosts))
+ if os.path.isfile(inhibit):
+ os.unlink(inhibit)
if mount:
for s in reversed(pseudofs):
sdir = config.FILESYSTEM_DIR + s
if os.path.ismount(sdir):
+ if MOUNT_DEBUG: message.sub_debug('Unmounting -f -l', sdir)
system_command((umount, '-f', '-l', sdir))
+ time.sleep(0.1) # Wait for lazy unmounts to unlazy...
+ system_command(('sleep', '1')) # Make sure of it. (and log it)
if output:
return out
diff --git a/src/main.py.in b/src/main.py.in
index f37126e..5d24f4c 100755
--- a/src/main.py.in
+++ b/src/main.py.in
@@ -24,7 +24,7 @@ try:
parser = argparse.ArgumentParser(prog='Customizer', \
description='Ubuntu based LiveCD ISO images remastering tool')
parser.add_argument('-e', '--extract', action='store_true', \
- help='Exctract ISO image')
+ help='Extract ISO image')
parser.add_argument('-c', '--chroot', action='store_true', \
help='Chroot into the filesystem')
parser.add_argument('-x', '--xnest', action='store_true', \
@@ -38,7 +38,7 @@ try:
parser.add_argument('-r', '--rebuild', action='store_true', \
help='Rebuild the ISO image')
parser.add_argument('-q', '--qemu', action='store_true', \
- help='Test the builded image with QEMU')
+ help='Test the built ISO image with QEMU')
parser.add_argument('-t', '--clean', action='store_true', \
help='Clean all temporary files and folders')
parser.add_argument('-D', '--debug', nargs=0, action=OverrideDebug, \
diff --git a/tr/customizer_bg_BG.ts b/tr/customizer_bg_BG.ts
index ba523b6..eb89c95 100644
--- a/tr/customizer_bg_BG.ts
+++ b/tr/customizer_bg_BG.ts
@@ -3,217 +3,212 @@
MainWindow
-
+
Customizer GUI
Customizer ГПИ
-
+
Select ISO
Избери ISO
-
+
Rebuild ISO
-
+
QEMU
QEMU
-
+
Clean
Изчисти
-
+
Customization
Персонализации
-
+
Edit sources
Промени източници
-
+
Archive
Архив
-
+
Install DEB
Инсталирай ДЕБ
-
+
Terminal
Терминал
-
+
Desktop
Десктоп
-
+
Execute hook
Изпълни кука
-
+
Configuration
Конфигурация
-
+
Hostname
Име на хоста
-
+
Live user
Жив потребител
-
+
Main
Основни
-
+
X-nest resolution
Х-нест резолюция
-
+
Change
Промени
-
+
Working directory
Работна директория
-
+
QEMU RAM (in MB)
QEMU РАМ (в МБ)
-
+
C
-
+
Locales
Локализации
-
+
64
-
+
128
-
+
256
-
+
512
-
+
1024
-
+
2048
-
+
4086
-
+
640x480
-
+
800x600
-
+
1024x768
-
+
SquashFS format
SquashFS формат
-
+
xz
-
+
gzip
-
+
Settings
Настройки
-
+
<html><head/><body><p><span style=" font-weight:600;">set on runtime!</span></p></body></html>
-
- About
- Относно
-
-
-
+
Extra Customization
Допълнителни персонализации
-
+
Browse FileSystem
Разгледай FileSystem
-
+
Browse ISO
Разгледай ISO
-
+
Extra
Допълнителни
-
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
@@ -245,31 +240,63 @@ p, li { white-space: pre-wrap; }
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Thanks to all who helped making this project useful to this date!</p></body></html>
+
+
+ Credits
+
+
+
+
+ The GNU General Public License version 2 (GPLv2)
+
+Copyright (C) 2010-2013 Ivailo Monev
+Copyright (C) 2013-2015 Mubiin Kimura
+
+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 Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+
+
+ License
+
+
app
-
+
Information
Информация
-
+
Warning
Предупреждение
-
+
Critical
Критично
-
+
An instance of Customizer is already running.
Инстанция на Customizer вече е стартирана.
-
+
You are attempting to run Customizer with Python 3.
Опитвате се да стартирате Customizer с Python 3.
@@ -279,42 +306,42 @@ p, li { white-space: pre-wrap; }
Файловата система не е валидна или е повредена. Изчистване е препоръчително.
-
+
No supported terminal emulator detected.
Не е намерен терминал, който се поддържа.
-
+
Open
Отвори
-
+
ISO Files (*.iso);;All Files (*)
ISO Файлове (*.iso);;Всички Файлове (*)
-
+
No supported text editor detected.
Не е намерен текстов редактор, който се поддържа.
-
+
Deb Files (*.deb);;All Files (*)
Deb Файлове (*.deb);;Всички Файлове (*)
-
+
Shell Scripts (*.sh);;All Files (*)
Скриптове на Обвивката (*.sh);;Всички Файлове (*)
-
+
No supported file manager detected.
Не е намерен файлов мениджър, който се поддържа.
-
+
Live user can not be empty.
diff --git a/tr/customizer_ko_KR.ts b/tr/customizer_ko_KR.ts
index 50edac2..c34b9e3 100644
--- a/tr/customizer_ko_KR.ts
+++ b/tr/customizer_ko_KR.ts
@@ -3,217 +3,212 @@
MainWindow
-
+
Customizer GUI
커스터마이저 GUI
-
+
Select ISO
ISO 선택
-
+
Rebuild ISO
ISO 다시빌드
-
+
QEMU
QEMU
-
+
Clean
청소
-
+
Customization
사용자 지정
-
+
Edit sources
소스 수정
-
+
Archive
아카이브
-
+
Install DEB
DEB 설치
-
+
Terminal
터미널
-
+
Desktop
데스크탑
-
+
Execute hook
후크 실행
-
+
Configuration
구성
-
+
Hostname
호스트 이름
-
+
Live user
라이브 유저
-
+
Main
메인
-
+
X-nest resolution
Х-нест 해상도
-
+
Change
변경
-
+
Working directory
작업 디렉토리
-
+
QEMU RAM (in MB)
QEMU 램 (in MB)
-
+
C
C
-
+
Locales
위치
-
+
64
64
-
+
128
128
-
+
256
256
-
+
512
512
-
+
1024
1024
-
+
2048
2048
-
+
4086
4086
-
+
640x480
640x480
-
+
800x600
800x600
-
+
1024x768
1024x768
-
+
SquashFS format
SquashFS 형식
-
+
xz
xz
-
+
gzip
gzip
-
+
Settings
세팅
-
+
<html><head/><body><p><span style=" font-weight:600;">set on runtime!</span></p></body></html>
-
- About
- 이 프로그램에 대해서
-
-
-
+
Extra Customization
커스터마이징 추가
-
+
Browse FileSystem
파일시스템 탐색
-
+
Browse ISO
ISO 탐색
-
+
Extra
추가
-
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
@@ -245,31 +240,63 @@ p, li { white-space: pre-wrap; }
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Thanks to all who helped making this project useful to this date!</p></body></html>
+
+
+ Credits
+
+
+
+
+ The GNU General Public License version 2 (GPLv2)
+
+Copyright (C) 2010-2013 Ivailo Monev
+Copyright (C) 2013-2015 Mubiin Kimura
+
+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 Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+
+
+ License
+
+
app
-
+
Information
안내
-
+
Warning
주의
-
+
Critical
치명적
-
+
An instance of Customizer is already running.
커스터마이저의 한 예가 이미 실행중입니다.
-
+
You are attempting to run Customizer with Python 3.
당신은 파이썬 3으로 커스터마이저를 실행하려고합니다.
@@ -279,42 +306,42 @@ p, li { white-space: pre-wrap; }
파일시스템이 잘못되거나 손상되었습니다. 청소를 하는 것이 좋습니다.
-
+
No supported terminal emulator detected.
지원되는 터미널 에뮬레이터가 감지 되지 않습니다.
-
+
Open
열기
-
+
ISO Files (*.iso);;All Files (*)
ISO 파일 (*.iso);;모든 파일 (*)
-
+
No supported text editor detected.
지원되는 텍스트 에디터가 감지 되지 않습니다.
-
+
Deb Files (*.deb);;All Files (*)
Deb 파일 (*.deb);;모든 파일 (*)
-
+
Shell Scripts (*.sh);;All Files (*)
쉘 스크립트 (*.sh);;모든 파일 (*)
-
+
No supported file manager detected.
지원되는 파일 탐색기가 감지 되지 않습니다.
-
+
Live user can not be empty.
라이브 유저는 비워 둘 수 없습니다 .