Compare commits

...

42 Commits

Author SHA1 Message Date
Teo Mrnjavac
ef04515011 Bump. 2017-01-13 18:16:47 +01:00
Teo Mrnjavac
8e842efd66 Force the correct flags for EFI system partition. 2017-01-12 16:52:55 +01:00
Teo Mrnjavac
21a6459611 Make sure to disable the root password if setRootPassword is false.
CAL-442 #comment Backported to 2.4.x-stable.
2017-01-12 13:47:05 +01:00
Teo Mrnjavac
a81c8137b2 The sender QObject should be in scope so the bootloader path is written.
CAL-388
CAL-417
CAL-441
2017-01-11 11:50:40 +01:00
Teo Mrnjavac
1c946bf365 Improve debug output. 2016-12-23 14:17:39 +01:00
Teo Mrnjavac
67bd3306f8 Improve debug output. 2016-12-23 14:04:12 +01:00
Teo Mrnjavac
89f078f8c5 Alignment. 2016-12-22 13:53:17 +01:00
demmm
6e2d445888 fix crash on loading webview page with QtWebengine 2016-12-22 13:53:09 +01:00
Teo Mrnjavac
bdda452f66 ifdef all the things so we can build with both KPMcore 3 and 2.2. 2016-12-21 13:59:17 +01:00
Teo Mrnjavac
50187261c3 Expose KPMcore version status to partition module. 2016-12-21 13:58:17 +01:00
Teo Mrnjavac
1f37f3dda0 Do not dereference nullptr. 2016-12-13 12:16:56 +01:00
Teo Mrnjavac
d7302ca024 Provide default for m_writeEtcDefaultKeyboard in KeyboardViewStep. 2016-12-13 12:10:40 +01:00
Teo Mrnjavac
92e1233279 Write hasInternet to GlobalStorage.
CAL-431 #close
2016-12-12 13:38:28 +01:00
Teo Mrnjavac
4a50f5ae54 Do not LINK_PUBLIC by default. 2016-12-07 16:40:04 +01:00
Teo Mrnjavac
fe75e980f5 Add LINK_PRIVATE_LIBRARIES to calamares_add_plugin. 2016-12-07 16:39:57 +01:00
Teo Mrnjavac
7a67eed918 Document settings for services module. 2016-12-05 18:01:12 +01:00
Kevin Kofler
b4fb2115dc [displaymanager] set_autologin: Unset autologin for sddm when needed
CAL-423 #close
2016-12-03 19:20:29 +01:00
Teo Mrnjavac
61703ad070 Write Btrfs subvolume lines to fstab. 2016-11-25 18:38:44 +01:00
Teo Mrnjavac
e95b555289 Special case for Btrfs root: create subvolumes and mount them. 2016-11-25 18:38:44 +01:00
Teo Mrnjavac
e5274df598 Bump. 2016-11-25 18:21:24 +01:00
Kevin Kofler
b3ecb8a981 [dracutlukscfg] Don't include keyfile in initramfs on unencrypted /boot.
This matches the fix in initcpiocfg and initramfscfg.
2016-11-19 02:32:31 +01:00
Kevin Kofler
d18eda219c [initramfscfg] Don't include keyfile in initramfs on unencrypted /boot.
This matches the fix in initcpiocfg.

I had to create an encrypt_hook_nokey that is a copy of encrypt_hook
without the part that copies the keyfile.
2016-11-19 02:32:26 +01:00
Teo Mrnjavac
b0a690256a Show warning. 2016-11-18 15:54:15 +01:00
Teo Mrnjavac
1c0fb2e4be Oops. 2016-11-18 15:54:15 +01:00
Teo Mrnjavac
efd93a0f82 Warn user about encrypted root with unencrypted /boot. 2016-11-18 15:54:00 +01:00
Teo Mrnjavac
08699206da Don't include keyfile in initramfs on unencrypted /boot. 2016-11-18 15:54:00 +01:00
Teo Mrnjavac
6376c39fe6 Bind-mount /run/udev in the chroot by default.
NOTE: this is absolutely necessary for grub-mkconfig's os-prober
instance to work.
2016-11-08 11:18:40 +01:00
Kevin Kofler
c7dd77c0f9 [bootloader] Fix UEFI firmware workaround for 32-bit UEFI.
On 32-bit UEFI (note that the bitness of the firmware is what matters
here, not the bitness of the distribution), instead of copying
grubx64.efi to bootx64.efi, copy grubia32.efi to bootia32.efi.

Patch by TeHMoroS from SparkyLinux.

CAL-403 #close
2016-11-06 03:39:15 +01:00
Kevin Kofler
3028855a6c [welcome] Use QNetworkAccessManager in checkHasInternet.
Use QNetworkAccessManager instead of raw QtDBus queries to
NetworkManager in RequirementsChecker::checkHasInternet(). This is much
simpler (i.e., less error-prone) and should be more portable (to, e.g.,
ConnMan).
2016-11-05 22:22:40 +01:00
Kevin Kofler
c0ebc91b15 [welcome] Fix RequirementsChecker::checkHasInternet().
The NetworkManager property is called "State", not "state". The call
was always failing, and the method was always returning true as a
result.
2016-11-05 20:34:46 +01:00
Kevin Kofler
5f5b38d148 [bootloader] Fix vfat_correct_case.
If the directory already existed, vfat_correct_case was returning only
the last part rather than the full path as it is supposed to.
2016-11-05 17:44:11 +01:00
Teo Mrnjavac
9581b803cc Bump. 2016-11-04 20:29:51 +01:00
Kevin Kofler
2f6274fa28 [unpackfs] Do not fail if rsync returns exit code 23.
Unfortunately, rsync returns exit code 23 (Partial transfer due to
error) if it cannot write extended attributes (with -X) because the
target file system does not support it, e.g., the FAT EFI system
partition. We need -X because distributions using file system
capabilities and/or SELinux require the extended attributes. But
distributions using SELinux may also have SELinux labels set on files
under /boot/efi, and rsync complains about those. The only clean way
would be to split the rsync into one with -X and --exclude /boot/efi and
a separate one without -X for /boot/efi, but only if /boot/efi is
actually an EFI system partition. For now, this hack will have to do.

See also:
https://bugzilla.redhat.com/show_bug.cgi?id=868755#c50
for the same issue in Anaconda, which uses a similar workaround.
2016-11-04 01:37:49 +01:00
Teo Mrnjavac
969ec3cd10 Allow try_install and try_remove entries in packages module. 2016-11-02 17:00:35 +01:00
Rohan Garg
7295085596 Make sure we also set a preferred Xsession 2016-11-02 13:34:45 +01:00
Teo Mrnjavac
9171fb7a77 Add option of updating packages db before perfoming package operations. 2016-11-02 13:04:32 +01:00
Kevin Kofler
9867d85924 [netinstall] Support selecting visible groups by default.
In other words, support:
  hidden: false
  selected: true
