diff -Nuar calamares-3.1.7/src/modules/dracut/main.py calamares-3.1.71/src/modules/dracut/main.py --- calamares-3.1.7/src/modules/dracut/main.py 2017-10-23 23:22:25.000000000 +0300 +++ calamares-3.1.71/src/modules/dracut/main.py 1970-01-01 02:00:00.000000000 +0200 @@ -1,47 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# === This file is part of Calamares - === -# -# Copyright 2014-2015, Philip Müller -# Copyright 2014, Teo Mrnjavac -# Copyright 2017, Alf Gaida -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with Calamares. If not, see . - -import libcalamares -from libcalamares.utils import target_env_call - - -def run_dracut(): - """ - Creates initramfs, even when initramfs already exists. - - :return: - """ - return target_env_call(['dracut', '-f']) - - -def run(): - """ - Starts routine to create initramfs. It passes back the exit code - if it fails. - - :return: - """ - return_code = run_dracut() - - if return_code != 0: - return ("Failed to run dracut on the target", - "The exit code was {}".format(return_code)) diff -Nuar calamares-3.1.7/src/modules/dracut/module.desc calamares-3.1.71/src/modules/dracut/module.desc --- calamares-3.1.7/src/modules/dracut/module.desc 2017-10-23 23:22:25.000000000 +0300 +++ calamares-3.1.71/src/modules/dracut/module.desc 1970-01-01 02:00:00.000000000 +0200 @@ -1,5 +0,0 @@ ---- -type: "job" -name: "dracut" -interface: "python" -script: "main.py" diff -Nuar calamares-3.1.7/src/modules/dracutlukscfg/CMakeLists.txt calamares-3.1.71/src/modules/dracutlukscfg/CMakeLists.txt --- calamares-3.1.7/src/modules/dracutlukscfg/CMakeLists.txt 2017-10-23 23:22:25.000000000 +0300 +++ calamares-3.1.71/src/modules/dracutlukscfg/CMakeLists.txt 1970-01-01 02:00:00.000000000 +0200 @@ -1,9 +0,0 @@ -calamares_add_plugin( dracutlukscfg - TYPE job - EXPORT_MACRO PLUGINDLLEXPORT_PRO - SOURCES - DracutLuksCfgJob.cpp - LINK_PRIVATE_LIBRARIES - calamares - SHARED_LIB -) diff -Nuar calamares-3.1.7/src/modules/dracutlukscfg/DracutLuksCfgJob.cpp calamares-3.1.71/src/modules/dracutlukscfg/DracutLuksCfgJob.cpp --- calamares-3.1.7/src/modules/dracutlukscfg/DracutLuksCfgJob.cpp 2017-10-23 23:22:25.000000000 +0300 +++ calamares-3.1.71/src/modules/dracutlukscfg/DracutLuksCfgJob.cpp 1970-01-01 02:00:00.000000000 +0200 @@ -1,168 +0,0 @@ -/* === This file is part of Calamares - === - * - * Copyright 2016, Kevin Kofler - * - * 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. - * - * You should have received a copy of the GNU General Public License - * along with Calamares. If not, see . - */ - -#include "DracutLuksCfgJob.h" - -#include -#include -#include -#include - -#include "CalamaresVersion.h" -#include "JobQueue.h" -#include "GlobalStorage.h" - -#include "utils/Logger.h" - -// static -const QLatin1Literal DracutLuksCfgJob::CONFIG_FILE( "/etc/dracut.conf.d/calamares-luks.conf" ); - -// static -const char *DracutLuksCfgJob::CONFIG_FILE_HEADER = - "# Configuration file automatically written by the Calamares system installer\n" - "# (This file is written once at install time and should be safe to edit.)\n" - "# Enables support for LUKS full disk encryption with single sign on from GRUB.\n" - "\n"; - -// static -const char *DracutLuksCfgJob::CONFIG_FILE_CRYPTTAB_KEYFILE_LINE = - "# force installing /etc/crypttab even if hostonly=\"no\", install the keyfile\n" - "install_items+=\" /etc/crypttab /crypto_keyfile.bin \"\n"; - -// static -const char *DracutLuksCfgJob::CONFIG_FILE_CRYPTTAB_LINE = - "# force installing /etc/crypttab even if hostonly=\"no\"\n" - "install_items+=\" /etc/crypttab \"\n"; - -// static -const QLatin1Literal DracutLuksCfgJob::CONFIG_FILE_SWAPLINE( "# enable automatic resume from swap\nadd_device+=\" /dev/disk/by-uuid/%1 \"\n" ); - -// static -QString -DracutLuksCfgJob::rootMountPoint() -{ - Calamares::GlobalStorage *globalStorage = Calamares::JobQueue::instance()->globalStorage(); - return globalStorage->value( QStringLiteral( "rootMountPoint" ) ).toString(); -} - -// static -QVariantList -DracutLuksCfgJob::partitions() -{ - Calamares::GlobalStorage *globalStorage = Calamares::JobQueue::instance()->globalStorage(); - return globalStorage->value( QStringLiteral( "partitions" ) ).toList(); -} - -// static -bool -DracutLuksCfgJob::isRootEncrypted() -{ - const QVariantList partitions = DracutLuksCfgJob::partitions(); - for ( const QVariant &partition : partitions ) - { - QVariantMap partitionMap = partition.toMap(); - QString mountPoint = partitionMap.value( QStringLiteral( "mountPoint" ) ).toString(); - if ( mountPoint == QStringLiteral( "/" ) ) - return partitionMap.contains( QStringLiteral( "luksMapperName" ) ); - } - return false; -} - -// static -bool -DracutLuksCfgJob::hasUnencryptedSeparateBoot() -{ - const QVariantList partitions = DracutLuksCfgJob::partitions(); - for ( const QVariant &partition : partitions ) - { - QVariantMap partitionMap = partition.toMap(); - QString mountPoint = partitionMap.value( QStringLiteral( "mountPoint" ) ).toString(); - if ( mountPoint == QStringLiteral( "/boot" ) ) - return !partitionMap.contains( QStringLiteral( "luksMapperName" ) ); - } - return false; -} - -// static -QString -DracutLuksCfgJob::swapOuterUuid() -{ - const QVariantList partitions = DracutLuksCfgJob::partitions(); - for ( const QVariant &partition : partitions ) - { - QVariantMap partitionMap = partition.toMap(); - QString fsType = partitionMap.value( QStringLiteral( "fs" ) ).toString(); - if ( fsType == QStringLiteral( "linuxswap" ) && partitionMap.contains( QStringLiteral( "luksMapperName" ) ) ) - return partitionMap.value( QStringLiteral( "luksUuid" ) ).toString(); - } - return QString(); -} - -DracutLuksCfgJob::DracutLuksCfgJob( QObject* parent ) - : Calamares::CppJob( parent ) -{ -} - - -DracutLuksCfgJob::~DracutLuksCfgJob() -{ -} - - -QString -DracutLuksCfgJob::prettyName() const -{ - if ( isRootEncrypted() ) - return tr( "Write LUKS configuration for Dracut to %1" ).arg( CONFIG_FILE ); - else - return tr( "Skip writing LUKS configuration for Dracut: \"/\" partition is not encrypted" ); -} - - -Calamares::JobResult -DracutLuksCfgJob::exec() -{ - if ( isRootEncrypted() ) - { - const QString realConfigFilePath = rootMountPoint() + CONFIG_FILE; - cDebug() << "[DRACUTLUKSCFG]: Writing" << realConfigFilePath; - QDir( QStringLiteral( "/" ) ).mkpath( QFileInfo( realConfigFilePath ).absolutePath() ); - QFile configFile( realConfigFilePath ); - if ( ! configFile.open( QIODevice::WriteOnly | QIODevice::Text ) ) - { - cDebug() << "[DRACUTLUKSCFG]: Failed to open" << realConfigFilePath; - return Calamares::JobResult::error( tr( "Failed to open %1" ).arg( realConfigFilePath ) ); - } - QTextStream outStream( &configFile ); - outStream << CONFIG_FILE_HEADER - << ( hasUnencryptedSeparateBoot() ? CONFIG_FILE_CRYPTTAB_LINE - : CONFIG_FILE_CRYPTTAB_KEYFILE_LINE ); - const QString swapOuterUuid = DracutLuksCfgJob::swapOuterUuid(); - if ( ! swapOuterUuid.isEmpty() ) - { - cDebug() << "[DRACUTLUKSCFG]: Swap outer UUID" << swapOuterUuid; - outStream << QString(CONFIG_FILE_SWAPLINE).arg( swapOuterUuid ).toLatin1(); - } - cDebug() << "[DRACUTLUKSCFG]: Wrote config to" << realConfigFilePath; - } else - cDebug() << "[DRACUTLUKSCFG]: / not encrypted, skipping"; - - return Calamares::JobResult::ok(); -} - -CALAMARES_PLUGIN_FACTORY_DEFINITION( DracutLuksCfgJobFactory, registerPlugin(); ) diff -Nuar calamares-3.1.7/src/modules/dracutlukscfg/DracutLuksCfgJob.h calamares-3.1.71/src/modules/dracutlukscfg/DracutLuksCfgJob.h --- calamares-3.1.7/src/modules/dracutlukscfg/DracutLuksCfgJob.h 2017-10-23 23:22:25.000000000 +0300 +++ calamares-3.1.71/src/modules/dracutlukscfg/DracutLuksCfgJob.h 1970-01-01 02:00:00.000000000 +0200 @@ -1,60 +0,0 @@ -/* === This file is part of Calamares - === - * - * Copyright 2016, Kevin Kofler - * Copyright 2017, Adriaan de Groot - * - * 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. - * - * You should have received a copy of the GNU General Public License - * along with Calamares. If not, see . - */ - -#ifndef DRACUTLUKSCFGJOB_H -#define DRACUTLUKSCFGJOB_H - -#include -#include - -#include - -#include - -#include - -class PLUGINDLLEXPORT DracutLuksCfgJob : public Calamares::CppJob -{ - Q_OBJECT - -public: - explicit DracutLuksCfgJob( QObject* parent = nullptr ); - virtual ~DracutLuksCfgJob() override; - - QString prettyName() const override; - - Calamares::JobResult exec() override; - -private: - static const QLatin1Literal CONFIG_FILE; - static const char *CONFIG_FILE_HEADER; - static const char *CONFIG_FILE_CRYPTTAB_KEYFILE_LINE; - static const char *CONFIG_FILE_CRYPTTAB_LINE; - static const QLatin1Literal CONFIG_FILE_SWAPLINE; - - static QString rootMountPoint(); - static QVariantList partitions(); - static bool isRootEncrypted(); - static bool hasUnencryptedSeparateBoot(); - static QString swapOuterUuid(); -}; - -CALAMARES_PLUGIN_FACTORY_DECLARATION( DracutLuksCfgJobFactory ) - -#endif // DRACUTLUKSCFGJOB_H diff -Nuar calamares-3.1.7/src/modules/locale/LocalePage.cpp calamares-3.1.71/src/modules/locale/LocalePage.cpp --- calamares-3.1.7/src/modules/locale/LocalePage.cpp 2017-10-23 23:22:25.000000000 +0300 +++ calamares-3.1.71/src/modules/locale/LocalePage.cpp 2017-11-14 02:27:55.108042084 +0300 @@ -320,7 +320,7 @@ << ". Assuming the supported languages are already built into " "the locale archive."; QProcess localeA; - localeA.start( "locale", QStringList() << "-a" ); + localeA.start( "cat", QStringList() << "/etc/languages" ); localeA.waitForFinished(); ba = localeA.readAllStandardOutput(); } diff -Nuar calamares-3.1.7/src/modules/localecfg/main.py calamares-3.1.71/src/modules/localecfg/main.py --- calamares-3.1.7/src/modules/localecfg/main.py 2017-10-23 23:22:25.000000000 +0300 +++ calamares-3.1.71/src/modules/localecfg/main.py 2017-11-14 03:07:20.726123018 +0300 @@ -83,13 +83,14 @@ locale_conf_path = os.path.join(install_path, "etc/locale.conf") with open(locale_conf_path, "w") as lcf: for k, v in locale_conf.items(): - lcf.write("{!s}={!s}\n".format(k, v)) + lcf.write("{!s}\n".format( v)) # write /etc/default/locale if /etc/default exists and is a dir etc_default_path = os.path.join(install_path, "etc/default") if os.path.isdir(etc_default_path): with open(os.path.join(etc_default_path, "locale"), "w") as edl: for k, v in locale_conf.items(): - edl.write("{!s}={!s}\n".format(k, v)) + edl.write("{!s}\n".format( v)) + return None diff -Nuar calamares-3.1.7/src/modules/mudur/main.py calamares-3.1.71/src/modules/mudur/main.py --- calamares-3.1.7/src/modules/mudur/main.py 1970-01-01 02:00:00.000000000 +0200 +++ calamares-3.1.71/src/modules/mudur/main.py 2017-11-14 02:10:42.000000000 +0300 @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# === This file is part of Calamares - === +# +# Copyright 2014, Anke Boersma +# Copyright 2015, Philip Müller +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with Calamares. If not, see . + +import os +import shutil + +import libcalamares + + + +def run(): + + install_path = libcalamares.globalstorage.value("rootMountPoint") + + + path = os.path.join(install_path, "etc/locale.conf") + + mloc = open(path,"r") + + languages = mloc.readline(2) + + + mudur_file_path = os.path.join(install_path, "etc/conf.d/mudur") + lines = [] + for l in open(mudur_file_path, "r").readlines(): + if l.strip().startswith('language=') or l.strip().startswith('# language='): + if languages == "pt": + l = 'language="pt_BR"\n' + else: + l = 'language="%s"\n' % languages + lines.append(l) + + open(mudur_file_path, "w").writelines(lines) + + if os.path.exists(os.path.join(install_path, "etc/sudoers")): + os.unlink(os.path.join(install_path, "etc/sudoers")) + + + source = os.path.join(install_path, "etc/sudoers.orig") + target = os.path.join(install_path, "etc/sudoers") + + shutil.copy(source, target) + + libcalamares.utils.target_env_call(['chmod', '440', '/etc/sudoers']) + + return None diff -Nuar calamares-3.1.7/src/modules/mudur/module.desc calamares-3.1.71/src/modules/mudur/module.desc --- calamares-3.1.7/src/modules/mudur/module.desc 1970-01-01 02:00:00.000000000 +0200 +++ calamares-3.1.71/src/modules/mudur/module.desc 2017-11-14 02:10:42.000000000 +0300 @@ -0,0 +1,5 @@ +--- +type: "job" +name: "mudur" +interface: "python" +script: "main.py" diff -Nuar calamares-3.1.7/src/modules/services/main.py calamares-3.1.71/src/modules/services/main.py --- calamares-3.1.7/src/modules/services/main.py 2017-10-23 23:22:25.000000000 +0300 +++ calamares-3.1.71/src/modules/services/main.py 1970-01-01 02:00:00.000000000 +0200 @@ -1,101 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# === This file is part of Calamares - === -# -# Copyright 2014, Philip Müller -# Copyright 2014, Teo Mrnjavac -# Copyright 2017, Alf Gaida -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with Calamares. If not, see . - -import libcalamares - - -def run(): - """ - Setup systemd services - """ - services = libcalamares.job.configuration['services'] - targets = libcalamares.job.configuration['targets'] - disable = libcalamares.job.configuration['disable'] - - # note that the "systemctl enable" and "systemctl disable" commands used - # here will work in a chroot; in fact, they are the only systemctl commands - # that support that, see: - # http://0pointer.de/blog/projects/changing-roots.html - - # enable services - for svc in services: - ec = libcalamares.utils.target_env_call( - ['systemctl', 'enable', '{}.service'.format(svc['name'])] - ) - - if ec != 0: - if svc['mandatory']: - return ("Cannot enable systemd service {}".format(svc['name']), - "systemctl enable call in chroot returned error code " - "{}".format(ec) - ) - else: - libcalamares.utils.debug( - "Cannot enable systemd service {}".format(svc['name']) - ) - libcalamares.utils.debug( - "systemctl enable call in chroot returned error code " - "{}".format(ec) - ) - - # enable targets - for tgt in targets: - ec = libcalamares.utils.target_env_call( - ['systemctl', 'enable', '{}.target'.format(tgt['name'])] - ) - - if ec != 0: - if tgt['mandatory']: - return ("Cannot enable systemd target {}".format(tgt['name']), - "systemctl enable call in chroot returned error code" - "{}".format(ec) - ) - else: - libcalamares.utils.debug( - "Cannot enable systemd target {}".format(tgt['name']) - ) - libcalamares.utils.debug( - "systemctl enable call in chroot returned error code " - "{}".format(ec) - ) - - for dbl in disable: - ec = libcalamares.utils.target_env_call( - ['systemctl', 'disable', '{}.service'.format(dbl['name'])] - ) - - if ec != 0: - if dbl['mandatory']: - return ("Cannot disable systemd service" - "{}".format(dbl['name']), - "systemctl disable call in chroot returned error code" - "{}".format(ec)) - else: - libcalamares.utils.debug( - "Cannot disable systemd service {}".format(dbl['name']) - ) - libcalamares.utils.debug( - "systemctl disable call in chroot returned error code " - "{}".format(ec) - ) - - return None diff -Nuar calamares-3.1.7/src/modules/services/module.desc calamares-3.1.71/src/modules/services/module.desc --- calamares-3.1.7/src/modules/services/module.desc 2017-10-23 23:22:25.000000000 +0300 +++ calamares-3.1.71/src/modules/services/module.desc 1970-01-01 02:00:00.000000000 +0200 @@ -1,6 +0,0 @@ ---- -type: "job" -name: "services" -interface: "python" -requires: [] -script: "main.py" diff -Nuar calamares-3.1.7/src/modules/services/services.conf calamares-3.1.71/src/modules/services/services.conf --- calamares-3.1.7/src/modules/services/services.conf 2017-10-23 23:22:25.000000000 +0300 +++ calamares-3.1.71/src/modules/services/services.conf 1970-01-01 02:00:00.000000000 +0200 @@ -1,20 +0,0 @@ ---- -#systemd services and targets are enabled in this precise order - -services: - - name: "NetworkManager" #name of the service file - mandatory: false #true=> if enabling fails the installer errors out and quits - #false=>if enabling fails print warning to console and continue - - name: "cups" - mandatory: false - -targets: - - name: "graphical" - mandatory: true - -disable: - - name: "pacman-init" - mandatory: false - -# Example to express an empty list: -# disable: []