Merge pull request #193 from Gormogon/master

PEP Compliance and a Few Fixes
main
Teo Mrnjavac 10 years ago
commit fd0614ab1c

@ -1,5 +1,6 @@
#!/usr/bin/env python3
# encoding: utf-8
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014, Aurélien Gâteau <agateau@kde.org>
@ -49,6 +50,7 @@ def get_bootloader_entry_name():
branding = libcalamares.globalstorage.value("branding")
return branding["bootloaderEntryName"]
def create_conf(uuid, conf_path):
distribution = get_bootloader_entry_name()
kernel = libcalamares.job.configuration["kernel"]
@ -127,9 +129,11 @@ def install_bootloader(boot_loader, fw_type):
file_name_sanitizer = str.maketrans(" /", "_-")
distribution_translated = distribution.translate(file_name_sanitizer)
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(
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(
install_efi_directory, "loader", "loader.conf")
partitions = libcalamares.globalstorage.value("partitions")
@ -141,17 +145,17 @@ def install_bootloader(boot_loader, fw_type):
device = boot_device[:-1]
print(device)
subprocess.call(["sgdisk", "--typecode={!s}:EF00".format(boot_p), "{!s}".format(device)])
subprocess.call(
["gummiboot", "--path={!s}".format(install_efi_directory), "install"])
subprocess.call(["gummiboot", "--path={!s}".format(install_efi_directory), "install"])
create_conf(uuid, conf_path)
create_fallback(uuid, fallback_path)
create_loader(loader_path)
else:
install_path = boot_loader["installPath"]
check_chroot_call(
[libcalamares.job.configuration["grubInstall"], "--target=i386-pc", install_path])
check_chroot_call([libcalamares.job.configuration[
"grubMkconfig"], "-o", libcalamares.job.configuration["grubCfg"]])
[libcalamares.job.configuration["grubInstall"], "--target=i386-pc",
install_path])
check_chroot_call([libcalamares.job.configuration["grubMkconfig"], "-o",
libcalamares.job.configuration["grubCfg"]])
def run():