groups.

This was supposed to work according to README.md, but not actually
implemented. Now it should be working.
2016-11-02 05:59:01 +01:00
Rohan Garg
821730c1d4 Better handling for when the Autologin section already has things 2016-10-31 17:56:59 +01:00
Rohan Garg
9f8b6936e6 Use configparser to parse sddm.conf
Since sddm.conf follows the INI format we can use configparser
with a few added options to properly parse the config and write
it out instead of manually parsing each line which is slow and
prone to error.

For eg. The old code would fail to parse a conf which had no
commented out User key but where the user had configured autologin
in Calamares.
2016-10-31 17:17:59 +01:00
Kevin Kofler
06c353f170 README.md: sgdisk is no longer used. 2016-10-29 01:26:37 +02:00
Kevin Kofler
636d59ebf9 [partition] Use FlagEsp instead of sgdisk to scan for ESPs.
Address an old FIXME in
PartitionCoreModule::scanForEfiSystemPartitions(): Check the FlagEsp on
the Partition object (that KPMcore has been supporting since 2.1.0)
instead of running sgdisk.
2016-10-29 01:09:41 +02:00
Kevin Kofler
d8b6f94720 Set the ESP flag in partition rather than bootloader.
The manual partitioning setup was already requiring the user to check
the ESP flag for the EFI System Partition. Now the autopartitioning also
sets it directly (a one-line change). The sgdisk call in the bootloader
module is thus no longer necessary (it was only a workaround because
kpmcore < 2.1.0 did not support FlagEsp), so remove that snippet.

This fixes configurations such as NVME disks where splitting boot_device
into boot_device[-1:] and boot_device[:-1] is not the correct split
(because the partition gets a 2-letter suffix) (reported by demmm on
IRC).
2016-10-29 00:53:21 +02:00
52 changed files with 447 additions and 149 deletions

View File

