projects
/
grml-x.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Release new version 0.7.1
[grml-x.git]
/
grml-x
diff --git
a/grml-x
b/grml-x
index
995b4c4
..
b180e4d
100755
(executable)
--- a/
grml-x
+++ b/
grml-x
@@
-1,4
+1,4
@@
-#!/usr/bin/
env python
+#!/usr/bin/
python3
# -*- coding: utf-8 -*-
# vim: set et ts=4:
# -*- coding: utf-8 -*-
# vim: set et ts=4:
@@
-24,6
+24,8
@@
class Section(object):
v = self.data[k]
if isinstance(v, list):
v = '" "'.join(v)
v = self.data[k]
if isinstance(v, list):
v = '" "'.join(v)
+ elif not isinstance(v, str): # int, others
+ v = str(v)
elif '-' in v: # sync range
pass
else:
elif '-' in v: # sync range
pass
else:
@@
-61,16
+63,16
@@
def build_bootparams():
lines.extend(f.readlines())
f.close()
except:
lines.extend(f.readlines())
f.close()
except:
- print
'W: Error while getting bootparams from %s' % p
+ print
('W: Error while getting bootparams from %s' % p)
f = open('/proc/cmdline')
lines.append(f.readline())
f.close()
f = open('/proc/cmdline')
lines.append(f.readline())
f.close()
- walk_bootparams_path('/
cdro
m/bootparams')
- walk_bootparams_path('/
live/image
/bootparams')
+ walk_bootparams_path('/
lib/live/mount/mediu
m/bootparams')
+ walk_bootparams_path('/
run/live/medium
/bootparams')
params = {}
for p in ' '.join(lines).split(' '):
if '=' in p:
params = {}
for p in ' '.join(lines).split(' '):
if '=' in p:
- (k,v) = p.split('=',
2
)
+ (k,v) = p.split('=',
1
)
params[k] = v
else:
params[p] = True
params[k] = v
else:
params[p] = True
@@
-142,13
+144,13
@@
def main():
(options, args) = parser.parse_args()
bootparams = build_bootparams()
(options, args) = parser.parse_args()
bootparams = build_bootparams()
- if os.getuid() == 0:
- print
"W: running as root is unsupported and may not work."
+ if os.getuid() == 0
and options.start_server
:
+ print
("W: running as root is unsupported and may not work.")
time.sleep(1)
if not check_old_xorg_conf(options.xorg_conf, options.overwrite):
time.sleep(1)
if not check_old_xorg_conf(options.xorg_conf, options.overwrite):
- print
"E: Not overwriting existing %r without --force." % options.xorg_conf
- print
"I: If you previously ran grml-x, use startx /usr/bin/x-window-manager"
+ print
("E: Not overwriting existing %r without --force." % options.xorg_conf)
+ print
("I: If you previously ran grml-x, use startx /usr/bin/x-window-manager")
return 1
if 'xmode' in bootparams and not options.mode: options.mode = bootparams['xmode']
return 1
if 'xmode' in bootparams and not options.mode: options.mode = bootparams['xmode']
@@
-179,7
+181,7
@@
def main():
if len(args) == 1: window_manager = args[0]
window_manager_path = which(window_manager)
if not window_manager_path:
if len(args) == 1: window_manager = args[0]
window_manager_path = which(window_manager)
if not window_manager_path:
- print
"E: Cannot find window manager %r, aborting." % window_manager
+ print
("E: Cannot find window manager %r, aborting." % window_manager)
return 2
wm_exec = "exec %s\n" % window_manager_path
return 2
wm_exec = "exec %s\n" % window_manager_path
@@
-194,9
+196,9
@@
def main():
f.close()
f = open(xinitrc, 'w')
for line in lines:
f.close()
f = open(xinitrc, 'w')
for line in lines:
- if line.startswith('exec '): line = wm_exec
+ if line.st
rip().st
artswith('exec '): line = wm_exec
f.write(line)
f.write(line)
- os.fchmod(f.fileno(), 0750)
+ os.fchmod(f.fileno(), 0
o
750)
f.close()
# write new config
f.close()
# write new config
@@
-210,7
+212,7
@@
def main():
if device: f.write(str(device))
f.write(str(screen))
f.flush()
if device: f.write(str(device))
f.write(str(screen))
f.flush()
- os.fchmod(f.fileno(), 0644)
+ os.fchmod(f.fileno(), 0
o
644)
run_program(['sudo', 'mv', '-f', f.name, options.xorg_conf])
finally:
f.close()
run_program(['sudo', 'mv', '-f', f.name, options.xorg_conf])
finally:
f.close()
@@
-218,7
+220,7
@@
def main():
if options.start_server:
startx = ['startx', xinitrc, '--']
if options.display: startx.append(':' + options.display)
if options.start_server:
startx = ['startx', xinitrc, '--']
if options.display: startx.append(':' + options.display)
- print
"Starting X: %r" % startx
+ print
("Starting X: %r" % startx)
run_program(startx)
return 0
run_program(startx)
return 0
@@
-228,7
+230,7
@@
if __name__ == '__main__':
try:
rc = main()
except Exception:
try:
rc = main()
except Exception:
- print
"E: Exception: ",
+ print
("E: Exception: ", end=' ')
traceback.print_exc()
sys.exit(1)
traceback.print_exc()
sys.exit(1)