@ -1,5 +1,6 @@
#!/usr/bin/env python3
# encoding: utf-8
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014 - 2015, Philip Müller <philm@manjaro.org>
@ -29,8 +30,8 @@ import subprocess
DesktopEnvironment = collections.namedtuple('DesktopEnvironment', ['executable', 'desktop_file'])
desktop_environments = [
DesktopEnvironment('/usr/bin/startkde', 'plasma'), # KDE Plasma 5
DesktopEnvironment('/usr/bin/startkde', 'kde-plasma'), # KDE Plasma 4
DesktopEnvironment('/usr/bin/startkde', 'plasma'), # KDE Plasma 5
DesktopEnvironment('/usr/bin/startkde', 'kde-plasma'), # KDE Plasma 4
DesktopEnvironment('/usr/bin/gnome-session', 'gnome'),
DesktopEnvironment('/usr/bin/startxfce4', 'xfce'),
DesktopEnvironment('/usr/bin/cinnamon-session', 'cinnamon-session'),
@ -42,17 +43,25 @@ desktop_environments = [
DesktopEnvironment('/usr/bin/openbox-session', 'openbox')
]
def find_desktop_environment(root_mount_point):
for desktop_environment in desktop_environments:
if os.path.exists("{!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)):
if os.path.exists(
"{!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 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))
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 set_autologin(username, displaymanagers, default_desktop_environment,
root_mount_point):
""" Enables automatic login for the installed desktop managers """
if "mdm" in displaymanagers:
@ -94,12 +103,15 @@ def set_autologin(username, displaymanagers, default_desktop_environment, root_m
gdm_conf.write('AutomaticLoginEnable=True\n')
if os.path.exists("{!s}/var/lib/AccountsService/users".format(root_mount_point)):
os.system(
"echo \"[User]\" > {!s}/var/lib/AccountsService/users/{!s}".format(root_mount_point,username))
if default_desktop_environment != None:
"echo \"[User]\" > {!s}/var/lib/AccountsService/users/{!s}".format(
root_mount_point, username))
if default_desktop_environment is not None:
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(
"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:
# Systems with KDM as Desktop Manager
@ -187,10 +199,10 @@ def set_autologin(username, displaymanagers, default_desktop_environment, root_m
line = 'User={}\n'.format(username)
# Session= line, commented out or with empty value
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)
sddm_conf.write(line)
return None
@ -208,15 +220,16 @@ def run():
displaymanagers = libcalamares.globalstorage.value("displaymanagers")
if displaymanagers is None:
return "No display managers selected for the displaymanager module.",\
return "No display managers selected for the displaymanager module.", \
"The displaymanagers list is empty or undefined in both globalstorage and displaymanager.conf."
username = libcalamares.globalstorage.value("autologinUser")
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
if "default_desktop_environment" in libcalamares.job.configuration:
entry = libcalamares.job.configuration["defaultDesktopEnvironment"]
default_desktop_environment = DesktopEnvironment(entry["executable"], entry["desktopFile"])
default_desktop_environment = DesktopEnvironment(entry["executable"],
entry["desktopFile"])
else:
default_desktop_environment = find_desktop_environment(root_mount_point)
@ -246,17 +259,19 @@ def run():
libcalamares.utils.chroot_call(
['groupadd', '-g', '620', 'lightdm'])
if libcalamares.utils.chroot_call(['getent', 'passwd', 'lightdm']) != 0:
libcalamares.utils.chroot_call(['useradd', '-c', '"LightDM Display Manager"',
'-u', '620', '-g', 'lightdm', '-d', '/var/run/lightdm',
'-s', '/usr/bin/nologin', 'lightdm'])
libcalamares.utils.chroot_call(
['useradd', '-c', '"LightDM Display Manager"',
'-u', '620', '-g', 'lightdm', '-d', '/var/run/lightdm',
'-s', '/usr/bin/nologin', 'lightdm'])
libcalamares.utils.chroot_call(['passwd', '-l', 'lightdm'])
libcalamares.utils.chroot_call(
['chown', '-R', 'lightdm:lightdm', '/run/lightdm'])
libcalamares.utils.chroot_call(
['chmod', '+r' '/etc/lightdm/lightdm.conf'])
if default_desktop_environment != None:
if default_desktop_environment is not None:
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:
libcalamares.utils.debug("lightdm selected but not installed")
displaymanagers.remove("lightdm")
@ -268,9 +283,10 @@ def run():
if libcalamares.utils.chroot_call(['getent', 'group', 'gdm']) != 0:
libcalamares.utils.chroot_call(['groupadd', '-g', '120', 'gdm'])
if libcalamares.utils.chroot_call(['getent', 'passwd', 'gdm']) != 0:
libcalamares.utils.chroot_call(['useradd', '-c', '"Gnome Display Manager"',
'-u', '120', '-g', 'gdm', '-d', '/var/lib/gdm',
'-s', '/usr/bin/nologin', 'gdm'])
libcalamares.utils.chroot_call(
['useradd', '-c', '"Gnome Display Manager"',
'-u', '120', '-g', 'gdm', '-d', '/var/lib/gdm',
'-s', '/usr/bin/nologin', 'gdm'])
libcalamares.utils.chroot_call(['passwd', '-l', 'gdm'])
libcalamares.utils.chroot_call(
['chown', '-R', 'gdm:gdm', '/var/lib/gdm'])
@ -285,16 +301,18 @@ def run():
if libcalamares.utils.chroot_call(['getent', 'group', 'mdm']) != 0:
libcalamares.utils.chroot_call(['groupadd', '-g', '128', 'mdm'])
if libcalamares.utils.chroot_call(['getent', 'passwd', 'mdm']) != 0:
libcalamares.utils.chroot_call(['useradd', '-c', '"Linux Mint Display Manager"',
'-u', '128', '-g', 'mdm', '-d', '/var/lib/mdm',
'-s', '/usr/bin/nologin', 'mdm'])
libcalamares.utils.chroot_call(
['useradd', '-c', '"Linux Mint Display Manager"',
'-u', '128', '-g', 'mdm', '-d', '/var/lib/mdm',
'-s', '/usr/bin/nologin', 'mdm'])
libcalamares.utils.chroot_call(['passwd', '-l', 'mdm'])
libcalamares.utils.chroot_call(
['chown', 'root:mdm', '/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(
"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:
libcalamares.utils.debug("mdm selected but not installed")
displaymanagers.remove("mdm")
@ -311,9 +329,10 @@ def run():
['chgrp', 'lxdm', '/etc/lxdm/lxdm.conf'])
libcalamares.utils.chroot_call(
['chmod', '+r', '/etc/lxdm/lxdm.conf'])
if default_desktop_environment != None:
if default_desktop_environment is not None:
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:
libcalamares.utils.debug("lxdm selected but not installed")
displaymanagers.remove("lxdm")
@ -325,15 +344,16 @@ def run():
if libcalamares.utils.chroot_call(['getent', 'group', 'kdm']) != 0:
libcalamares.utils.chroot_call(['groupadd', '-g', '135', 'kdm'])
if libcalamares.utils.chroot_call(['getent', 'passwd', 'kdm']) != 0:
libcalamares.utils.chroot_call(['useradd', '-u', '135', '-g', 'kdm', '-d',
'/var/lib/kdm', '-s', '/bin/false', '-r', '-M', 'kdm'])
libcalamares.utils.chroot_call(
['useradd', '-u', '135', '-g', 'kdm', '-d',
'/var/lib/kdm', '-s', '/bin/false', '-r', '-M', 'kdm'])
libcalamares.utils.chroot_call(
['chown', '-R', '135:135', 'var/lib/kdm'])
else:
libcalamares.utils.debug("kdm selected but not installed")
displaymanagers.remove("kdm")
if username != None:
if username is not None:
libcalamares.utils.debug(
"Setting up autologin for user {!s}.".format(username))
return set_autologin(username, displaymanagers, default_desktop_environment, root_mount_point)

@ -1,5 +1,6 @@
#!/usr/bin/env python3
# encoding: utf-8
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014, Philip Müller <philm@manjaro.org>
@ -21,9 +22,11 @@
import libcalamares
from libcalamares.utils import chroot_call
def run_dracut():
return chroot_call(['dracut', '-f'])
def run():
returnCode = run_dracut()
if returnCode != 0:

@ -1,4 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014, Teo Mrnjavac <teo@kde.org>
@ -30,16 +32,13 @@ def run():
accumulator += "This job's path: " + libcalamares.job.working_path + "\n"
accumulator += str(libcalamares.job.configuration)
accumulator += " *** globalstorage test ***\n"
accumulator += "lala: " + \
str(libcalamares.globalstorage.contains("lala")) + "\n"
accumulator += "foo: " + \
str(libcalamares.globalstorage.contains("foo")) + "\n"
accumulator += "lala: " + str(libcalamares.globalstorage.contains("lala")) + "\n"
accumulator += "foo: " + str(libcalamares.globalstorage.contains("foo")) + "\n"
accumulator += "count: " + str(libcalamares.globalstorage.count()) + "\n"
libcalamares.globalstorage.insert("item2", "value2")
libcalamares.globalstorage.insert("item3", 3)
accumulator += "keys: {}\n".format(str(libcalamares.globalstorage.keys()))
accumulator += "remove: {}\n".format(
str(libcalamares.globalstorage.remove("item2")))
accumulator += "remove: {}\n".format(str(libcalamares.globalstorage.remove("item2")))
accumulator += "values: {} {} {}\n".format(
str(libcalamares.globalstorage.value("foo")),
str(libcalamares.globalstorage.value("item2")),

@ -1,5 +1,6 @@
#!/usr/bin/env python3
# encoding: utf-8
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014, Aurélien Gâteau <agateau@kde.org>
@ -60,7 +61,7 @@ def disk_name_for_partition(partition):
class FstabGenerator(object):
def __init__(self, partitions, root_mount_point, mount_options,
ssd_extra_mount_options):
ssd_extra_mount_options):
self.partitions = partitions
self.root_mount_point = root_mount_point
self.mount_options = mount_options
@ -97,7 +98,7 @@ class FstabGenerator(object):
fs="tmpfs",
options="defaults,noatime,mode=1777",
check=0,
)
)
self.print_fstab_line(dct, file=fl)
def generate_fstab_line_info(self, partition):
@ -148,6 +149,7 @@ class FstabGenerator(object):
if partition["mountPoint"]:
mkdir_p(self.root_mount_point + partition["mountPoint"])
def run():
gs = libcalamares.globalstorage
conf = libcalamares.job.configuration
@ -158,5 +160,5 @@ def run():
ssd_extra_mount_options = conf.get("ssdExtraMountOptions", {})
generator = FstabGenerator(partitions, root_mount_point,
mount_options, ssd_extra_mount_options)
mount_options, ssd_extra_mount_options)
return generator.run()

@ -1,5 +1,6 @@
#!/usr/bin/env python3
# encoding: utf-8
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014, Aurélien Gâteau <agateau@kde.org>
@ -36,15 +37,23 @@ def install_grub(boot_loader, fw_type):
distribution = branding["bootloaderEntryName"]
file_name_sanitizer = str.maketrans(" /", "_-")
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
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:
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():

@ -1,28 +1,28 @@
#!/usr/bin/env python3
# encoding: utf-8
# -*- coding: utf-8 -*-
#
# === 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>
#
# Calamares 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 3 of the License, or
# (at your option) any later version.
# Calamares 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 3 of the License, or
# (at your option) any later version.
#
# Calamares 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.
# Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
# You should have received a copy of the GNU General Public License
# along with Calamares. If not, see <http://www.gnu.org/licenses/>.
import libcalamares
import os
def modify_grub_default(partitions, root_mount_point, distributor):
default_dir = os.path.join(root_mount_point, "etc/default")
default_grub = os.path.join(default_dir, "grub")
distributor_replace = distributor.replace("'", "'\\''")
@ -38,7 +38,7 @@ def modify_grub_default(partitions, root_mount_point, distributor):
swap_uuid = partition["uuid"]
if swap_uuid != "":
kernel_cmd = "GRUB_CMDLINE_LINUX_DEFAULT=\"resume=UUID={!s} quiet {!s}\"".format(swap_uuid,use_splash)
kernel_cmd = "GRUB_CMDLINE_LINUX_DEFAULT=\"resume=UUID={!s} quiet {!s}\"".format(swap_uuid, use_splash)
else:
kernel_cmd = "GRUB_CMDLINE_LINUX_DEFAULT=\"quiet {!s}\"".format(use_splash)
@ -80,7 +80,7 @@ def modify_grub_default(partitions, root_mount_point, distributor):
escaped_value = "false"
else:
escaped_value = str(value).replace("'", "'\\''")
lines.append("{!s}=\"{!s}\"".format(key,escaped_value))
lines.append("{!s}=\"{!s}\"".format(key, escaped_value))
if not have_kernel_cmd:
lines.append(kernel_cmd)
@ -93,6 +93,7 @@ def modify_grub_default(partitions, root_mount_point, distributor):
return None
def run():
partitions = libcalamares.globalstorage.value("partitions")
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")

@ -1,5 +1,6 @@
#!/usr/bin/env python3
# encoding: utf-8
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014 - 2015, Philip Müller <philm@manjaro.org>
@ -31,7 +32,7 @@ def run():
try:
subprocess.check_call(["hwclock", "--systohc", "--utc"])
except subprocess.CalledProcessError as e:
return "Cannot set hardware clock.",\
return "Cannot set hardware clock.", \
"hwclock terminated with exit code {}.".format(e.returncode)
shutil.copy2("/etc/adjtime", "{!s}/etc/".format(root_mount_point))

@ -1,5 +1,6 @@
#!/usr/bin/env python3
# encoding: utf-8
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014, Philip Müller <philm@manjaro.org>
@ -20,10 +21,12 @@
import libcalamares
from libcalamares.utils import check_chroot_call
def run_mkinitcpio():
kernel = libcalamares.job.configuration['kernel']
check_chroot_call(['mkinitcpio', '-p', kernel])
def run():
run_mkinitcpio()
return None

@ -1,5 +1,6 @@
#!/usr/bin/env python3
# encoding: utf-8
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014, Rohan Garg <rohan@kde.org>
@ -25,16 +26,17 @@ import shutil
from collections import OrderedDict
from libcalamares.utils import check_chroot_call
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['proc1']={...}
'''
"""
cpuinfo=OrderedDict()
procinfo=OrderedDict()
cpuinfo = OrderedDict()
procinfo = OrderedDict()
nprocs = 0
with open('/proc/cpuinfo') as f:
@ -42,9 +44,9 @@ def cpuinfo():
if not line.strip():
# end of one processor
cpuinfo["proc{!s}".format(nprocs)] = procinfo
nprocs=nprocs+1
nprocs += 1
# Reset
procinfo=OrderedDict()
procinfo = OrderedDict()
else:
if len(line.split(':')) == 2:
procinfo[line.split(':')[0].strip()] = line.split(':')[1].strip()
@ -53,6 +55,7 @@ def cpuinfo():
return cpuinfo
def set_mkinitcpio_hooks_and_modules(hooks, modules, root_mount_point):
""" 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:
mkinitcpio_file.write("\n".join(mklins) + "\n")
def modify_mkinitcpio_conf(partitions, root_mount_point):
""" Modifies mkinitcpio.conf """

@ -1,5 +1,6 @@
#!/usr/bin/env python3
# encoding: utf-8
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014, Philip Müller <philm@manjaro.org>
@ -19,6 +20,7 @@
from libcalamares.utils import chroot_call
def run():
returnCode = chroot_call(["update-initramfs", "-k", "all", "-u"])
if returnCode != 0:

@ -55,6 +55,7 @@ ro-cedilla ro pc105 cedilla terminate:ctrl_alt_bksp
ie ie pc105 - terminate:ctrl_alt_bksp
et ee pc105 - terminate:ctrl_alt_bksp
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_CH-latin1 ch pc105 fr 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
il il pc105 - terminate:ctrl_alt_bksp
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
khmer kh,us pc105 - terminate:ctrl_alt_bksp

@ -1,5 +1,6 @@
#!/usr/bin/env python3
# encoding: utf-8
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014, Anke Boersma <demm@kaosx.us>

@ -1,21 +1,22 @@
#!/usr/bin/env python3
# encoding: utf-8
# -*- coding: utf-8 -*-
#
# === 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>
#
# Calamares 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 3 of the License, or
# (at your option) any later version.
# Calamares 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 3 of the License, or
# (at your option) any later version.
#
# Calamares 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.
# Calamares 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 Calamares. If not, see <http://www.gnu.org/licenses/>.
# You should have received a copy of the GNU General Public License
# along with Calamares. If not, see <http://www.gnu.org/licenses/>.
import libcalamares
import os

@ -1,5 +1,6 @@
#!/usr/bin/env python3
# encoding: utf-8
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014, Aurélien Gâteau <agateau@kde.org>
@ -41,7 +42,7 @@ def mount_partitions(root_mount_point, partitions):
mount_point,
fstype,
partition.get("options", "")
)
)
def run():

@ -1,5 +1,6 @@
#!/usr/bin/env python3
# encoding: utf-8
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014, Philip Müller <philm@manjaro.org>

@ -1,5 +1,6 @@
#!/usr/bin/env python3
# encoding: utf-8
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014, Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
@ -20,6 +21,7 @@
import libcalamares
from libcalamares.utils import check_chroot_call, chroot_call
class PackageManager:
def __init__(self, backend):
self.backend = backend
@ -29,13 +31,17 @@ class PackageManager:
for pkg in pkgs:
check_chroot_call(["pkcon", "-py", "install", pkg])
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":
check_chroot_call(["yum", "install", "-y"] + pkgs)
elif self.backend == "dnf":
check_chroot_call(["dnf", "install", "-y"] + pkgs)
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":
check_chroot_call(["apt-get", "-q", "-y", "install"] + pkgs)
elif self.backend == "pacman":
@ -60,6 +66,7 @@ class PackageManager:
elif self.backend == "pacman":
check_chroot_call(["pacman", "-Rs", "--noconfirm"] + pkgs)
def run_operations(pkgman, entry):
for key in entry.keys():
if key == "install":
@ -67,6 +74,7 @@ def run_operations(pkgman, entry):
elif key == "remove":
pkgman.remove(entry[key])
def run():
backend = libcalamares.job.configuration.get("backend")
if backend not in ("packagekit", "zypp", "yum", "dnf", "urpmi", "apt", "pacman"):

@ -1,5 +1,6 @@
#!/usr/bin/env python3
# encoding: utf-8
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014, Philip Müller <philm@manjaro.org>
@ -34,7 +35,7 @@ def run():
'{}.service'.format(svc['name'])])
if ec != 0:
if svc['mandatory']:
return "Cannot enable systemd service {}".format(svc['name']),\
return "Cannot enable systemd service {}".format(svc['name']), \
"systemctl enable call in chroot returned error code {}".format(ec)
else:
libcalamares.utils.debug(

@ -1,4 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014, Teo Mrnjavac <teo@kde.org>
@ -33,7 +35,6 @@ except ImportError:
class Job:
def __init__(self, working_path, doc, cfg_doc):
self.module_name = doc["name"]
self.pretty_name = "Testing job " + doc["name"]

@ -1,5 +1,6 @@
#!/usr/bin/env python3
# encoding: utf-8
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014, Aurélien Gâteau <agateau@kde.org>

@ -1,5 +1,6 @@
#!/usr/bin/env python3
# encoding: utf-8
# -*- coding: utf-8 -*-
#
# === This file is part of Calamares - <http://github.com/calamares> ===
#
# Copyright 2014, Teo Mrnjavac <teo@kde.org>
@ -29,8 +30,9 @@ from collections import namedtuple
from libcalamares import *
class UnpackEntry:
__slots__= ['source', 'sourcefs', 'destination', 'copied', 'total']
__slots__ = ['source', 'sourcefs', 'destination', 'copied', 'total']
def __init__(self, source, sourcefs, destination):
self.source = source
@ -39,6 +41,7 @@ class UnpackEntry:
self.copied = 0
self.total = 0
ON_POSIX = 'posix' in sys.builtin_module_names
@ -103,7 +106,6 @@ def file_copy(source, dest, progress_cb):
class UnpackOperation:
def __init__(self, entries):
self.entries = 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.95 * \
(entry.copied / float(entry.total))
partialprogress += 0.95 * (entry.copied / float(entry.total))
progress += partialprogress / len(self.entries)
job.setprogress(progress)
@ -136,13 +137,14 @@ class UnpackOperation:
fslist = ""
if entry.sourcefs == "squashfs":
if shutil.which("unsquashfs") == None:
return ("Failed to unpack image", "Failed to find unsquashfs, make sure you have "
"the squashfs-tools package installed")
if shutil.which("unsquashfs") is None:
return ("Failed to unpack image",
"Failed to find unsquashfs, make sure you have "
"the squashfs-tools package installed")
fslist = subprocess.check_output(["unsquashfs",
"-l",
entry.source])
"-l",
entry.source])
if entry.sourcefs == "ext4":
fslist = subprocess.check_output(["find",
imgmountdir,
@ -153,7 +155,7 @@ class UnpackOperation:
error_msg = self.unpack_image(entry, imgmountdir)
if error_msg:
return ("Failed to unpack image {}".format(entry.source),
error_msg)
error_msg)
return None
finally:
shutil.rmtree(source_mount_path)
@ -173,8 +175,8 @@ class UnpackOperation:
try:
return file_copy(imgmountdir,
entry.destination,
progress_cb)
entry.destination,
progress_cb)
finally:
subprocess.check_call(["umount", "-l", imgmountdir])
@ -218,7 +220,7 @@ def run():
if os.path.isfile(PATH_PROCFS) and os.access(PATH_PROCFS, os.R_OK):
procfile = open(PATH_PROCFS, 'r')
filesystems = procfile.read()
procfile.close
procfile.close()
filesystems = filesystems.replace("nodev", "")
filesystems = filesystems.replace("\t", "")
@ -229,7 +231,7 @@ def run():
if fs == sourcefs:
fs_is_supported = True
if fs_is_supported == False:
if not fs_is_supported:
return "Bad filesystem", "sourcefs=\"{}\"".format(sourcefs)
destination = os.path.abspath(root_mount_point + entry["destination"])

Loading…
Cancel
Save