@@ -102,7 +102,7 @@ set( CALAMARES_TRANSLATION_LANGUAGES ar ast bg ca cs_CZ da de el en en_GB es_MX
### Bump version here
set( CALAMARES_VERSION_MAJOR 2 )
set( CALAMARES_VERSION_MINOR 4 )
set( CALAMARES_VERSION_PATCH 3 )
set( CALAMARES_VERSION_PATCH 6 )
set( CALAMARES_VERSION_RC 0 )
set( CALAMARES_VERSION ${CALAMARES_VERSION_MAJOR}.${CALAMARES_VERSION_MINOR}.${CALAMARES_VERSION_PATCH} )

View File

@@ -6,7 +6,7 @@ function( calamares_add_plugin )
set( NAME ${ARGV0} )
set( options NO_INSTALL SHARED_LIB )
set( oneValueArgs NAME TYPE EXPORT_MACRO RESOURCES )
set( multiValueArgs SOURCES UI LINK_LIBRARIES COMPILE_DEFINITIONS )
set( multiValueArgs SOURCES UI LINK_LIBRARIES LINK_PRIVATE_LIBRARIES COMPILE_DEFINITIONS )
cmake_parse_arguments( PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
set( PLUGIN_NAME ${NAME} )
set( PLUGIN_DESTINATION ${CMAKE_INSTALL_LIBDIR}/calamares/modules/${PLUGIN_NAME} )
@@ -22,6 +22,7 @@ function( calamares_add_plugin )
if( NOT CMAKE_BUILD_TYPE STREQUAL "Release" )
message( " ${Green}TYPE:${ColorReset} ${PLUGIN_TYPE}" )
message( " ${Green}LINK_LIBRARIES:${ColorReset} ${PLUGIN_LINK_LIBRARIES}" )
message( " ${Green}LINK_PRIVATE_LIBRARIES:${ColorReset} ${PLUGIN_LINK_PRIVATE_LIBRARIES}" )
# message( " ${Green}SOURCES:${ColorReset} ${PLUGIN_SOURCES}" )
# message( " ${Green}UI:${ColorReset} ${PLUGIN_UI}" )
# message( " ${Green}EXPORT_MACRO:${ColorReset} ${PLUGIN_EXPORT_MACRO}" )
@@ -60,6 +61,10 @@ function( calamares_add_plugin )
list( APPEND calamares_add_library_args "LINK_LIBRARIES" "${PLUGIN_LINK_LIBRARIES}" )
endif()
if( PLUGIN_LINK_PRIVATE_LIBRARIES )
list( APPEND calamares_add_library_args "LINK_PRIVATE_LIBRARIES" "${PLUGIN_LINK_PRIVATE_LIBRARIES}" )
endif()
if( PLUGIN_COMPILE_DEFINITIONS )
list( APPEND calamares_add_library_args "COMPILE_DEFINITIONS" ${PLUGIN_COMPILE_DEFINITIONS} )
endif()

View File

@@ -28,10 +28,8 @@ Modules:
* extra-cmake-modules
* KF5: KCoreAddons, KConfig, KI18n, KIconThemes, KIO, KService
* KPMcore >= 2.2
* sgdisk
* bootloader:
* systemd-boot or GRUB
* sgdisk
* unpackfs:
* squashfs-tools
* rsync

View File

@@ -59,12 +59,12 @@ endif()
qt5_use_modules( calamares_bin Core Widgets )
target_link_libraries( calamares_bin
${CALAMARES_LIBRARIES}
calamaresui
Qt5::Core
Qt5::Widgets
yaml-cpp
${LINK_LIBRARIES}
PRIVATE
${CALAMARES_LIBRARIES}
calamaresui
Qt5::Core
Qt5::Widgets
${LINK_LIBRARIES}
)
install( TARGETS calamares_bin

View File

@@ -43,10 +43,11 @@ calamares_add_library( ${CALAMARESUI_LIBRARY_TARGET}
SOURCES ${${CALAMARESUI_LIBRARY_TARGET}_SOURCES}
UI ${${CALAMARESUI_LIBRARY_TARGET}_UI}
EXPORT_MACRO UIDLLEXPORT_PRO
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
yaml-cpp
Qt5::Svg
Qt5::QuickWidgets
Qt5::QuickWidgets
${OPTIONAL_PRIVATE_LIBRARIES}
RESOURCES libcalamaresui.qrc
EXPORT CalamaresLibraryDepends
VERSION ${CALAMARES_VERSION_SHORT}

View File

@@ -231,9 +231,13 @@ def install_grub(efi_directory, fw_type):
check_target_env_call(["mkdir", "-p", efi_boot_directory])
# Workaround for some UEFI firmwares
efi_file_source = {"32": os.path.join(efi_directory_firmware, efi_bootloader_id, "grubia32.efi"),
"64": os.path.join(efi_directory_firmware, efi_bootloader_id, "grubx64.efi")}
efi_file_target = {"32": os.path.join(efi_boot_directory, "bootia32.efi"),
"64": os.path.join(efi_boot_directory, "bootx64.efi")}
check_target_env_call(["cp",
os.path.join(efi_directory_firmware, efi_bootloader_id, "grubx64.efi"),
os.path.join(efi_boot_directory, "bootx64.efi")])
efi_file_source[efi_bitness],
efi_file_target[efi_bitness]])
else:
print("Bootloader: grub (bios)")
boot_loader = libcalamares.globalstorage.value("bootLoader")
@@ -253,12 +257,12 @@ def install_grub(efi_directory, fw_type):
def vfat_correct_case(parent, name):
for candidate in os.listdir(parent):
if name.lower() == candidate.lower():
return candidate
return os.path.join(parent, candidate)
return os.path.join(parent, name)
def prepare_bootloader(fw_type):
""" Prepares bootloader and set proper flags to EFI boot partition (esp,boot).
""" Prepares bootloader.
Based on value 'efi_boot_loader', it either calls systemd-boot or grub to be installed.
:param fw_type:
@@ -267,33 +271,6 @@ def prepare_bootloader(fw_type):
efi_boot_loader = libcalamares.job.configuration["efiBootLoader"]
efi_directory = libcalamares.globalstorage.value("efiSystemPartition")
if fw_type == "efi":
partitions = libcalamares.globalstorage.value("partitions")
boot_p = ""
device = ""
for partition in partitions:
if partition["mountPoint"] == efi_directory:
boot_device = partition["device"]
boot_p = boot_device[-1:]
device = boot_device[:-1]
if not boot_p or not device:
return ("EFI directory \"{!s}\" not found!".format(efi_directory),
"Boot partition: \"{!s}\"".format(boot_p),
"Boot device: \"{!s}\"".format(device))
else:
print("EFI directory: \"{!s}\"".format(efi_directory))
print("Boot partition: \"{!s}\"".format(boot_p))
print("Boot device: \"{!s}\"".format(device))
if not device:
print("WARNING: no EFI system partition or EFI system partition mount point not set.")
print(" >>> no EFI bootloader will be installed <<<")
return None
print("Set 'EF00' flag")
subprocess.call(["sgdisk", "--typecode={!s}:EF00".format(boot_p), "{!s}".format(device)])
if efi_boot_loader == "systemd-boot" and fw_type == "efi":
install_systemd_boot(efi_directory)
else:

View File

@@ -24,6 +24,7 @@ import os
import collections
import re
import libcalamares
import configparser
DesktopEnvironment = collections.namedtuple('DesktopEnvironment', ['executable', 'desktop_file'])
@@ -253,34 +254,29 @@ def set_autologin(username, displaymanagers, default_desktop_environment, root_m
# Systems with Sddm as Desktop Manager
sddm_conf_path = os.path.join(root_mount_point, "etc/sddm.conf")
sddm_config = configparser.ConfigParser()
# Make everything case sensitive
sddm_config.optionxform = str
if os.path.isfile(sddm_conf_path):
libcalamares.utils.debug('SDDM config file exists')
sddm_config.read(sddm_conf_path)
autologin_section = {}
if 'Autologin' in sddm_config:
autologin_section = sddm_config['Autologin']
if do_autologin:
autologin_section['User'] = username
else:
libcalamares.utils.check_target_env_call(["sh", "-c", "sddm --example-config > /etc/sddm.conf"])
del autologin_section['User']
text = []
if default_desktop_environment is not None:
autologin_section['Session'] = default_desktop_environment.desktop_file
with open(sddm_conf_path, 'r') as sddm_conf:
text = sddm_conf.readlines()
sddm_config['Autologin'] = autologin_section
with open(sddm_conf_path, 'w') as sddm_conf:
for line in text:
# User= line, possibly commented out
if re.match('\\s*(?:#\\s*)?User=', line):
if do_autologin:
line = 'User={!s}\n'.format(username)
else:
line = '#User=\n'
# Session= line, commented out or with empty value
if re.match('\\s*#\\s*Session=|\\s*Session=$', line):
if default_desktop_environment is not None:
if do_autologin:
line = 'Session={!s}.desktop\n'.format(default_desktop_environment.desktop_file)
else:
line = '#Session={!s}.desktop\n'.format(default_desktop_environment.desktop_file)
sddm_conf.write(line)
with open(sddm_conf_path, 'w') as sddm_config_file:
sddm_config.write(sddm_config_file, space_around_delimiters=False)
return None

View File

@@ -3,7 +3,7 @@ calamares_add_plugin( dracutlukscfg
EXPORT_MACRO PLUGINDLLEXPORT_PRO
SOURCES
DracutLuksCfgJob.cpp
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamares
SHARED_LIB
)

View File

@@ -33,14 +33,22 @@
const QString DracutLuksCfgJob::CONFIG_FILE = QStringLiteral( "/etc/dracut.conf.d/calamares-luks.conf" );
// static
const char *DracutLuksCfgJob::CONFIG_FILE_CONTENTS =
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"
"\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 QString DracutLuksCfgJob::CONFIG_FILE_SWAPLINE = QStringLiteral( "# enable automatic resume from swap\nadd_device+=\" /dev/disk/by-uuid/%1 \"\n" );
@@ -75,6 +83,21 @@ DracutLuksCfgJob::isRootEncrypted()
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()
@@ -126,7 +149,9 @@ DracutLuksCfgJob::exec()
return Calamares::JobResult::error( tr( "Failed to open %1" ).arg( realConfigFilePath ) );
}
QTextStream outStream( &configFile );
outStream << CONFIG_FILE_CONTENTS;
outStream << CONFIG_FILE_HEADER
<< ( hasUnencryptedSeparateBoot() ? CONFIG_FILE_CRYPTTAB_LINE
: CONFIG_FILE_CRYPTTAB_KEYFILE_LINE );
const QString swapOuterUuid = DracutLuksCfgJob::swapOuterUuid();
if ( ! swapOuterUuid.isEmpty() )
{

View File

@@ -42,12 +42,15 @@ public:
private:
static const QString CONFIG_FILE;
static const char *CONFIG_FILE_CONTENTS;
static const char *CONFIG_FILE_HEADER;
static const char *CONFIG_FILE_CRYPTTAB_KEYFILE_LINE;
static const char *CONFIG_FILE_CRYPTTAB_LINE;
static const QString CONFIG_FILE_SWAPLINE;
static QString rootMountPoint();
static QVariantList partitions();
static bool isRootEncrypted();
static bool hasUnencryptedSeparateBoot();
static QString swapOuterUuid();
};

View File

@@ -3,7 +3,7 @@ calamares_add_plugin( dummycpp
EXPORT_MACRO PLUGINDLLEXPORT_PRO
SOURCES
DummyCppJob.cpp
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamares
SHARED_LIB
)

View File

@@ -7,7 +7,7 @@ calamares_add_plugin( finished
FinishedPage.cpp
UI
FinishedPage.ui
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamaresui
SHARED_LIB
)

View File

@@ -21,6 +21,7 @@
import os
import re
import subprocess
import libcalamares
@@ -180,10 +181,33 @@ class FstabGenerator(object):
print(FSTAB_HEADER, file=fstab_file)
for partition in self.partitions:
dct = self.generate_fstab_line_info(partition)
# Special treatment for a btrfs root with @ and @home subvolumes
if partition["fs"] == "btrfs" and partition["mountPoint"] == "/":
output = subprocess.check_output(['btrfs',
'subvolume',
'list',
self.root_mount_point])
output_lines = output.splitlines()
for line in output_lines:
if line.endswith(b'path @'):
root_entry = partition
root_entry["subvol"] = "@"
dct = self.generate_fstab_line_info(root_entry)
if dct:
self.print_fstab_line(dct, file=fstab_file)
elif line.endswith(b'path @home'):
home_entry = partition
home_entry["mountPoint"] = "/home"
home_entry["subvol"] = "@home"
dct = self.generate_fstab_line_info(home_entry)
if dct:
self.print_fstab_line(dct, file=fstab_file)
if dct:
self.print_fstab_line(dct, file=fstab_file)
else:
dct = self.generate_fstab_line_info(partition)
if dct:
self.print_fstab_line(dct, file=fstab_file)
if self.root_is_ssd:
# Mount /tmp on a tmpfs
@@ -224,12 +248,21 @@ class FstabGenerator(object):
if mount_point == "/":
self.root_is_ssd = is_ssd
if filesystem == "btrfs" and "subvol" in partition:
return dict(device="UUID=" + partition["uuid"],
mount_point=mount_point,
fs=filesystem,
options=",".join(["subvol={}".format(partition["subvol"]),
options]),
check=check,
)
return dict(device="UUID=" + partition["uuid"],
mount_point=mount_point or "swap",
fs=filesystem,
options=options,
check=check,
)
)
def print_fstab_line(self, dct, file=None):
""" Prints line to '/etc/fstab' file. """

View File

@@ -94,6 +94,7 @@ def modify_mkinitcpio_conf(partitions, root_mount_point):
files = []
encrypt_hook = False
openswap_hook = False
unencrypted_separate_boot = False
# It is important that the plymouth hook comes before any encrypt hook
plymouth_bin = os.path.join(root_mount_point, "usr/bin/plymouth")
@@ -112,9 +113,13 @@ def modify_mkinitcpio_conf(partitions, root_mount_point):
if partition["mountPoint"] == "/" and "luksMapperName" in partition:
encrypt_hook = True
if partition["mountPoint"] == "/boot" and "luksMapperName" not in partition:
unencrypted_separate_boot = True
if encrypt_hook:
hooks.append("encrypt")
if os.path.isfile(os.path.join(root_mount_point, "crypto_keyfile.bin")):
if not unencrypted_separate_boot and \
os.path.isfile(os.path.join(root_mount_point, "crypto_keyfile.bin")):
files.append("/crypto_keyfile.bin")
if swap_uuid is not "":

View File

@@ -0,0 +1,22 @@
#!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
. /usr/share/initramfs-tools/hook-functions
if [ -f /etc/crypttab ]
then
cp /etc/crypttab ${DESTDIR}/etc/
fi

View File

@@ -6,6 +6,7 @@
# Copyright 2014, Rohan Garg <rohan@kde.org>
# Copyright 2015, Philip Müller <philm@manjaro.org>
# Copyright 2016, David McKinney <mckinney@subgraph.com>
# Copyright 2016, 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
@@ -31,13 +32,20 @@ def copy_initramfs_hooks(partitions, root_mount_point):
:param root_mount_point:
"""
encrypt_hook = False
unencrypted_separate_boot = False
for partition in partitions:
if partition["mountPoint"] == "/" and "luksMapperName" in partition:
encrypt_hook = True
if partition["mountPoint"] == "/boot" and "luksMapperName" not in partition:
unencrypted_separate_boot = True
if encrypt_hook:
shutil.copy2("/usr/lib/calamares/modules/initramfscfg/encrypt_hook", "{!s}/usr/share/initramfs-tools/hooks/".format(root_mount_point))
if unencrypted_separate_boot:
shutil.copy2("/usr/lib/calamares/modules/initramfscfg/encrypt_hook_nokey", "{!s}/usr/share/initramfs-tools/hooks/encrypt_hook".format(root_mount_point))
else:
shutil.copy2("/usr/lib/calamares/modules/initramfscfg/encrypt_hook", "{!s}/usr/share/initramfs-tools/hooks/".format(root_mount_point))
os.chmod("{!s}/usr/share/initramfs-tools/hooks/encrypt_hook".format(root_mount_point), 0o755)
def run():

View File

@@ -19,7 +19,7 @@ calamares_add_plugin( interactiveterminal
SOURCES
InteractiveTerminalViewStep.cpp
InteractiveTerminalPage.cpp
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamaresui
KF5::Service
KF5::Parts

View File

@@ -14,7 +14,7 @@ calamares_add_plugin( keyboard
KeyboardPage.ui
RESOURCES
keyboard.qrc
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamaresui
SHARED_LIB
)

View File

@@ -29,6 +29,7 @@ KeyboardViewStep::KeyboardViewStep( QObject* parent )
: Calamares::ViewStep( parent )
, m_widget( new KeyboardPage() )
, m_nextEnabled( false )
, m_writeEtcDefaultKeyboard( true )
{
m_widget->init();
m_nextEnabled = true;

View File

@@ -15,7 +15,7 @@ set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
LicensePage.cpp
UI
LicensePage.ui
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamaresui
SHARED_LIB
)

View File

@@ -14,7 +14,9 @@ calamares_add_plugin( locale
UI
RESOURCES
locale.qrc
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamaresui
Qt5::Network
yaml-cpp
SHARED_LIB
)

View File

@@ -19,6 +19,7 @@
# along with Calamares. If not, see <http://www.gnu.org/licenses/>.
import tempfile
import subprocess
import libcalamares
@@ -55,6 +56,58 @@ def mount_partitions(root_mount_point, partitions):
partition.get("options", ""),
)
# If the root partition is btrfs, we create a subvolume "@"
# for the root mount point.
# If a separate /home partition isn't defined, we also create
# a subvolume "@home".
# Finally we remount all of the above on the correct paths.
if fstype == "btrfs" and partition["mountPoint"] == '/':
has_home_mount_point = False
for p in partitions:
if "mountPoint" not in p or not p["mountPoint"]:
continue
if p["mountPoint"] == "/home":
has_home_mount_point = True
break
subprocess.check_call(['btrfs', 'subvolume', 'create',
root_mount_point + '/@'])
if not has_home_mount_point:
subprocess.check_call(['btrfs', 'subvolume', 'create',
root_mount_point + '/@home'])
subprocess.check_call(["umount", "-v", root_mount_point])
if "luksMapperName" in partition:
libcalamares.utils.mount("/dev/mapper/{!s}".format(partition["luksMapperName"]),
mount_point,
fstype,
",".join(["subvol=@",
partition.get("options", "")]),
)
if not has_home_mount_point:
libcalamares.utils.mount("/dev/mapper/{!s}".format(partition["luksMapperName"]),
root_mount_point + "/home",
fstype,
",".join(["subvol=@home",
partition.get("options", "")]),
)
else:
libcalamares.utils.mount(partition["device"],
mount_point,
fstype,
",".join(["subvol=@",
partition.get("options", "")]),
)
if not has_home_mount_point:
libcalamares.utils.mount(partition["device"],
root_mount_point + "/home",
fstype,
",".join(["subvol=@home",
partition.get("options", "")]),
)
def run():
""" Define mountpoints.

View File

@@ -12,6 +12,9 @@ extraMounts:
- device: tmpfs
fs: tmpfs
mountPoint: /run
- device: /run/udev
mountPoint: /run/udev
options: bind
extraMountsEfi:
- device: efivarfs

View File

@@ -12,7 +12,9 @@ calamares_add_plugin( netinstall
widgets/groupselectionwidget.ui
RESOURCES
netinstall.qrc
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamaresui
Qt5::Network
yaml-cpp
SHARED_LIB
)

View File

@@ -111,7 +111,7 @@ NetInstallPage::dataIsHere( QNetworkReply* reply )
continue;
}
GroupSelectionWidget* groupWidget = new GroupSelectionWidget( group.name, group.description, group.packages, this );
GroupSelectionWidget* groupWidget = new GroupSelectionWidget( group.name, group.description, group.packages, group.selected, this );
m_groupWidgets.insert( groupKey, groupWidget );
ui->groupswidget->layout()->addWidget( groupWidget );

