Merge pull request #193 from Gormogon/master
PEP Compliance and a Few Fixes
This commit is contained in:
commit
fd0614ab1c
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# encoding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
# Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||||
@ -49,6 +50,7 @@ def get_bootloader_entry_name():
|
|||||||
branding = libcalamares.globalstorage.value("branding")
|
branding = libcalamares.globalstorage.value("branding")
|
||||||
return branding["bootloaderEntryName"]
|
return branding["bootloaderEntryName"]
|
||||||
|
|
||||||
|
|
||||||
def create_conf(uuid, conf_path):
|
def create_conf(uuid, conf_path):
|
||||||
distribution = get_bootloader_entry_name()
|
distribution = get_bootloader_entry_name()
|
||||||
kernel = libcalamares.job.configuration["kernel"]
|
kernel = libcalamares.job.configuration["kernel"]
|
||||||
@ -127,9 +129,11 @@ def install_bootloader(boot_loader, fw_type):
|
|||||||
file_name_sanitizer = str.maketrans(" /", "_-")
|
file_name_sanitizer = str.maketrans(" /", "_-")
|
||||||
distribution_translated = distribution.translate(file_name_sanitizer)
|
distribution_translated = distribution.translate(file_name_sanitizer)
|
||||||
conf_path = os.path.join(
|
conf_path = os.path.join(
|
||||||
install_efi_directory, "loader", "entries", "{!s}.conf".format(distribution_translated))
|
install_efi_directory, "loader", "entries",
|
||||||
|
"{!s}.conf".format(distribution_translated))
|
||||||
fallback_path = os.path.join(
|
fallback_path = os.path.join(
|
||||||
install_efi_directory, "loader", "entries", "{!s}-fallback.conf".format(distribution_translated))
|
install_efi_directory, "loader", "entries",
|
||||||
|
"{!s}-fallback.conf".format(distribution_translated))
|
||||||
loader_path = os.path.join(
|
loader_path = os.path.join(
|
||||||
install_efi_directory, "loader", "loader.conf")
|
install_efi_directory, "loader", "loader.conf")
|
||||||
partitions = libcalamares.globalstorage.value("partitions")
|
partitions = libcalamares.globalstorage.value("partitions")
|
||||||
@ -141,17 +145,17 @@ def install_bootloader(boot_loader, fw_type):
|
|||||||
device = boot_device[:-1]
|
device = boot_device[:-1]
|
||||||
print(device)
|
print(device)
|
||||||
subprocess.call(["sgdisk", "--typecode={!s}:EF00".format(boot_p), "{!s}".format(device)])
|
subprocess.call(["sgdisk", "--typecode={!s}:EF00".format(boot_p), "{!s}".format(device)])
|
||||||
subprocess.call(
|
subprocess.call(["gummiboot", "--path={!s}".format(install_efi_directory), "install"])
|
||||||
["gummiboot", "--path={!s}".format(install_efi_directory), "install"])
|
|
||||||
create_conf(uuid, conf_path)
|
create_conf(uuid, conf_path)
|
||||||
create_fallback(uuid, fallback_path)
|
create_fallback(uuid, fallback_path)
|
||||||
create_loader(loader_path)
|
create_loader(loader_path)
|
||||||
else:
|
else:
|
||||||
install_path = boot_loader["installPath"]
|
install_path = boot_loader["installPath"]
|
||||||
check_chroot_call(
|
check_chroot_call(
|
||||||
[libcalamares.job.configuration["grubInstall"], "--target=i386-pc", install_path])
|
[libcalamares.job.configuration["grubInstall"], "--target=i386-pc",
|
||||||
check_chroot_call([libcalamares.job.configuration[
|
install_path])
|
||||||
"grubMkconfig"], "-o", libcalamares.job.configuration["grubCfg"]])
|
check_chroot_call([libcalamares.job.configuration["grubMkconfig"], "-o",
|
||||||
|
libcalamares.job.configuration["grubCfg"]])
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# encoding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014 - 2015, Philip Müller <philm@manjaro.org>
|
# Copyright 2014 - 2015, Philip Müller <philm@manjaro.org>
|
||||||
@ -42,17 +43,25 @@ desktop_environments = [
|
|||||||
DesktopEnvironment('/usr/bin/openbox-session', 'openbox')
|
DesktopEnvironment('/usr/bin/openbox-session', 'openbox')
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def find_desktop_environment(root_mount_point):
|
def find_desktop_environment(root_mount_point):
|
||||||
for desktop_environment in desktop_environments:
|
for desktop_environment in desktop_environments:
|
||||||
if os.path.exists("{!s}{!s}".format(root_mount_point,desktop_environment.executable)) \
|
if os.path.exists(
|
||||||
and os.path.exists("{!s}/usr/share/xsessions/{!s}.desktop".format(root_mount_point,desktop_environment.desktop_file)):
|
"{!s}{!s}".format(root_mount_point, desktop_environment.executable)) \
|
||||||
|
and os.path.exists("{!s}/usr/share/xsessions/{!s}.desktop".format(root_mount_point,
|
||||||
|
desktop_environment.desktop_file)):
|
||||||
return desktop_environment
|
return desktop_environment
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def have_dm(dm_name, root_mount_point):
|
|
||||||
return os.path.exists("{!s}/usr/bin/{!s}".format(root_mount_point,dm_name)) or os.path.exists("{!s}/usr/sbin/{!s}".format(root_mount_point,dm_name))
|
|
||||||
|
|
||||||
def set_autologin(username, displaymanagers, default_desktop_environment, root_mount_point):
|
def have_dm(dm_name, root_mount_point):
|
||||||
|
return os.path.exists(
|
||||||
|
"{!s}/usr/bin/{!s}".format(root_mount_point, dm_name)) or os.path.exists(
|
||||||
|
"{!s}/usr/sbin/{!s}".format(root_mount_point, dm_name))
|
||||||
|
|
||||||
|
|
||||||
|
def set_autologin(username, displaymanagers, default_desktop_environment,
|
||||||
|
root_mount_point):
|
||||||
""" Enables automatic login for the installed desktop managers """
|
""" Enables automatic login for the installed desktop managers """
|
||||||
|
|
||||||
if "mdm" in displaymanagers:
|
if "mdm" in displaymanagers:
|
||||||
@ -94,12 +103,15 @@ def set_autologin(username, displaymanagers, default_desktop_environment, root_m
|
|||||||
gdm_conf.write('AutomaticLoginEnable=True\n')
|
gdm_conf.write('AutomaticLoginEnable=True\n')
|
||||||
if os.path.exists("{!s}/var/lib/AccountsService/users".format(root_mount_point)):
|
if os.path.exists("{!s}/var/lib/AccountsService/users".format(root_mount_point)):
|
||||||
os.system(
|
os.system(
|
||||||
"echo \"[User]\" > {!s}/var/lib/AccountsService/users/{!s}".format(root_mount_point,username))
|
"echo \"[User]\" > {!s}/var/lib/AccountsService/users/{!s}".format(
|
||||||
if default_desktop_environment != None:
|
root_mount_point, username))
|
||||||
|
if default_desktop_environment is not None:
|
||||||
os.system(
|
os.system(
|
||||||
"echo \"XSession={!s}\" >> {!s}/var/lib/AccountsService/users/{!s}".format(default_desktop_environment.desktop_file,root_mount_point,username))
|
"echo \"XSession={!s}\" >> {!s}/var/lib/AccountsService/users/{!s}".format(
|
||||||
|
default_desktop_environment.desktop_file, root_mount_point, username))
|
||||||
os.system(
|
os.system(
|
||||||
"echo \"Icon=\" >> {!s}/var/lib/AccountsService/users/{!s}".format(root_mount_point,username))
|
"echo \"Icon=\" >> {!s}/var/lib/AccountsService/users/{!s}".format(
|
||||||
|
root_mount_point, username))
|
||||||
|
|
||||||
if "kdm" in displaymanagers:
|
if "kdm" in displaymanagers:
|
||||||
# Systems with KDM as Desktop Manager
|
# Systems with KDM as Desktop Manager
|
||||||
@ -187,7 +199,7 @@ def set_autologin(username, displaymanagers, default_desktop_environment, root_m
|
|||||||
line = 'User={}\n'.format(username)
|
line = 'User={}\n'.format(username)
|
||||||
# Session= line, commented out or with empty value
|
# Session= line, commented out or with empty value
|
||||||
if re.match('\\s*#\\s*Session=|\\s*Session=$', line):
|
if re.match('\\s*#\\s*Session=|\\s*Session=$', line):
|
||||||
if default_desktop_environment != None:
|
if default_desktop_environment is not None:
|
||||||
line = 'Session={}.desktop\n'.format(default_desktop_environment.desktop_file)
|
line = 'Session={}.desktop\n'.format(default_desktop_environment.desktop_file)
|
||||||
sddm_conf.write(line)
|
sddm_conf.write(line)
|
||||||
|
|
||||||
@ -216,7 +228,8 @@ def run():
|
|||||||
|
|
||||||
if "default_desktop_environment" in libcalamares.job.configuration:
|
if "default_desktop_environment" in libcalamares.job.configuration:
|
||||||
entry = libcalamares.job.configuration["defaultDesktopEnvironment"]
|
entry = libcalamares.job.configuration["defaultDesktopEnvironment"]
|
||||||
default_desktop_environment = DesktopEnvironment(entry["executable"], entry["desktopFile"])
|
default_desktop_environment = DesktopEnvironment(entry["executable"],
|
||||||
|
entry["desktopFile"])
|
||||||
else:
|
else:
|
||||||
default_desktop_environment = find_desktop_environment(root_mount_point)
|
default_desktop_environment = find_desktop_environment(root_mount_point)
|
||||||
|
|
||||||
@ -246,7 +259,8 @@ def run():
|
|||||||
libcalamares.utils.chroot_call(
|
libcalamares.utils.chroot_call(
|
||||||
['groupadd', '-g', '620', 'lightdm'])
|
['groupadd', '-g', '620', 'lightdm'])
|
||||||
if libcalamares.utils.chroot_call(['getent', 'passwd', 'lightdm']) != 0:
|
if libcalamares.utils.chroot_call(['getent', 'passwd', 'lightdm']) != 0:
|
||||||
libcalamares.utils.chroot_call(['useradd', '-c', '"LightDM Display Manager"',
|
libcalamares.utils.chroot_call(
|
||||||
|
['useradd', '-c', '"LightDM Display Manager"',
|
||||||
'-u', '620', '-g', 'lightdm', '-d', '/var/run/lightdm',
|
'-u', '620', '-g', 'lightdm', '-d', '/var/run/lightdm',
|
||||||
'-s', '/usr/bin/nologin', 'lightdm'])
|
'-s', '/usr/bin/nologin', 'lightdm'])
|
||||||
libcalamares.utils.chroot_call(['passwd', '-l', 'lightdm'])
|
libcalamares.utils.chroot_call(['passwd', '-l', 'lightdm'])
|
||||||
@ -254,9 +268,10 @@ def run():
|
|||||||
['chown', '-R', 'lightdm:lightdm', '/run/lightdm'])
|
['chown', '-R', 'lightdm:lightdm', '/run/lightdm'])
|
||||||
libcalamares.utils.chroot_call(
|
libcalamares.utils.chroot_call(
|
||||||
['chmod', '+r' '/etc/lightdm/lightdm.conf'])
|
['chmod', '+r' '/etc/lightdm/lightdm.conf'])
|
||||||
if default_desktop_environment != None:
|
if default_desktop_environment is not None:
|
||||||
os.system(
|
os.system(
|
||||||
"sed -i -e \"s/^.*user-session=.*/user-session={!s}/\" {!s}/etc/lightdm/lightdm.conf".format(default_desktop_environment.desktop_file,root_mount_point))
|
"sed -i -e \"s/^.*user-session=.*/user-session={!s}/\" {!s}/etc/lightdm/lightdm.conf".format(
|
||||||
|
default_desktop_environment.desktop_file, root_mount_point))
|
||||||
else:
|
else:
|
||||||
libcalamares.utils.debug("lightdm selected but not installed")
|
libcalamares.utils.debug("lightdm selected but not installed")
|
||||||
displaymanagers.remove("lightdm")
|
displaymanagers.remove("lightdm")
|
||||||
@ -268,7 +283,8 @@ def run():
|
|||||||
if libcalamares.utils.chroot_call(['getent', 'group', 'gdm']) != 0:
|
if libcalamares.utils.chroot_call(['getent', 'group', 'gdm']) != 0:
|
||||||
libcalamares.utils.chroot_call(['groupadd', '-g', '120', 'gdm'])
|
libcalamares.utils.chroot_call(['groupadd', '-g', '120', 'gdm'])
|
||||||
if libcalamares.utils.chroot_call(['getent', 'passwd', 'gdm']) != 0:
|
if libcalamares.utils.chroot_call(['getent', 'passwd', 'gdm']) != 0:
|
||||||
libcalamares.utils.chroot_call(['useradd', '-c', '"Gnome Display Manager"',
|
libcalamares.utils.chroot_call(
|
||||||
|
['useradd', '-c', '"Gnome Display Manager"',
|
||||||
'-u', '120', '-g', 'gdm', '-d', '/var/lib/gdm',
|
'-u', '120', '-g', 'gdm', '-d', '/var/lib/gdm',
|
||||||
'-s', '/usr/bin/nologin', 'gdm'])
|
'-s', '/usr/bin/nologin', 'gdm'])
|
||||||
libcalamares.utils.chroot_call(['passwd', '-l', 'gdm'])
|
libcalamares.utils.chroot_call(['passwd', '-l', 'gdm'])
|
||||||
@ -285,16 +301,18 @@ def run():
|
|||||||
if libcalamares.utils.chroot_call(['getent', 'group', 'mdm']) != 0:
|
if libcalamares.utils.chroot_call(['getent', 'group', 'mdm']) != 0:
|
||||||
libcalamares.utils.chroot_call(['groupadd', '-g', '128', 'mdm'])
|
libcalamares.utils.chroot_call(['groupadd', '-g', '128', 'mdm'])
|
||||||
if libcalamares.utils.chroot_call(['getent', 'passwd', 'mdm']) != 0:
|
if libcalamares.utils.chroot_call(['getent', 'passwd', 'mdm']) != 0:
|
||||||
libcalamares.utils.chroot_call(['useradd', '-c', '"Linux Mint Display Manager"',
|
libcalamares.utils.chroot_call(
|
||||||
|
['useradd', '-c', '"Linux Mint Display Manager"',
|
||||||
'-u', '128', '-g', 'mdm', '-d', '/var/lib/mdm',
|
'-u', '128', '-g', 'mdm', '-d', '/var/lib/mdm',
|
||||||
'-s', '/usr/bin/nologin', 'mdm'])
|
'-s', '/usr/bin/nologin', 'mdm'])
|
||||||
libcalamares.utils.chroot_call(['passwd', '-l', 'mdm'])
|
libcalamares.utils.chroot_call(['passwd', '-l', 'mdm'])
|
||||||
libcalamares.utils.chroot_call(
|
libcalamares.utils.chroot_call(
|
||||||
['chown', 'root:mdm', '/var/lib/mdm'])
|
['chown', 'root:mdm', '/var/lib/mdm'])
|
||||||
libcalamares.utils.chroot_call(['chmod', '1770', '/var/lib/mdm'])
|
libcalamares.utils.chroot_call(['chmod', '1770', '/var/lib/mdm'])
|
||||||
if default_desktop_environment != None:
|
if default_desktop_environment is not None:
|
||||||
os.system(
|
os.system(
|
||||||
"sed -i \"s|default.desktop|{!s}.desktop|g\" {!s}/etc/mdm/custom.conf".format(default_desktop_environment.desktop_file,root_mount_point))
|
"sed -i \"s|default.desktop|{!s}.desktop|g\" {!s}/etc/mdm/custom.conf".format(
|
||||||
|
default_desktop_environment.desktop_file, root_mount_point))
|
||||||
else:
|
else:
|
||||||
libcalamares.utils.debug("mdm selected but not installed")
|
libcalamares.utils.debug("mdm selected but not installed")
|
||||||
displaymanagers.remove("mdm")
|
displaymanagers.remove("mdm")
|
||||||
@ -311,9 +329,10 @@ def run():
|
|||||||
['chgrp', 'lxdm', '/etc/lxdm/lxdm.conf'])
|
['chgrp', 'lxdm', '/etc/lxdm/lxdm.conf'])
|
||||||
libcalamares.utils.chroot_call(
|
libcalamares.utils.chroot_call(
|
||||||
['chmod', '+r', '/etc/lxdm/lxdm.conf'])
|
['chmod', '+r', '/etc/lxdm/lxdm.conf'])
|
||||||
if default_desktop_environment != None:
|
if default_desktop_environment is not None:
|
||||||
os.system(
|
os.system(
|
||||||
"sed -i -e \"s|^.*session=.*|session={!s}|\" {!s}/etc/lxdm/lxdm.conf".format(default_desktop_environment.executable,root_mount_point))
|
"sed -i -e \"s|^.*session=.*|session={!s}|\" {!s}/etc/lxdm/lxdm.conf".format(
|
||||||
|
default_desktop_environment.executable, root_mount_point))
|
||||||
else:
|
else:
|
||||||
libcalamares.utils.debug("lxdm selected but not installed")
|
libcalamares.utils.debug("lxdm selected but not installed")
|
||||||
displaymanagers.remove("lxdm")
|
displaymanagers.remove("lxdm")
|
||||||
@ -325,7 +344,8 @@ def run():
|
|||||||
if libcalamares.utils.chroot_call(['getent', 'group', 'kdm']) != 0:
|
if libcalamares.utils.chroot_call(['getent', 'group', 'kdm']) != 0:
|
||||||
libcalamares.utils.chroot_call(['groupadd', '-g', '135', 'kdm'])
|
libcalamares.utils.chroot_call(['groupadd', '-g', '135', 'kdm'])
|
||||||
if libcalamares.utils.chroot_call(['getent', 'passwd', 'kdm']) != 0:
|
if libcalamares.utils.chroot_call(['getent', 'passwd', 'kdm']) != 0:
|
||||||
libcalamares.utils.chroot_call(['useradd', '-u', '135', '-g', 'kdm', '-d',
|
libcalamares.utils.chroot_call(
|
||||||
|
['useradd', '-u', '135', '-g', 'kdm', '-d',
|
||||||
'/var/lib/kdm', '-s', '/bin/false', '-r', '-M', 'kdm'])
|
'/var/lib/kdm', '-s', '/bin/false', '-r', '-M', 'kdm'])
|
||||||
libcalamares.utils.chroot_call(
|
libcalamares.utils.chroot_call(
|
||||||
['chown', '-R', '135:135', 'var/lib/kdm'])
|
['chown', '-R', '135:135', 'var/lib/kdm'])
|
||||||
@ -333,7 +353,7 @@ def run():
|
|||||||
libcalamares.utils.debug("kdm selected but not installed")
|
libcalamares.utils.debug("kdm selected but not installed")
|
||||||
displaymanagers.remove("kdm")
|
displaymanagers.remove("kdm")
|
||||||
|
|
||||||
if username != None:
|
if username is not None:
|
||||||
libcalamares.utils.debug(
|
libcalamares.utils.debug(
|
||||||
"Setting up autologin for user {!s}.".format(username))
|
"Setting up autologin for user {!s}.".format(username))
|
||||||
return set_autologin(username, displaymanagers, default_desktop_environment, root_mount_point)
|
return set_autologin(username, displaymanagers, default_desktop_environment, root_mount_point)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# encoding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014, Philip Müller <philm@manjaro.org>
|
# Copyright 2014, Philip Müller <philm@manjaro.org>
|
||||||
@ -21,9 +22,11 @@
|
|||||||
import libcalamares
|
import libcalamares
|
||||||
from libcalamares.utils import chroot_call
|
from libcalamares.utils import chroot_call
|
||||||
|
|
||||||
|
|
||||||
def run_dracut():
|
def run_dracut():
|
||||||
return chroot_call(['dracut', '-f'])
|
return chroot_call(['dracut', '-f'])
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
returnCode = run_dracut()
|
returnCode = run_dracut()
|
||||||
if returnCode != 0:
|
if returnCode != 0:
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
# Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
||||||
@ -30,16 +32,13 @@ def run():
|
|||||||
accumulator += "This job's path: " + libcalamares.job.working_path + "\n"
|
accumulator += "This job's path: " + libcalamares.job.working_path + "\n"
|
||||||
accumulator += str(libcalamares.job.configuration)
|
accumulator += str(libcalamares.job.configuration)
|
||||||
accumulator += " *** globalstorage test ***\n"
|
accumulator += " *** globalstorage test ***\n"
|
||||||
accumulator += "lala: " + \
|
accumulator += "lala: " + str(libcalamares.globalstorage.contains("lala")) + "\n"
|
||||||
str(libcalamares.globalstorage.contains("lala")) + "\n"
|
accumulator += "foo: " + str(libcalamares.globalstorage.contains("foo")) + "\n"
|
||||||
accumulator += "foo: " + \
|
|
||||||
str(libcalamares.globalstorage.contains("foo")) + "\n"
|
|
||||||
accumulator += "count: " + str(libcalamares.globalstorage.count()) + "\n"
|
accumulator += "count: " + str(libcalamares.globalstorage.count()) + "\n"
|
||||||
libcalamares.globalstorage.insert("item2", "value2")
|
libcalamares.globalstorage.insert("item2", "value2")
|
||||||
libcalamares.globalstorage.insert("item3", 3)
|
libcalamares.globalstorage.insert("item3", 3)
|
||||||
accumulator += "keys: {}\n".format(str(libcalamares.globalstorage.keys()))
|
accumulator += "keys: {}\n".format(str(libcalamares.globalstorage.keys()))
|
||||||
accumulator += "remove: {}\n".format(
|
accumulator += "remove: {}\n".format(str(libcalamares.globalstorage.remove("item2")))
|
||||||
str(libcalamares.globalstorage.remove("item2")))
|
|
||||||
accumulator += "values: {} {} {}\n".format(
|
accumulator += "values: {} {} {}\n".format(
|
||||||
str(libcalamares.globalstorage.value("foo")),
|
str(libcalamares.globalstorage.value("foo")),
|
||||||
str(libcalamares.globalstorage.value("item2")),
|
str(libcalamares.globalstorage.value("item2")),
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# encoding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
# Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||||
@ -148,6 +149,7 @@ class FstabGenerator(object):
|
|||||||
if partition["mountPoint"]:
|
if partition["mountPoint"]:
|
||||||
mkdir_p(self.root_mount_point + partition["mountPoint"])
|
mkdir_p(self.root_mount_point + partition["mountPoint"])
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
gs = libcalamares.globalstorage
|
gs = libcalamares.globalstorage
|
||||||
conf = libcalamares.job.configuration
|
conf = libcalamares.job.configuration
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# encoding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
# Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||||
@ -36,15 +37,23 @@ def install_grub(boot_loader, fw_type):
|
|||||||
distribution = branding["bootloaderEntryName"]
|
distribution = branding["bootloaderEntryName"]
|
||||||
file_name_sanitizer = str.maketrans(" /", "_-")
|
file_name_sanitizer = str.maketrans(" /", "_-")
|
||||||
efi_bootloader_id = distribution.translate(file_name_sanitizer)
|
efi_bootloader_id = distribution.translate(file_name_sanitizer)
|
||||||
check_chroot_call([libcalamares.job.configuration["grubInstall"], "--target=x86_64-efi", "--efi-directory={!s}".format(efi_directory), "--bootloader-id={!s}".format(efi_bootloader_id)])
|
check_chroot_call(
|
||||||
|
[libcalamares.job.configuration["grubInstall"], "--target=x86_64-efi",
|
||||||
|
"--efi-directory={!s}".format(efi_directory),
|
||||||
|
"--bootloader-id={!s}".format(efi_bootloader_id)])
|
||||||
# Workaround for some UEFI firmwares
|
# Workaround for some UEFI firmwares
|
||||||
check_chroot_call(["mkdir", "-p", "{!s}/boot".format(efi_directory_firmware)])
|
check_chroot_call(["mkdir", "-p", "{!s}/boot".format(efi_directory_firmware)])
|
||||||
check_chroot_call(["cp", "{!s}/{!s}/grubx64.efi".format(efi_directory_firmware,efi_bootloader_id), "{!s}/boot/bootx64.efi".format(efi_directory_firmware)])
|
check_chroot_call(["cp", "{!s}/{!s}/grubx64.efi".format(efi_directory_firmware,
|
||||||
|
efi_bootloader_id),
|
||||||
|
"{!s}/boot/bootx64.efi".format(efi_directory_firmware)])
|
||||||
else:
|
else:
|
||||||
install_path = boot_loader["installPath"]
|
install_path = boot_loader["installPath"]
|
||||||
check_chroot_call([libcalamares.job.configuration["grubInstall"], "--target=i386-pc", install_path])
|
check_chroot_call(
|
||||||
|
[libcalamares.job.configuration["grubInstall"], "--target=i386-pc",
|
||||||
|
install_path])
|
||||||
|
|
||||||
check_chroot_call([libcalamares.job.configuration["grubMkconfig"], "-o", libcalamares.job.configuration["grubCfg"]])
|
check_chroot_call([libcalamares.job.configuration["grubMkconfig"], "-o",
|
||||||
|
libcalamares.job.configuration["grubCfg"]])
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# encoding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014 - 2015, Philip Müller <philm@manjaro.org>
|
# Copyright 2014 - 2015, Philip Müller <philm@manjaro.org>
|
||||||
@ -22,7 +23,6 @@ import os
|
|||||||
|
|
||||||
|
|
||||||
def modify_grub_default(partitions, root_mount_point, distributor):
|
def modify_grub_default(partitions, root_mount_point, distributor):
|
||||||
|
|
||||||
default_dir = os.path.join(root_mount_point, "etc/default")
|
default_dir = os.path.join(root_mount_point, "etc/default")
|
||||||
default_grub = os.path.join(default_dir, "grub")
|
default_grub = os.path.join(default_dir, "grub")
|
||||||
distributor_replace = distributor.replace("'", "'\\''")
|
distributor_replace = distributor.replace("'", "'\\''")
|
||||||
@ -93,6 +93,7 @@ def modify_grub_default(partitions, root_mount_point, distributor):
|
|||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
partitions = libcalamares.globalstorage.value("partitions")
|
partitions = libcalamares.globalstorage.value("partitions")
|
||||||
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
|
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# encoding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014 - 2015, Philip Müller <philm@manjaro.org>
|
# Copyright 2014 - 2015, Philip Müller <philm@manjaro.org>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# encoding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014, Philip Müller <philm@manjaro.org>
|
# Copyright 2014, Philip Müller <philm@manjaro.org>
|
||||||
@ -20,10 +21,12 @@
|
|||||||
import libcalamares
|
import libcalamares
|
||||||
from libcalamares.utils import check_chroot_call
|
from libcalamares.utils import check_chroot_call
|
||||||
|
|
||||||
|
|
||||||
def run_mkinitcpio():
|
def run_mkinitcpio():
|
||||||
kernel = libcalamares.job.configuration['kernel']
|
kernel = libcalamares.job.configuration['kernel']
|
||||||
check_chroot_call(['mkinitcpio', '-p', kernel])
|
check_chroot_call(['mkinitcpio', '-p', kernel])
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
run_mkinitcpio()
|
run_mkinitcpio()
|
||||||
return None
|
return None
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# encoding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014, Rohan Garg <rohan@kde.org>
|
# Copyright 2014, Rohan Garg <rohan@kde.org>
|
||||||
@ -25,13 +26,14 @@ import shutil
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from libcalamares.utils import check_chroot_call
|
from libcalamares.utils import check_chroot_call
|
||||||
|
|
||||||
|
|
||||||
def cpuinfo():
|
def cpuinfo():
|
||||||
''' Return the information in /proc/cpuinfo
|
"""
|
||||||
as a dictionary in the following format:
|
Return the information in /proc/cpuinfo as a dictionary in the following format:
|
||||||
cpu_info['proc0']={...}
|
cpu_info['proc0']={...}
|
||||||
cpu_info['proc1']={...}
|
cpu_info['proc1']={...}
|
||||||
|
|
||||||
'''
|
"""
|
||||||
|
|
||||||
cpuinfo = OrderedDict()
|
cpuinfo = OrderedDict()
|
||||||
procinfo = OrderedDict()
|
procinfo = OrderedDict()
|
||||||
@ -42,7 +44,7 @@ def cpuinfo():
|
|||||||
if not line.strip():
|
if not line.strip():
|
||||||
# end of one processor
|
# end of one processor
|
||||||
cpuinfo["proc{!s}".format(nprocs)] = procinfo
|
cpuinfo["proc{!s}".format(nprocs)] = procinfo
|
||||||
nprocs=nprocs+1
|
nprocs += 1
|
||||||
# Reset
|
# Reset
|
||||||
procinfo = OrderedDict()
|
procinfo = OrderedDict()
|
||||||
else:
|
else:
|
||||||
@ -53,6 +55,7 @@ def cpuinfo():
|
|||||||
|
|
||||||
return cpuinfo
|
return cpuinfo
|
||||||
|
|
||||||
|
|
||||||
def set_mkinitcpio_hooks_and_modules(hooks, modules, root_mount_point):
|
def set_mkinitcpio_hooks_and_modules(hooks, modules, root_mount_point):
|
||||||
""" Set up mkinitcpio.conf """
|
""" Set up mkinitcpio.conf """
|
||||||
|
|
||||||
@ -71,6 +74,7 @@ def set_mkinitcpio_hooks_and_modules(hooks, modules, root_mount_point):
|
|||||||
with open(path, "w") as mkinitcpio_file:
|
with open(path, "w") as mkinitcpio_file:
|
||||||
mkinitcpio_file.write("\n".join(mklins) + "\n")
|
mkinitcpio_file.write("\n".join(mklins) + "\n")
|
||||||
|
|
||||||
|
|
||||||
def modify_mkinitcpio_conf(partitions, root_mount_point):
|
def modify_mkinitcpio_conf(partitions, root_mount_point):
|
||||||
""" Modifies mkinitcpio.conf """
|
""" Modifies mkinitcpio.conf """
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# encoding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014, Philip Müller <philm@manjaro.org>
|
# Copyright 2014, Philip Müller <philm@manjaro.org>
|
||||||
@ -19,6 +20,7 @@
|
|||||||
|
|
||||||
from libcalamares.utils import chroot_call
|
from libcalamares.utils import chroot_call
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
returnCode = chroot_call(["update-initramfs", "-k", "all", "-u"])
|
returnCode = chroot_call(["update-initramfs", "-k", "all", "-u"])
|
||||||
if returnCode != 0:
|
if returnCode != 0:
|
||||||
|
@ -55,6 +55,7 @@ ro-cedilla ro pc105 cedilla terminate:ctrl_alt_bksp
|
|||||||
ie ie pc105 - terminate:ctrl_alt_bksp
|
ie ie pc105 - terminate:ctrl_alt_bksp
|
||||||
et ee pc105 - terminate:ctrl_alt_bksp
|
et ee pc105 - terminate:ctrl_alt_bksp
|
||||||
sk-qwerty sk pc105 - terminate:ctrl_alt_bksp,qwerty
|
sk-qwerty sk pc105 - terminate:ctrl_alt_bksp,qwerty
|
||||||
|
sk-qwertz sk pc105 - terminate:ctrl_alt_bksp
|
||||||
fr-latin9 fr pc105 latin9 terminate:ctrl_alt_bksp
|
fr-latin9 fr pc105 latin9 terminate:ctrl_alt_bksp
|
||||||
fr_CH-latin1 ch pc105 fr terminate:ctrl_alt_bksp
|
fr_CH-latin1 ch pc105 fr terminate:ctrl_alt_bksp
|
||||||
cf ca pc105 - terminate:ctrl_alt_bksp
|
cf ca pc105 - terminate:ctrl_alt_bksp
|
||||||
@ -64,4 +65,7 @@ gr gr,us pc105 - terminate:ctrl_alt_bksp,grp:shifts_toggle,grp_led:scroll
|
|||||||
by by,us pc105 - terminate:ctrl_alt_bksp,grp:shifts_toggle,grp_led:scroll
|
by by,us pc105 - terminate:ctrl_alt_bksp,grp:shifts_toggle,grp_led:scroll
|
||||||
il il pc105 - terminate:ctrl_alt_bksp
|
il il pc105 - terminate:ctrl_alt_bksp
|
||||||
kazakh kz,us pc105 - terminate:ctrl_alt_bksp,grp:shifts_toggle,grp_led:scroll
|
kazakh kz,us pc105 - terminate:ctrl_alt_bksp,grp:shifts_toggle,grp_led:scroll
|
||||||
|
lt.baltic lt pc105 - terminate:ctrl_alt_bksp
|
||||||
|
lt.l4 lt pc105 - terminate:ctrl_alt_bksp
|
||||||
lt lt pc105 - terminate:ctrl_alt_bksp
|
lt lt pc105 - terminate:ctrl_alt_bksp
|
||||||
|
khmer kh,us pc105 - terminate:ctrl_alt_bksp
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# encoding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014, Anke Boersma <demm@kaosx.us>
|
# Copyright 2014, Anke Boersma <demm@kaosx.us>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# encoding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014, Kevin Kofler <kevin.kofler@chello.at>
|
# Copyright 2014, Kevin Kofler <kevin.kofler@chello.at>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# encoding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
# Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# encoding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014, Philip Müller <philm@manjaro.org>
|
# Copyright 2014, Philip Müller <philm@manjaro.org>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# encoding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014, Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
|
# Copyright 2014, Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
|
||||||
@ -20,6 +21,7 @@
|
|||||||
import libcalamares
|
import libcalamares
|
||||||
from libcalamares.utils import check_chroot_call, chroot_call
|
from libcalamares.utils import check_chroot_call, chroot_call
|
||||||
|
|
||||||
|
|
||||||
class PackageManager:
|
class PackageManager:
|
||||||
def __init__(self, backend):
|
def __init__(self, backend):
|
||||||
self.backend = backend
|
self.backend = backend
|
||||||
@ -29,13 +31,17 @@ class PackageManager:
|
|||||||
for pkg in pkgs:
|
for pkg in pkgs:
|
||||||
check_chroot_call(["pkcon", "-py", "install", pkg])
|
check_chroot_call(["pkcon", "-py", "install", pkg])
|
||||||
elif self.backend == "zypp":
|
elif self.backend == "zypp":
|
||||||
check_chroot_call(["zypper", "--non-interactive", "--quiet-install", "install", "--auto-agree-with-licenses", "install"] + pkgs)
|
check_chroot_call(
|
||||||
|
["zypper", "--non-interactive", "--quiet-install", "install",
|
||||||
|
"--auto-agree-with-licenses", "install"] + pkgs)
|
||||||
elif self.backend == "yum":
|
elif self.backend == "yum":
|
||||||
check_chroot_call(["yum", "install", "-y"] + pkgs)
|
check_chroot_call(["yum", "install", "-y"] + pkgs)
|
||||||
elif self.backend == "dnf":
|
elif self.backend == "dnf":
|
||||||
check_chroot_call(["dnf", "install", "-y"] + pkgs)
|
check_chroot_call(["dnf", "install", "-y"] + pkgs)
|
||||||
elif self.backend == "urpmi":
|
elif self.backend == "urpmi":
|
||||||
check_chroot_call(["urpmi", "--download-all", "--no-suggests", "--no-verify-rpm", "--fastunsafe", "--ignoresize", "--nolock", "--auto"] + pkgs)
|
check_chroot_call(
|
||||||
|
["urpmi", "--download-all", "--no-suggests", "--no-verify-rpm",
|
||||||
|
"--fastunsafe", "--ignoresize", "--nolock", "--auto"] + pkgs)
|
||||||
elif self.backend == "apt":
|
elif self.backend == "apt":
|
||||||
check_chroot_call(["apt-get", "-q", "-y", "install"] + pkgs)
|
check_chroot_call(["apt-get", "-q", "-y", "install"] + pkgs)
|
||||||
elif self.backend == "pacman":
|
elif self.backend == "pacman":
|
||||||
@ -60,6 +66,7 @@ class PackageManager:
|
|||||||
elif self.backend == "pacman":
|
elif self.backend == "pacman":
|
||||||
check_chroot_call(["pacman", "-Rs", "--noconfirm"] + pkgs)
|
check_chroot_call(["pacman", "-Rs", "--noconfirm"] + pkgs)
|
||||||
|
|
||||||
|
|
||||||
def run_operations(pkgman, entry):
|
def run_operations(pkgman, entry):
|
||||||
for key in entry.keys():
|
for key in entry.keys():
|
||||||
if key == "install":
|
if key == "install":
|
||||||
@ -67,6 +74,7 @@ def run_operations(pkgman, entry):
|
|||||||
elif key == "remove":
|
elif key == "remove":
|
||||||
pkgman.remove(entry[key])
|
pkgman.remove(entry[key])
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
backend = libcalamares.job.configuration.get("backend")
|
backend = libcalamares.job.configuration.get("backend")
|
||||||
if backend not in ("packagekit", "zypp", "yum", "dnf", "urpmi", "apt", "pacman"):
|
if backend not in ("packagekit", "zypp", "yum", "dnf", "urpmi", "apt", "pacman"):
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# encoding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014, Philip Müller <philm@manjaro.org>
|
# Copyright 2014, Philip Müller <philm@manjaro.org>
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
# Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
||||||
@ -33,7 +35,6 @@ except ImportError:
|
|||||||
|
|
||||||
|
|
||||||
class Job:
|
class Job:
|
||||||
|
|
||||||
def __init__(self, working_path, doc, cfg_doc):
|
def __init__(self, working_path, doc, cfg_doc):
|
||||||
self.module_name = doc["name"]
|
self.module_name = doc["name"]
|
||||||
self.pretty_name = "Testing job " + doc["name"]
|
self.pretty_name = "Testing job " + doc["name"]
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# encoding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
# Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# encoding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
# Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
||||||
@ -29,6 +30,7 @@ from collections import namedtuple
|
|||||||
|
|
||||||
from libcalamares import *
|
from libcalamares import *
|
||||||
|
|
||||||
|
|
||||||
class UnpackEntry:
|
class UnpackEntry:
|
||||||
__slots__ = ['source', 'sourcefs', 'destination', 'copied', 'total']
|
__slots__ = ['source', 'sourcefs', 'destination', 'copied', 'total']
|
||||||
|
|
||||||
@ -39,6 +41,7 @@ class UnpackEntry:
|
|||||||
self.copied = 0
|
self.copied = 0
|
||||||
self.total = 0
|
self.total = 0
|
||||||
|
|
||||||
|
|
||||||
ON_POSIX = 'posix' in sys.builtin_module_names
|
ON_POSIX = 'posix' in sys.builtin_module_names
|
||||||
|
|
||||||
|
|
||||||
@ -103,7 +106,6 @@ def file_copy(source, dest, progress_cb):
|
|||||||
|
|
||||||
|
|
||||||
class UnpackOperation:
|
class UnpackOperation:
|
||||||
|
|
||||||
def __init__(self, entries):
|
def __init__(self, entries):
|
||||||
self.entries = entries
|
self.entries = entries
|
||||||
self.entry_for_source = dict((x.source, x) for x in self.entries)
|
self.entry_for_source = dict((x.source, x) for x in self.entries)
|
||||||
@ -116,8 +118,7 @@ class UnpackOperation:
|
|||||||
|
|
||||||
partialprogress = 0.05 # Having a total !=0 gives 5%
|
partialprogress = 0.05 # Having a total !=0 gives 5%
|
||||||
|
|
||||||
partialprogress += 0.95 * \
|
partialprogress += 0.95 * (entry.copied / float(entry.total))
|
||||||
(entry.copied / float(entry.total))
|
|
||||||
progress += partialprogress / len(self.entries)
|
progress += partialprogress / len(self.entries)
|
||||||
|
|
||||||
job.setprogress(progress)
|
job.setprogress(progress)
|
||||||
@ -136,8 +137,9 @@ class UnpackOperation:
|
|||||||
fslist = ""
|
fslist = ""
|
||||||
|
|
||||||
if entry.sourcefs == "squashfs":
|
if entry.sourcefs == "squashfs":
|
||||||
if shutil.which("unsquashfs") == None:
|
if shutil.which("unsquashfs") is None:
|
||||||
return ("Failed to unpack image", "Failed to find unsquashfs, make sure you have "
|
return ("Failed to unpack image",
|
||||||
|
"Failed to find unsquashfs, make sure you have "
|
||||||
"the squashfs-tools package installed")
|
"the squashfs-tools package installed")
|
||||||
|
|
||||||
fslist = subprocess.check_output(["unsquashfs",
|
fslist = subprocess.check_output(["unsquashfs",
|
||||||
@ -218,7 +220,7 @@ def run():
|
|||||||
if os.path.isfile(PATH_PROCFS) and os.access(PATH_PROCFS, os.R_OK):
|
if os.path.isfile(PATH_PROCFS) and os.access(PATH_PROCFS, os.R_OK):
|
||||||
procfile = open(PATH_PROCFS, 'r')
|
procfile = open(PATH_PROCFS, 'r')
|
||||||
filesystems = procfile.read()
|
filesystems = procfile.read()
|
||||||
procfile.close
|
procfile.close()
|
||||||
|
|
||||||
filesystems = filesystems.replace("nodev", "")
|
filesystems = filesystems.replace("nodev", "")
|
||||||
filesystems = filesystems.replace("\t", "")
|
filesystems = filesystems.replace("\t", "")
|
||||||
@ -229,7 +231,7 @@ def run():
|
|||||||
if fs == sourcefs:
|
if fs == sourcefs:
|
||||||
fs_is_supported = True
|
fs_is_supported = True
|
||||||
|
|
||||||
if fs_is_supported == False:
|
if not fs_is_supported:
|
||||||
return "Bad filesystem", "sourcefs=\"{}\"".format(sourcefs)
|
return "Bad filesystem", "sourcefs=\"{}\"".format(sourcefs)
|
||||||
|
|
||||||
destination = os.path.abspath(root_mount_point + entry["destination"])
|
destination = os.path.abspath(root_mount_point + entry["destination"])
|
||||||
|
Loading…
Reference in New Issue
Block a user