Compare commits

..

32 Commits

Author SHA1 Message Date
Teo Mrnjavac
755a56914d Don't assume 'User' exists in autologin section. 2017-01-19 17:04:50 +01:00
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
44 changed files with 372 additions and 75 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 4 )
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

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

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
${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,7 +257,7 @@ 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)

View File

@@ -267,14 +267,12 @@ def set_autologin(username, displaymanagers, default_desktop_environment, root_m
if do_autologin:
autologin_section['User'] = username
elif 'User' in autologin_section:
del autologin_section['User']
if default_desktop_environment is not None:
autologin_section['Session'] = default_desktop_environment.desktop_file
if autologin_section:
if 'Autologin' in sddm_config:
sddm_config['Autologin'].update(autologin_section)
else:
sddm_config['Autologin'] = autologin_section
with open(sddm_conf_path, 'w') as sddm_config_file:

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,6 +181,29 @@ class FstabGenerator(object):
print(FSTAB_HEADER, file=fstab_file)
for partition in self.partitions:
# 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)
else:
dct = self.generate_fstab_line_info(partition)
if dct:
@@ -224,6 +248,15 @@ 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,

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,12 +32,19 @@ 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:
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)

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

@@ -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(),
@@ -148,7 +157,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
->globalStorage()
->value( "efiSystemPartition" )
.toString() );
core->createPartition( dev, efiPartition );
core->createPartition( dev, efiPartition, PartitionTable::FlagEsp | PartitionTable::FlagBoot );
firstFreeSector = lastSector + 1;
}
else
@@ -157,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()->
@@ -168,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() )
@@ -213,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
@@ -224,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

@@ -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

@@ -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;
}