View File

@@ -20,7 +20,7 @@
#include <QtDebug>
GroupSelectionWidget::GroupSelectionWidget( QString name, QString description, QStringList packages, QWidget* parent ) :
GroupSelectionWidget::GroupSelectionWidget( QString name, QString description, QStringList packages, bool selected, QWidget* parent ) :
QWidget( parent ),
m_isToggled( false )
{
@@ -29,6 +29,7 @@ GroupSelectionWidget::GroupSelectionWidget( QString name, QString description, Q
connect( ui.group, &QCheckBox::toggled, this, &GroupSelectionWidget::toggleGroup );
ui.group->setText( name );
ui.group->setChecked( selected ); // also triggers the toggleGroup slot
ui.description->setText( description );
const int columns = 4;
const int rows = ( packages.size() - 1 ) / columns + 1;

View File

@@ -29,7 +29,7 @@ class GroupSelectionWidget : public QWidget
{
Q_OBJECT
public:
explicit GroupSelectionWidget( QString name, QString description, QStringList packages, QWidget* parent = nullptr );
explicit GroupSelectionWidget( QString name, QString description, QStringList packages, bool selected, QWidget* parent = nullptr );
// Current status of the group: is it selected in the view?
bool isToggled() const;

View File

@@ -18,6 +18,7 @@
# You should have received a copy of the GNU General Public License
# along with Calamares. If not, see <http://www.gnu.org/licenses/>.
import subprocess
import libcalamares
from libcalamares.utils import check_target_env_call, target_env_call
@@ -91,6 +92,22 @@ class PackageManager:
elif self.backend == "entropy":
check_target_env_call(["equo", "rm"] + pkgs)
def update_db(self):
if self.backend == "packagekit":
check_target_env_call(["pkcon", "refresh"])
elif self.backend == "zypp":
check_target_env_call(["zypper", "update"])
elif self.backend == "urpmi":
check_target_env_call(["urpmi.update", "-a"])
elif self.backend == "apt":
check_target_env_call(["apt-get", "update"])
elif self.backend == "pacman":
check_target_env_call(["pacman", "-Sy"])
elif self.backend == "portage":
check_target_env_call(["emerge", "--sync"])
elif self.backend == "entropy":
check_target_env_call(["equo", "update"])
def run_operations(pkgman, entry):
""" Call package manager with given parameters.
@@ -101,8 +118,18 @@ def run_operations(pkgman, entry):
for key in entry.keys():
if key == "install":
pkgman.install(entry[key])
elif key == "try_install":
try:
pkgman.install(entry[key])
except subprocess.CalledProcessError:
libcalamares.utils.debug("WARNING: could not install packages {}".format(", ".join(entry[key])))
elif key == "remove":
pkgman.remove(entry[key])
elif key == "try_remove":
try:
pkgman.remove(entry[key])
except subprocess.CalledProcessError:
libcalamares.utils.debug("WARNING: could not remove packages {}".format(", ".join(entry[key])))
elif key == "localInstall":
pkgman.install(entry[key], from_local=True)
@@ -121,6 +148,10 @@ def run():
pkgman = PackageManager(backend)
operations = libcalamares.job.configuration.get("operations", [])
update_db = libcalamares.job.configuration.get("update_db", False)
if update_db and libcalamares.globalstorage.value("hasInternet"):
pkgman.update_db()
for entry in operations:
run_operations(pkgman, entry)

View File

@@ -12,6 +12,9 @@
# - entropy - Sabayon package manager
#
backend: packagekit
update_db: true
#
# List of maps with package operations such as install or remove.
# Distro developers can provide a list of packages to remove
@@ -33,12 +36,12 @@ backend: packagekit
# - remove:
# - pkg3
# - pkg4
# - install:
# - try_install: # no system install failure if a package cannot be installed
# - pkg5
# - remove:
# - try_remove: # no system install failure if a package cannot be removed
# - pkg2
# - pkg1
# install:
# - install:
# - pkgs6
# - pkg7
# - localInstall:

View File

@@ -11,6 +11,13 @@ find_package( KF5 REQUIRED CoreAddons )
find_package( KF5 REQUIRED Config I18n IconThemes KIO Service )
find_package( KPMcore 2.2 REQUIRED )
if(KPMcore_VERSION VERSION_LESS 3.0.0)
set(WITH_KPMCORE3 OFF)
else()
set(WITH_KPMCORE3 ON)
endif()
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/PartitionConfig.h.in
${CMAKE_CURRENT_BINARY_DIR}/PartitionConfig.h )
add_subdirectory( tests )
@@ -66,7 +73,7 @@ calamares_add_plugin( partition
gui/EncryptWidget.ui
gui/PartitionPage.ui
gui/ReplaceWidget.ui
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
kpmcore
calamaresui
KF5::CoreAddons

View File

@@ -0,0 +1,6 @@
#ifndef CALAMARESPARTITIONCONFIG_H
#define CALAMARESPARTITIONCONFIG_H
#cmakedefine WITH_KPMCORE3
#endif // CALAMARESPARTITIONCONFIG_H

View File

@@ -151,6 +151,12 @@ createNewEncryptedPartition( PartitionNode* parent,
FileSystemFactory::create( FileSystem::Luks,
firstSector,
lastSector ) );
if ( !fs )
{
qDebug() << "ERROR: cannot create LUKS filesystem. Giving up.";
return nullptr;
}
fs->createInnerFileSystem( fsType );
fs->setPassphrase( passphrase );
Partition* p = new Partition( parent,

View File

@@ -51,8 +51,9 @@ canBeReplaced( Partition* candidate )
qint64 requiredStorageB = ( requiredStorageGB + 0.5 ) * 1024 * 1024 * 1024;
cDebug() << "Required storage B:" << requiredStorageB
<< QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 );
cDebug() << "Available storage B:" << availableStorageB
<< QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 );
cDebug() << "Storage capacity B:" << availableStorageB
<< QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 )
<< "for" << candidate->partitionPath() << " length:" << candidate->length();
if ( ok &&
availableStorageB > requiredStorageB )
@@ -102,7 +103,9 @@ canBeResized( Partition* candidate )
cDebug() << "Required storage B:" << requiredStorageB
<< QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 );
cDebug() << "Available storage B:" << availableStorageB
<< QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 );
<< QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 )
<< "for" << candidate->partitionPath() << " length:" << candidate->length()
<< " sectorsUsed:" << candidate->sectorsUsed() << " fsType:" << candidate->fileSystem().name();
if ( ok &&
availableStorageB > requiredStorageB )

View File

@@ -1,6 +1,6 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014-2016, Teo Mrnjavac <teo@kde.org>
* Copyright 2014-2017, Teo Mrnjavac <teo@kde.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
@@ -26,6 +26,7 @@
#include "JobQueue.h"
#include "utils/Logger.h"
#include "GlobalStorage.h"
#include "PartitionConfig.h"
#include <kpmcore/core/device.h>
#include <kpmcore/core/partition.h>
@@ -128,11 +129,19 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
empty_space_size = 1;
}
#ifdef WITH_KPMCORE3
qint64 firstFreeSector = empty_space_size MiB / dev->logicalSize() + 1;
#else
qint64 firstFreeSector = empty_space_size MiB / dev->logicalSectorSize() + 1;
#endif
if ( isEfi )
{
#ifdef WITH_KPMCORE3
qint64 lastSector = firstFreeSector + ( uefisys_part_size MiB / dev->logicalSize() );
#else
qint64 lastSector = firstFreeSector + ( uefisys_part_size MiB / dev->logicalSectorSize() );
#endif
core->createPartitionTable( dev, PartitionTable::gpt );
Partition* efiPartition = KPMHelpers::createNewPartition(
dev->partitionTable(),
@@ -140,14 +149,15 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
PartitionRole( PartitionRole::Primary ),
FileSystem::Fat32,
firstFreeSector,
lastSector
lastSector,
PartitionTable::FlagEsp
);
PartitionInfo::setFormat( efiPartition, true );
PartitionInfo::setMountPoint( efiPartition, Calamares::JobQueue::instance()
->globalStorage()
->value( "efiSystemPartition" )
.toString() );
core->createPartition( dev, efiPartition );
core->createPartition( dev, efiPartition, PartitionTable::FlagEsp | PartitionTable::FlagBoot );
firstFreeSector = lastSector + 1;
}
else
@@ -156,7 +166,11 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
}
bool shouldCreateSwap = false;
#ifdef WITH_KPMCORE3
qint64 availableSpaceB = ( dev->totalLogical() - firstFreeSector ) * dev->logicalSize();
#else
qint64 availableSpaceB = ( dev->totalSectors() - firstFreeSector ) * dev->logicalSectorSize();
#endif
qint64 suggestedSwapSizeB = swapSuggestion( availableSpaceB );
qint64 requiredSpaceB =
( Calamares::JobQueue::instance()->
@@ -167,11 +181,19 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
// If there is enough room for ESP + root + swap, create swap, otherwise don't.
shouldCreateSwap = availableSpaceB > requiredSpaceB;
#ifdef WITH_KPMCORE3
qint64 lastSectorForRoot = dev->totalLogical() - 1; //last sector of the device
if ( shouldCreateSwap )
{
lastSectorForRoot -= suggestedSwapSizeB / dev->logicalSize() + 1;
}
#else
qint64 lastSectorForRoot = dev->totalSectors() - 1; //last sector of the device
if ( shouldCreateSwap )
{
lastSectorForRoot -= suggestedSwapSizeB / dev->logicalSectorSize() + 1;
}
#endif
Partition* rootPartition = nullptr;
if ( luksPassphrase.isEmpty() )
@@ -212,7 +234,11 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
PartitionRole( PartitionRole::Primary ),
FileSystem::LinuxSwap,
lastSectorForRoot + 1,
#ifdef WITH_KPMCORE3
dev->totalLogical() - 1
#else
dev->totalSectors() - 1
#endif
);
}
else
@@ -223,7 +249,11 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
PartitionRole( PartitionRole::Primary ),
FileSystem::LinuxSwap,
lastSectorForRoot + 1,
#ifdef WITH_KPMCORE3
dev->totalLogical() - 1,
#else
dev->totalSectors() - 1,
#endif
luksPassphrase
);
}

View File

@@ -547,29 +547,14 @@ PartitionCoreModule::scanForEfiSystemPartitions()
devices.append( device );
}
//FIXME: Unfortunately right now we have to call sgdisk manually because
// the KPM submodule does not expose the ESP flag from libparted.
// The following findPartitions call and lambda should be scrapped and
// rewritten based on libKPM. -- Teo 5/2015
QList< Partition* > efiSystemPartitions =
KPMHelpers::findPartitions( devices,
[]( Partition* partition ) -> bool
{
QProcess process;
process.setProgram( "sgdisk" );
process.setArguments( { "-i",
QString::number( partition->number() ),
partition->devicePath() } );
process.setProcessChannelMode( QProcess::MergedChannels );
process.start();
if ( process.waitForFinished() )
if ( partition->activeFlags().testFlag( PartitionTable::FlagEsp ) )
{
if ( process.readAllStandardOutput()
.contains( "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" ) )
{
cDebug() << "Found EFI system partition at" << partition->partitionPath();
return true;
}
cDebug() << "Found EFI system partition at" << partition->partitionPath();
return true;
}
return false;
} );

View File

@@ -22,6 +22,7 @@
#include "core/PartitionInfo.h"
#include "core/KPMHelpers.h"
#include "utils/Logger.h"
#include "PartitionConfig.h"
// CalaPM
#include <kpmcore/core/device.h>
@@ -148,7 +149,11 @@ PartitionModel::data( const QModelIndex& index, int role ) const
return PartitionInfo::mountPoint( partition );
if ( col == SizeColumn )
{
#ifdef WITH_KPMCORE3
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSize();
#else
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize();
#endif
return KFormat().formatByteSize( size );
}
cDebug() << "Unknown column" << col;
@@ -175,12 +180,20 @@ PartitionModel::data( const QModelIndex& index, int role ) const
}
}
QString prettyFileSystem = KPMHelpers::prettyNameForFileSystemType( partition->fileSystem().type() );
#ifdef WITH_KPMCORE3
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSize();
#else
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize();
#endif
QString prettySize = KFormat().formatByteSize( size );
return QVariant(name + " " + prettyFileSystem + " " + prettySize);
}
case SizeRole:
#ifdef WITH_KPMCORE3
return ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSize();
#else
return ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize();
#endif
case IsFreeSpaceRole:
return KPMHelpers::isPartitionFreeSpace( partition );

View File

@@ -35,6 +35,7 @@
#include "BootInfoWidget.h"
#include "DeviceInfoWidget.h"
#include "ScanningDialog.h"
#include "PartitionConfig.h"
#include "utils/CalamaresUtilsGui.h"
#include "utils/Logger.h"
@@ -594,7 +595,11 @@ ChoicePage::doAlongsideApply()
qint64 oldLastSector = candidate->lastSector();
qint64 newLastSector = firstSector +
m_afterPartitionSplitterWidget->splitPartitionSize() /
#ifdef WITH_KPMCORE3
dev->logicalSize();
#else
dev->logicalSectorSize();
#endif
m_core->resizePartition( dev, candidate, firstSector, newLastSector );
Partition* newPartition = nullptr;
@@ -1106,7 +1111,7 @@ ChoicePage::createBootloaderComboBox( QWidget* parent )
// When the chosen bootloader device changes, we update the choice in the PCM
connect( bcb, static_cast< void (QComboBox::*)(int) >( &QComboBox::currentIndexChanged ),
[this]( int newIndex )
this, [this]( int newIndex )
{
QComboBox* bcb = qobject_cast< QComboBox* >( sender() );
if ( bcb )

View File

@@ -21,6 +21,7 @@
#include <core/PartitionModel.h>
#include <core/ColorUtils.h>
#include "PartitionConfig.h"
#include <utils/CalamaresUtilsGui.h>
#include <utils/Logger.h>
@@ -47,7 +48,11 @@ QStringList
buildUnknownDisklabelTexts( Device* dev )
{
QStringList texts = { QObject::tr( "Unpartitioned space or unknown partition table" ),
#ifdef WITH_KPMCORE3
KFormat().formatByteSize( dev->totalLogical() * dev->logicalSize() ) };
#else
KFormat().formatByteSize( dev->totalSectors() * dev->logicalSectorSize() ) };
#endif
return texts;
}

View File

@@ -21,6 +21,7 @@
#include "core/ColorUtils.h"
#include "core/KPMHelpers.h"
#include "PartitionConfig.h"
// Qt
#include <QSpinBox>
@@ -135,7 +136,11 @@ PartitionSizeController::updatePartResizerWidget()
return;
m_updating = true;
#ifdef WITH_KPMCORE3
qint64 sectorSize = qint64( m_spinBox->value() ) * 1024 * 1024 / m_device->logicalSize();
#else
qint64 sectorSize = qint64( m_spinBox->value() ) * 1024 * 1024 / m_device->logicalSectorSize();
#endif
qint64 firstSector = m_partition->firstSector();
qint64 lastSector = firstSector + sectorSize - 1;
@@ -185,7 +190,11 @@ PartitionSizeController::doUpdateSpinBox()
{
if ( !m_spinBox )
return;
#ifdef WITH_KPMCORE3
qint64 mbSize = m_partition->length() * m_device->logicalSize() / 1024 / 1024;
#else
qint64 mbSize = m_partition->length() * m_device->logicalSectorSize() / 1024 / 1024;
#endif
m_spinBox->setValue( mbSize );
if ( m_currentSpinBoxValue != -1 && //if it's not the first time we're setting it
m_currentSpinBoxValue != mbSize ) //and the operation changes the SB value

View File

@@ -437,7 +437,39 @@ PartitionViewStep::onLeave()
QMessageBox::warning( m_manualPartitionPage,
message,
description );
return;
}
}
Partition* root_p = m_core->findPartitionByMountPoint( "/" );
Partition* boot_p = m_core->findPartitionByMountPoint( "/boot" );
if ( root_p and boot_p )
{
QString message;
QString description;
// If the root partition is encrypted, and there's a separate boot
// partition which is not encrypted
if ( root_p->fileSystem().type() == FileSystem::Luks &&
boot_p->fileSystem().type() != FileSystem::Luks )
{
message = tr( "Boot partition not encrypted" );
description = tr( "A separate boot partition was set up together with "
"an encrypted root partition, but the boot partition "
"is not encrypted."
"<br/><br/>"
"There are security concerns with this kind of "
"setup, because important system files are kept "
"on an unencrypted partition.<br/>"
"You may continue if you wish, but filesystem "
"unlocking will happen later during system startup."
"<br/>To encrypt the boot partition, go back and "
"recreate it, selecting <strong>Encrypt</strong> "
"in the partition creation window." );
QMessageBox::warning( m_manualPartitionPage,
message,
description );
}
}
}

View File

@@ -26,6 +26,7 @@
#include "core/KPMHelpers.h"
#include "Branding.h"
#include "utils/Logger.h"
#include "PartitionConfig.h"
// CalaPM
#include <kpmcore/core/device.h>
@@ -98,7 +99,11 @@ mapForPartition( Partition* partition, const QString& uuid )
const FS::luks* luksFs = dynamic_cast< const FS::luks* >( &fsRef );
if ( luksFs )
{
#ifdef WITH_KPMCORE3
map[ "luksMapperName" ] = luksFs->mapperName().split( "/" ).last();
#else
map[ "luksMapperName" ] = luksFs->mapperName( partition->partitionPath() ).split( "/" ).last();
#endif
map[ "luksUuid" ] = getLuksUuid( partition->partitionPath() );
map[ "luksPassphrase" ] = luksFs->passphrase();
cDebug() << "luksMapperName:" << map[ "luksMapperName" ];

View File

@@ -44,6 +44,7 @@
#include "jobs/CheckFileSystemJob.h"
#include "jobs/MoveFileSystemJob.h"
#include "utils/Logger.h"
#include "PartitionConfig.h"
// KPMcore
#include <kpmcore/backend/corebackend.h>
@@ -93,7 +94,11 @@ public:
break;
case FileSystem::cmdSupportFileSystem:
{
#ifdef WITH_KPMCORE3
qint64 byteLength = m_device->logicalSize() * m_length;
#else
qint64 byteLength = m_device->logicalSectorSize() * m_length;
#endif
bool ok = fs.resize( report, m_partition->partitionPath(), byteLength );
if ( !ok )
return Calamares::JobResult::error(

View File

@@ -15,3 +15,6 @@ targets:
disable:
- name: "pacman-init"
mandatory: false
# Example to express an empty list:
# disable: []

View File

@@ -6,7 +6,7 @@ calamares_add_plugin( summary
SummaryViewStep.cpp
SummaryPage.cpp
UI
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamaresui
SHARED_LIB
)

View File

@@ -119,7 +119,18 @@ def file_copy(source, dest, progress_cb):
process.wait()
if process.returncode != 0:
# 23 is the return code rsync returns if it cannot write extended attributes
# (with -X) because the target file system does not support it, e.g., the
# FAT EFI system partition. We need -X because distributions using file
# system capabilities and/or SELinux require the extended attributes. But
# distributions using SELinux may also have SELinux labels set on files
# under /boot/efi, and rsync complains about those. The only clean way would
# be to split the rsync into one with -X and --exclude /boot/efi and a
# separate one without -X for /boot/efi, but only if /boot/efi is actually
# an EFI system partition. For now, this hack will have to do. See also:
# https://bugzilla.redhat.com/show_bug.cgi?id=868755#c50
# for the same issue in Anaconda, which uses a similar workaround.
if process.returncode != 0 and process.returncode != 23:
return "rsync failed with error code {}.".format(process.returncode)
return None

View File

@@ -16,7 +16,7 @@ calamares_add_plugin( users
page_usersetup.ui
RESOURCES
users.qrc
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamaresui
${CRYPT_LIBRARIES}
SHARED_LIB

View File

@@ -1,6 +1,6 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2014-2017, Teo Mrnjavac <teo@kde.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
@@ -59,6 +59,20 @@ SetPasswordJob::exec()
return Calamares::JobResult::error( tr( "Bad destination system path." ),
tr( "rootMountPoint is %1" ).arg( destDir.absolutePath() ) );
if ( m_userName == "root" &&
m_newPassword.isEmpty() ) //special case for disabling root account
{
int ec = CalamaresUtils::System::instance()->
targetEnvCall( { "passwd",
"-dl",
m_userName } );
if ( ec )
return Calamares::JobResult::error( tr( "Cannot disable root account." ),
tr( "passwd terminated with error code %1." )
.arg( ec ) );
return Calamares::JobResult::ok();
}
QString encrypted = QString::fromLatin1(
crypt( m_newPassword.toLatin1(),
QString( "$6$%1$" )

View File

@@ -1,6 +1,6 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2014-2017, Teo Mrnjavac <teo@kde.org>
*
* Portions from the Manjaro Installation Framework
* by Roland Singer <roland@manjaro.org>
@@ -138,6 +138,12 @@ UsersPage::createJobs( const QStringList& defaultGroupsList )
ui->textBoxRootPassword->text() );
list.append( Calamares::job_ptr( j ) );
}
else
{
j = new SetPasswordJob( "root",
"" ); //explicitly disable root password
list.append( Calamares::job_ptr( j ) );
}
j = new SetHostNameJob( ui->textBoxHostname->text() );
list.append( Calamares::job_ptr( j ) );

View File

@@ -44,7 +44,7 @@ calamares_add_plugin( webview
EXPORT_MACRO PLUGINDLLEXPORT_PRO
SOURCES
WebViewStep.cpp
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
${CALA_WEBVIEW_LINK_LIBRARIES}
SHARED_LIB
)

View File

@@ -25,6 +25,7 @@
#include <QWebView>
#else
#include <QWebEngineView>
#include <QtWebEngine>
#endif
CALAMARES_PLUGIN_FACTORY_DEFINITION( WebViewStepFactory, registerPlugin<WebViewStep>(); )
@@ -33,6 +34,9 @@ WebViewStep::WebViewStep( QObject* parent )
: Calamares::ViewStep( parent )
{
emit nextStatusChanged( true );
#ifdef WEBVIEW_WITH_WEBENGINE
QtWebEngine::initialize();
#endif
m_view = new C_QWEBVIEW();
#ifdef WEBVIEW_WITH_WEBKIT
m_view->settings()->setFontFamily( QWebSettings::StandardFont,

View File

@@ -1,7 +1,7 @@
include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui )
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules )
find_package( LIBPARTED REQUIRED )
find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED DBus )
find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED DBus Network )
set_source_files_properties( checker/partman_devices.c PROPERTIES LANGUAGE CXX )
@@ -14,6 +14,7 @@ set( CHECKER_SOURCES
set( CHECKER_LINK_LIBRARIES
${LIBPARTED_LIBS}
Qt5::DBus
Qt5::Network
)
calamares_add_plugin( welcome
@@ -25,7 +26,7 @@ calamares_add_plugin( welcome
WelcomePage.cpp
UI
WelcomePage.ui
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamaresui
${CHECKER_LINK_LIBRARIES}
SHARED_LIB

View File

@@ -36,6 +36,7 @@
#include <QFile>
#include <QFileInfo>
#include <QLabel>
#include <QNetworkAccessManager>
#include <QProcess>
#include <QTimer>
@@ -336,30 +337,8 @@ RequirementsChecker::checkHasPower()
bool
RequirementsChecker::checkHasInternet()
{
const QString NM_SVC_NAME( "org.freedesktop.NetworkManager" );
const QString NM_INTF_NAME( "org.freedesktop.NetworkManager" );
const QString NM_PATH( "/org/freedesktop/NetworkManager" );
const int NM_STATE_CONNECTED_GLOBAL = 70;
QDBusInterface nmIntf( NM_SVC_NAME,
NM_PATH,
NM_INTF_NAME,
QDBusConnection::systemBus(), 0 );
bool ok = false;
int nmState = nmIntf.property( "state" ).toInt( &ok );
if ( !ok || !nmIntf.isValid() )
{
// We can't talk to NM, so no idea. Wild guess: we're connected
// using ssh with X forwarding, and are therefore connected. This
// allows us to proceed with a minimum of complaint.
Calamares::JobQueue::instance()->globalStorage()->insert( "hasInternet", true );
return true;
}
bool hasInternet = nmState == NM_STATE_CONNECTED_GLOBAL;
// default to true in the QNetworkAccessManager::UnknownAccessibility case
bool hasInternet = QNetworkAccessManager(this).networkAccessible() != QNetworkAccessManager::NotAccessible;
Calamares::JobQueue::instance()->globalStorage()->insert( "hasInternet", hasInternet );
return hasInternet;
}