Compare commits
32 Commits
v2.4.4
...
2.4.x-stab
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
755a56914d | ||
|
|
ef04515011 | ||
|
|
8e842efd66 | ||
|
|
21a6459611 | ||
|
|
a81c8137b2 | ||
|
|
1c946bf365 | ||
|
|
67bd3306f8 | ||
|
|
89f078f8c5 | ||
|
|
6e2d445888 | ||
|
|
bdda452f66 | ||
|
|
50187261c3 | ||
|
|
1f37f3dda0 | ||
|
|
d7302ca024 | ||
|
|
92e1233279 | ||
|
|
4a50f5ae54 | ||
|
|
fe75e980f5 | ||
|
|
7a67eed918 | ||
|
|
b4fb2115dc | ||
|
|
61703ad070 | ||
|
|
e95b555289 | ||
|
|
e5274df598 | ||
|
|
b3ecb8a981 | ||
|
|
d18eda219c | ||
|
|
b0a690256a | ||
|
|
1c0fb2e4be | ||
|
|
efd93a0f82 | ||
|
|
08699206da | ||
|
|
6376c39fe6 | ||
|
|
c7dd77c0f9 | ||
|
|
3028855a6c | ||
|
|
c0ebc91b15 | ||
|
|
5f5b38d148 |
@@ -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
|
### Bump version here
|
||||||
set( CALAMARES_VERSION_MAJOR 2 )
|
set( CALAMARES_VERSION_MAJOR 2 )
|
||||||
set( CALAMARES_VERSION_MINOR 4 )
|
set( CALAMARES_VERSION_MINOR 4 )
|
||||||
set( CALAMARES_VERSION_PATCH 4 )
|
set( CALAMARES_VERSION_PATCH 6 )
|
||||||
set( CALAMARES_VERSION_RC 0 )
|
set( CALAMARES_VERSION_RC 0 )
|
||||||
|
|
||||||
set( CALAMARES_VERSION ${CALAMARES_VERSION_MAJOR}.${CALAMARES_VERSION_MINOR}.${CALAMARES_VERSION_PATCH} )
|
set( CALAMARES_VERSION ${CALAMARES_VERSION_MAJOR}.${CALAMARES_VERSION_MINOR}.${CALAMARES_VERSION_PATCH} )
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ function( calamares_add_plugin )
|
|||||||
set( NAME ${ARGV0} )
|
set( NAME ${ARGV0} )
|
||||||
set( options NO_INSTALL SHARED_LIB )
|
set( options NO_INSTALL SHARED_LIB )
|
||||||
set( oneValueArgs NAME TYPE EXPORT_MACRO RESOURCES )
|
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} )
|
cmake_parse_arguments( PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||||
set( PLUGIN_NAME ${NAME} )
|
set( PLUGIN_NAME ${NAME} )
|
||||||
set( PLUGIN_DESTINATION ${CMAKE_INSTALL_LIBDIR}/calamares/modules/${PLUGIN_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" )
|
if( NOT CMAKE_BUILD_TYPE STREQUAL "Release" )
|
||||||
message( " ${Green}TYPE:${ColorReset} ${PLUGIN_TYPE}" )
|
message( " ${Green}TYPE:${ColorReset} ${PLUGIN_TYPE}" )
|
||||||
message( " ${Green}LINK_LIBRARIES:${ColorReset} ${PLUGIN_LINK_LIBRARIES}" )
|
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}SOURCES:${ColorReset} ${PLUGIN_SOURCES}" )
|
||||||
# message( " ${Green}UI:${ColorReset} ${PLUGIN_UI}" )
|
# message( " ${Green}UI:${ColorReset} ${PLUGIN_UI}" )
|
||||||
# message( " ${Green}EXPORT_MACRO:${ColorReset} ${PLUGIN_EXPORT_MACRO}" )
|
# 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}" )
|
list( APPEND calamares_add_library_args "LINK_LIBRARIES" "${PLUGIN_LINK_LIBRARIES}" )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if( PLUGIN_LINK_PRIVATE_LIBRARIES )
|
||||||
|
list( APPEND calamares_add_library_args "LINK_PRIVATE_LIBRARIES" "${PLUGIN_LINK_PRIVATE_LIBRARIES}" )
|
||||||
|
endif()
|
||||||
|
|
||||||
if( PLUGIN_COMPILE_DEFINITIONS )
|
if( PLUGIN_COMPILE_DEFINITIONS )
|
||||||
list( APPEND calamares_add_library_args "COMPILE_DEFINITIONS" ${PLUGIN_COMPILE_DEFINITIONS} )
|
list( APPEND calamares_add_library_args "COMPILE_DEFINITIONS" ${PLUGIN_COMPILE_DEFINITIONS} )
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -59,12 +59,12 @@ endif()
|
|||||||
|
|
||||||
qt5_use_modules( calamares_bin Core Widgets )
|
qt5_use_modules( calamares_bin Core Widgets )
|
||||||
target_link_libraries( calamares_bin
|
target_link_libraries( calamares_bin
|
||||||
${CALAMARES_LIBRARIES}
|
PRIVATE
|
||||||
calamaresui
|
${CALAMARES_LIBRARIES}
|
||||||
Qt5::Core
|
calamaresui
|
||||||
Qt5::Widgets
|
Qt5::Core
|
||||||
yaml-cpp
|
Qt5::Widgets
|
||||||
${LINK_LIBRARIES}
|
${LINK_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
install( TARGETS calamares_bin
|
install( TARGETS calamares_bin
|
||||||
|
|||||||
@@ -43,10 +43,11 @@ calamares_add_library( ${CALAMARESUI_LIBRARY_TARGET}
|
|||||||
SOURCES ${${CALAMARESUI_LIBRARY_TARGET}_SOURCES}
|
SOURCES ${${CALAMARESUI_LIBRARY_TARGET}_SOURCES}
|
||||||
UI ${${CALAMARESUI_LIBRARY_TARGET}_UI}
|
UI ${${CALAMARESUI_LIBRARY_TARGET}_UI}
|
||||||
EXPORT_MACRO UIDLLEXPORT_PRO
|
EXPORT_MACRO UIDLLEXPORT_PRO
|
||||||
LINK_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
yaml-cpp
|
yaml-cpp
|
||||||
Qt5::Svg
|
Qt5::Svg
|
||||||
Qt5::QuickWidgets
|
Qt5::QuickWidgets
|
||||||
|
${OPTIONAL_PRIVATE_LIBRARIES}
|
||||||
RESOURCES libcalamaresui.qrc
|
RESOURCES libcalamaresui.qrc
|
||||||
EXPORT CalamaresLibraryDepends
|
EXPORT CalamaresLibraryDepends
|
||||||
VERSION ${CALAMARES_VERSION_SHORT}
|
VERSION ${CALAMARES_VERSION_SHORT}
|
||||||
|
|||||||
@@ -231,9 +231,13 @@ def install_grub(efi_directory, fw_type):
|
|||||||
check_target_env_call(["mkdir", "-p", efi_boot_directory])
|
check_target_env_call(["mkdir", "-p", efi_boot_directory])
|
||||||
|
|
||||||
# Workaround for some UEFI firmwares
|
# 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",
|
check_target_env_call(["cp",
|
||||||
os.path.join(efi_directory_firmware, efi_bootloader_id, "grubx64.efi"),
|
efi_file_source[efi_bitness],
|
||||||
os.path.join(efi_boot_directory, "bootx64.efi")])
|
efi_file_target[efi_bitness]])
|
||||||
else:
|
else:
|
||||||
print("Bootloader: grub (bios)")
|
print("Bootloader: grub (bios)")
|
||||||
boot_loader = libcalamares.globalstorage.value("bootLoader")
|
boot_loader = libcalamares.globalstorage.value("bootLoader")
|
||||||
@@ -253,7 +257,7 @@ def install_grub(efi_directory, fw_type):
|
|||||||
def vfat_correct_case(parent, name):
|
def vfat_correct_case(parent, name):
|
||||||
for candidate in os.listdir(parent):
|
for candidate in os.listdir(parent):
|
||||||
if name.lower() == candidate.lower():
|
if name.lower() == candidate.lower():
|
||||||
return candidate
|
return os.path.join(parent, candidate)
|
||||||
return os.path.join(parent, name)
|
return os.path.join(parent, name)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -267,15 +267,13 @@ def set_autologin(username, displaymanagers, default_desktop_environment, root_m
|
|||||||
|
|
||||||
if do_autologin:
|
if do_autologin:
|
||||||
autologin_section['User'] = username
|
autologin_section['User'] = username
|
||||||
|
elif 'User' in autologin_section:
|
||||||
|
del autologin_section['User']
|
||||||
|
|
||||||
if default_desktop_environment is not None:
|
if default_desktop_environment is not None:
|
||||||
autologin_section['Session'] = default_desktop_environment.desktop_file
|
autologin_section['Session'] = default_desktop_environment.desktop_file
|
||||||
|
|
||||||
if autologin_section:
|
sddm_config['Autologin'] = 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:
|
with open(sddm_conf_path, 'w') as sddm_config_file:
|
||||||
sddm_config.write(sddm_config_file, space_around_delimiters=False)
|
sddm_config.write(sddm_config_file, space_around_delimiters=False)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ calamares_add_plugin( dracutlukscfg
|
|||||||
EXPORT_MACRO PLUGINDLLEXPORT_PRO
|
EXPORT_MACRO PLUGINDLLEXPORT_PRO
|
||||||
SOURCES
|
SOURCES
|
||||||
DracutLuksCfgJob.cpp
|
DracutLuksCfgJob.cpp
|
||||||
LINK_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
calamares
|
calamares
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -33,14 +33,22 @@
|
|||||||
const QString DracutLuksCfgJob::CONFIG_FILE = QStringLiteral( "/etc/dracut.conf.d/calamares-luks.conf" );
|
const QString DracutLuksCfgJob::CONFIG_FILE = QStringLiteral( "/etc/dracut.conf.d/calamares-luks.conf" );
|
||||||
|
|
||||||
// static
|
// static
|
||||||
const char *DracutLuksCfgJob::CONFIG_FILE_CONTENTS =
|
const char *DracutLuksCfgJob::CONFIG_FILE_HEADER =
|
||||||
"# Configuration file automatically written by the Calamares system installer\n"
|
"# 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"
|
"# (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"
|
"# 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"
|
"# force installing /etc/crypttab even if hostonly=\"no\", install the keyfile\n"
|
||||||
"install_items+=\" /etc/crypttab /crypto_keyfile.bin \"\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
|
// static
|
||||||
const QString DracutLuksCfgJob::CONFIG_FILE_SWAPLINE = QStringLiteral( "# enable automatic resume from swap\nadd_device+=\" /dev/disk/by-uuid/%1 \"\n" );
|
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;
|
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
|
// static
|
||||||
QString
|
QString
|
||||||
DracutLuksCfgJob::swapOuterUuid()
|
DracutLuksCfgJob::swapOuterUuid()
|
||||||
@@ -126,7 +149,9 @@ DracutLuksCfgJob::exec()
|
|||||||
return Calamares::JobResult::error( tr( "Failed to open %1" ).arg( realConfigFilePath ) );
|
return Calamares::JobResult::error( tr( "Failed to open %1" ).arg( realConfigFilePath ) );
|
||||||
}
|
}
|
||||||
QTextStream outStream( &configFile );
|
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();
|
const QString swapOuterUuid = DracutLuksCfgJob::swapOuterUuid();
|
||||||
if ( ! swapOuterUuid.isEmpty() )
|
if ( ! swapOuterUuid.isEmpty() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,12 +42,15 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static const QString CONFIG_FILE;
|
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 const QString CONFIG_FILE_SWAPLINE;
|
||||||
|
|
||||||
static QString rootMountPoint();
|
static QString rootMountPoint();
|
||||||
static QVariantList partitions();
|
static QVariantList partitions();
|
||||||
static bool isRootEncrypted();
|
static bool isRootEncrypted();
|
||||||
|
static bool hasUnencryptedSeparateBoot();
|
||||||
static QString swapOuterUuid();
|
static QString swapOuterUuid();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ calamares_add_plugin( dummycpp
|
|||||||
EXPORT_MACRO PLUGINDLLEXPORT_PRO
|
EXPORT_MACRO PLUGINDLLEXPORT_PRO
|
||||||
SOURCES
|
SOURCES
|
||||||
DummyCppJob.cpp
|
DummyCppJob.cpp
|
||||||
LINK_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
calamares
|
calamares
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ calamares_add_plugin( finished
|
|||||||
FinishedPage.cpp
|
FinishedPage.cpp
|
||||||
UI
|
UI
|
||||||
FinishedPage.ui
|
FinishedPage.ui
|
||||||
LINK_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
calamaresui
|
calamaresui
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import subprocess
|
||||||
|
|
||||||
import libcalamares
|
import libcalamares
|
||||||
|
|
||||||
@@ -180,10 +181,33 @@ class FstabGenerator(object):
|
|||||||
print(FSTAB_HEADER, file=fstab_file)
|
print(FSTAB_HEADER, file=fstab_file)
|
||||||
|
|
||||||
for partition in self.partitions:
|
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:
|
else:
|
||||||
self.print_fstab_line(dct, file=fstab_file)
|
dct = self.generate_fstab_line_info(partition)
|
||||||
|
|
||||||
|
if dct:
|
||||||
|
self.print_fstab_line(dct, file=fstab_file)
|
||||||
|
|
||||||
if self.root_is_ssd:
|
if self.root_is_ssd:
|
||||||
# Mount /tmp on a tmpfs
|
# Mount /tmp on a tmpfs
|
||||||
@@ -224,12 +248,21 @@ class FstabGenerator(object):
|
|||||||
if mount_point == "/":
|
if mount_point == "/":
|
||||||
self.root_is_ssd = is_ssd
|
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"],
|
return dict(device="UUID=" + partition["uuid"],
|
||||||
mount_point=mount_point or "swap",
|
mount_point=mount_point or "swap",
|
||||||
fs=filesystem,
|
fs=filesystem,
|
||||||
options=options,
|
options=options,
|
||||||
check=check,
|
check=check,
|
||||||
)
|
)
|
||||||
|
|
||||||
def print_fstab_line(self, dct, file=None):
|
def print_fstab_line(self, dct, file=None):
|
||||||
""" Prints line to '/etc/fstab' file. """
|
""" Prints line to '/etc/fstab' file. """
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ def modify_mkinitcpio_conf(partitions, root_mount_point):
|
|||||||
files = []
|
files = []
|
||||||
encrypt_hook = False
|
encrypt_hook = False
|
||||||
openswap_hook = False
|
openswap_hook = False
|
||||||
|
unencrypted_separate_boot = False
|
||||||
|
|
||||||
# It is important that the plymouth hook comes before any encrypt hook
|
# It is important that the plymouth hook comes before any encrypt hook
|
||||||
plymouth_bin = os.path.join(root_mount_point, "usr/bin/plymouth")
|
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:
|
if partition["mountPoint"] == "/" and "luksMapperName" in partition:
|
||||||
encrypt_hook = True
|
encrypt_hook = True
|
||||||
|
|
||||||
|
if partition["mountPoint"] == "/boot" and "luksMapperName" not in partition:
|
||||||
|
unencrypted_separate_boot = True
|
||||||
|
|
||||||
if encrypt_hook:
|
if encrypt_hook:
|
||||||
hooks.append("encrypt")
|
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")
|
files.append("/crypto_keyfile.bin")
|
||||||
|
|
||||||
if swap_uuid is not "":
|
if swap_uuid is not "":
|
||||||
|
|||||||
22
src/modules/initramfscfg/encrypt_hook_nokey
Executable file
22
src/modules/initramfscfg/encrypt_hook_nokey
Executable 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
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
# Copyright 2014, Rohan Garg <rohan@kde.org>
|
# Copyright 2014, Rohan Garg <rohan@kde.org>
|
||||||
# Copyright 2015, Philip Müller <philm@manjaro.org>
|
# Copyright 2015, Philip Müller <philm@manjaro.org>
|
||||||
# Copyright 2016, David McKinney <mckinney@subgraph.com>
|
# 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
|
# Calamares is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# 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:
|
:param root_mount_point:
|
||||||
"""
|
"""
|
||||||
encrypt_hook = False
|
encrypt_hook = False
|
||||||
|
unencrypted_separate_boot = False
|
||||||
|
|
||||||
for partition in partitions:
|
for partition in partitions:
|
||||||
if partition["mountPoint"] == "/" and "luksMapperName" in partition:
|
if partition["mountPoint"] == "/" and "luksMapperName" in partition:
|
||||||
encrypt_hook = True
|
encrypt_hook = True
|
||||||
|
|
||||||
|
if partition["mountPoint"] == "/boot" and "luksMapperName" not in partition:
|
||||||
|
unencrypted_separate_boot = True
|
||||||
|
|
||||||
if encrypt_hook:
|
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)
|
os.chmod("{!s}/usr/share/initramfs-tools/hooks/encrypt_hook".format(root_mount_point), 0o755)
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ calamares_add_plugin( interactiveterminal
|
|||||||
SOURCES
|
SOURCES
|
||||||
InteractiveTerminalViewStep.cpp
|
InteractiveTerminalViewStep.cpp
|
||||||
InteractiveTerminalPage.cpp
|
InteractiveTerminalPage.cpp
|
||||||
LINK_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
calamaresui
|
calamaresui
|
||||||
KF5::Service
|
KF5::Service
|
||||||
KF5::Parts
|
KF5::Parts
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ calamares_add_plugin( keyboard
|
|||||||
KeyboardPage.ui
|
KeyboardPage.ui
|
||||||
RESOURCES
|
RESOURCES
|
||||||
keyboard.qrc
|
keyboard.qrc
|
||||||
LINK_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
calamaresui
|
calamaresui
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ KeyboardViewStep::KeyboardViewStep( QObject* parent )
|
|||||||
: Calamares::ViewStep( parent )
|
: Calamares::ViewStep( parent )
|
||||||
, m_widget( new KeyboardPage() )
|
, m_widget( new KeyboardPage() )
|
||||||
, m_nextEnabled( false )
|
, m_nextEnabled( false )
|
||||||
|
, m_writeEtcDefaultKeyboard( true )
|
||||||
{
|
{
|
||||||
m_widget->init();
|
m_widget->init();
|
||||||
m_nextEnabled = true;
|
m_nextEnabled = true;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
|
|||||||
LicensePage.cpp
|
LicensePage.cpp
|
||||||
UI
|
UI
|
||||||
LicensePage.ui
|
LicensePage.ui
|
||||||
LINK_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
calamaresui
|
calamaresui
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ calamares_add_plugin( locale
|
|||||||
UI
|
UI
|
||||||
RESOURCES
|
RESOURCES
|
||||||
locale.qrc
|
locale.qrc
|
||||||
LINK_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
calamaresui
|
calamaresui
|
||||||
|
Qt5::Network
|
||||||
|
yaml-cpp
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
# along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
# along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import subprocess
|
||||||
|
|
||||||
import libcalamares
|
import libcalamares
|
||||||
|
|
||||||
@@ -55,6 +56,58 @@ def mount_partitions(root_mount_point, partitions):
|
|||||||
partition.get("options", ""),
|
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():
|
def run():
|
||||||
""" Define mountpoints.
|
""" Define mountpoints.
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ extraMounts:
|
|||||||
- device: tmpfs
|
- device: tmpfs
|
||||||
fs: tmpfs
|
fs: tmpfs
|
||||||
mountPoint: /run
|
mountPoint: /run
|
||||||
|
- device: /run/udev
|
||||||
|
mountPoint: /run/udev
|
||||||
|
options: bind
|
||||||
|
|
||||||
extraMountsEfi:
|
extraMountsEfi:
|
||||||
- device: efivarfs
|
- device: efivarfs
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ calamares_add_plugin( netinstall
|
|||||||
widgets/groupselectionwidget.ui
|
widgets/groupselectionwidget.ui
|
||||||
RESOURCES
|
RESOURCES
|
||||||
netinstall.qrc
|
netinstall.qrc
|
||||||
LINK_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
calamaresui
|
calamaresui
|
||||||
|
Qt5::Network
|
||||||
|
yaml-cpp
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -11,6 +11,13 @@ find_package( KF5 REQUIRED CoreAddons )
|
|||||||
find_package( KF5 REQUIRED Config I18n IconThemes KIO Service )
|
find_package( KF5 REQUIRED Config I18n IconThemes KIO Service )
|
||||||
|
|
||||||
find_package( KPMcore 2.2 REQUIRED )
|
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 )
|
add_subdirectory( tests )
|
||||||
|
|
||||||
@@ -66,7 +73,7 @@ calamares_add_plugin( partition
|
|||||||
gui/EncryptWidget.ui
|
gui/EncryptWidget.ui
|
||||||
gui/PartitionPage.ui
|
gui/PartitionPage.ui
|
||||||
gui/ReplaceWidget.ui
|
gui/ReplaceWidget.ui
|
||||||
LINK_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
kpmcore
|
kpmcore
|
||||||
calamaresui
|
calamaresui
|
||||||
KF5::CoreAddons
|
KF5::CoreAddons
|
||||||
|
|||||||
6
src/modules/partition/PartitionConfig.h.in
Normal file
6
src/modules/partition/PartitionConfig.h.in
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#ifndef CALAMARESPARTITIONCONFIG_H
|
||||||
|
#define CALAMARESPARTITIONCONFIG_H
|
||||||
|
|
||||||
|
#cmakedefine WITH_KPMCORE3
|
||||||
|
|
||||||
|
#endif // CALAMARESPARTITIONCONFIG_H
|
||||||
@@ -151,6 +151,12 @@ createNewEncryptedPartition( PartitionNode* parent,
|
|||||||
FileSystemFactory::create( FileSystem::Luks,
|
FileSystemFactory::create( FileSystem::Luks,
|
||||||
firstSector,
|
firstSector,
|
||||||
lastSector ) );
|
lastSector ) );
|
||||||
|
if ( !fs )
|
||||||
|
{
|
||||||
|
qDebug() << "ERROR: cannot create LUKS filesystem. Giving up.";
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
fs->createInnerFileSystem( fsType );
|
fs->createInnerFileSystem( fsType );
|
||||||
fs->setPassphrase( passphrase );
|
fs->setPassphrase( passphrase );
|
||||||
Partition* p = new Partition( parent,
|
Partition* p = new Partition( parent,
|
||||||
|
|||||||
@@ -51,8 +51,9 @@ canBeReplaced( Partition* candidate )
|
|||||||
qint64 requiredStorageB = ( requiredStorageGB + 0.5 ) * 1024 * 1024 * 1024;
|
qint64 requiredStorageB = ( requiredStorageGB + 0.5 ) * 1024 * 1024 * 1024;
|
||||||
cDebug() << "Required storage B:" << requiredStorageB
|
cDebug() << "Required storage B:" << requiredStorageB
|
||||||
<< QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 );
|
<< QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 );
|
||||||
cDebug() << "Available storage B:" << availableStorageB
|
cDebug() << "Storage capacity B:" << availableStorageB
|
||||||
<< QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 );
|
<< QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 )
|
||||||
|
<< "for" << candidate->partitionPath() << " length:" << candidate->length();
|
||||||
|
|
||||||
if ( ok &&
|
if ( ok &&
|
||||||
availableStorageB > requiredStorageB )
|
availableStorageB > requiredStorageB )
|
||||||
@@ -102,7 +103,9 @@ canBeResized( Partition* candidate )
|
|||||||
cDebug() << "Required storage B:" << requiredStorageB
|
cDebug() << "Required storage B:" << requiredStorageB
|
||||||
<< QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 );
|
<< QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 );
|
||||||
cDebug() << "Available storage B:" << availableStorageB
|
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 &&
|
if ( ok &&
|
||||||
availableStorageB > requiredStorageB )
|
availableStorageB > requiredStorageB )
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
/* === 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
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
|
#include "PartitionConfig.h"
|
||||||
|
|
||||||
#include <kpmcore/core/device.h>
|
#include <kpmcore/core/device.h>
|
||||||
#include <kpmcore/core/partition.h>
|
#include <kpmcore/core/partition.h>
|
||||||
@@ -128,11 +129,19 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
|
|||||||
empty_space_size = 1;
|
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;
|
qint64 firstFreeSector = empty_space_size MiB / dev->logicalSectorSize() + 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( isEfi )
|
if ( isEfi )
|
||||||
{
|
{
|
||||||
|
#ifdef WITH_KPMCORE3
|
||||||
|
qint64 lastSector = firstFreeSector + ( uefisys_part_size MiB / dev->logicalSize() );
|
||||||
|
#else
|
||||||
qint64 lastSector = firstFreeSector + ( uefisys_part_size MiB / dev->logicalSectorSize() );
|
qint64 lastSector = firstFreeSector + ( uefisys_part_size MiB / dev->logicalSectorSize() );
|
||||||
|
#endif
|
||||||
core->createPartitionTable( dev, PartitionTable::gpt );
|
core->createPartitionTable( dev, PartitionTable::gpt );
|
||||||
Partition* efiPartition = KPMHelpers::createNewPartition(
|
Partition* efiPartition = KPMHelpers::createNewPartition(
|
||||||
dev->partitionTable(),
|
dev->partitionTable(),
|
||||||
@@ -148,7 +157,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
|
|||||||
->globalStorage()
|
->globalStorage()
|
||||||
->value( "efiSystemPartition" )
|
->value( "efiSystemPartition" )
|
||||||
.toString() );
|
.toString() );
|
||||||
core->createPartition( dev, efiPartition );
|
core->createPartition( dev, efiPartition, PartitionTable::FlagEsp | PartitionTable::FlagBoot );
|
||||||
firstFreeSector = lastSector + 1;
|
firstFreeSector = lastSector + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -157,7 +166,11 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool shouldCreateSwap = false;
|
bool shouldCreateSwap = false;
|
||||||
|
#ifdef WITH_KPMCORE3
|
||||||
|
qint64 availableSpaceB = ( dev->totalLogical() - firstFreeSector ) * dev->logicalSize();
|
||||||
|
#else
|
||||||
qint64 availableSpaceB = ( dev->totalSectors() - firstFreeSector ) * dev->logicalSectorSize();
|
qint64 availableSpaceB = ( dev->totalSectors() - firstFreeSector ) * dev->logicalSectorSize();
|
||||||
|
#endif
|
||||||
qint64 suggestedSwapSizeB = swapSuggestion( availableSpaceB );
|
qint64 suggestedSwapSizeB = swapSuggestion( availableSpaceB );
|
||||||
qint64 requiredSpaceB =
|
qint64 requiredSpaceB =
|
||||||
( Calamares::JobQueue::instance()->
|
( 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.
|
// If there is enough room for ESP + root + swap, create swap, otherwise don't.
|
||||||
shouldCreateSwap = availableSpaceB > requiredSpaceB;
|
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
|
qint64 lastSectorForRoot = dev->totalSectors() - 1; //last sector of the device
|
||||||
if ( shouldCreateSwap )
|
if ( shouldCreateSwap )
|
||||||
{
|
{
|
||||||
lastSectorForRoot -= suggestedSwapSizeB / dev->logicalSectorSize() + 1;
|
lastSectorForRoot -= suggestedSwapSizeB / dev->logicalSectorSize() + 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Partition* rootPartition = nullptr;
|
Partition* rootPartition = nullptr;
|
||||||
if ( luksPassphrase.isEmpty() )
|
if ( luksPassphrase.isEmpty() )
|
||||||
@@ -213,7 +234,11 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
|
|||||||
PartitionRole( PartitionRole::Primary ),
|
PartitionRole( PartitionRole::Primary ),
|
||||||
FileSystem::LinuxSwap,
|
FileSystem::LinuxSwap,
|
||||||
lastSectorForRoot + 1,
|
lastSectorForRoot + 1,
|
||||||
|
#ifdef WITH_KPMCORE3
|
||||||
|
dev->totalLogical() - 1
|
||||||
|
#else
|
||||||
dev->totalSectors() - 1
|
dev->totalSectors() - 1
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -224,7 +249,11 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
|
|||||||
PartitionRole( PartitionRole::Primary ),
|
PartitionRole( PartitionRole::Primary ),
|
||||||
FileSystem::LinuxSwap,
|
FileSystem::LinuxSwap,
|
||||||
lastSectorForRoot + 1,
|
lastSectorForRoot + 1,
|
||||||
|
#ifdef WITH_KPMCORE3
|
||||||
|
dev->totalLogical() - 1,
|
||||||
|
#else
|
||||||
dev->totalSectors() - 1,
|
dev->totalSectors() - 1,
|
||||||
|
#endif
|
||||||
luksPassphrase
|
luksPassphrase
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include "core/PartitionInfo.h"
|
#include "core/PartitionInfo.h"
|
||||||
#include "core/KPMHelpers.h"
|
#include "core/KPMHelpers.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
#include "PartitionConfig.h"
|
||||||
|
|
||||||
// CalaPM
|
// CalaPM
|
||||||
#include <kpmcore/core/device.h>
|
#include <kpmcore/core/device.h>
|
||||||
@@ -148,7 +149,11 @@ PartitionModel::data( const QModelIndex& index, int role ) const
|
|||||||
return PartitionInfo::mountPoint( partition );
|
return PartitionInfo::mountPoint( partition );
|
||||||
if ( col == SizeColumn )
|
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();
|
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize();
|
||||||
|
#endif
|
||||||
return KFormat().formatByteSize( size );
|
return KFormat().formatByteSize( size );
|
||||||
}
|
}
|
||||||
cDebug() << "Unknown column" << col;
|
cDebug() << "Unknown column" << col;
|
||||||
@@ -175,12 +180,20 @@ PartitionModel::data( const QModelIndex& index, int role ) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QString prettyFileSystem = KPMHelpers::prettyNameForFileSystemType( partition->fileSystem().type() );
|
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();
|
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize();
|
||||||
|
#endif
|
||||||
QString prettySize = KFormat().formatByteSize( size );
|
QString prettySize = KFormat().formatByteSize( size );
|
||||||
return QVariant(name + " " + prettyFileSystem + " " + prettySize);
|
return QVariant(name + " " + prettyFileSystem + " " + prettySize);
|
||||||
}
|
}
|
||||||
case SizeRole:
|
case SizeRole:
|
||||||
|
#ifdef WITH_KPMCORE3
|
||||||
|
return ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSize();
|
||||||
|
#else
|
||||||
return ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize();
|
return ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize();
|
||||||
|
#endif
|
||||||
case IsFreeSpaceRole:
|
case IsFreeSpaceRole:
|
||||||
return KPMHelpers::isPartitionFreeSpace( partition );
|
return KPMHelpers::isPartitionFreeSpace( partition );
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include "BootInfoWidget.h"
|
#include "BootInfoWidget.h"
|
||||||
#include "DeviceInfoWidget.h"
|
#include "DeviceInfoWidget.h"
|
||||||
#include "ScanningDialog.h"
|
#include "ScanningDialog.h"
|
||||||
|
#include "PartitionConfig.h"
|
||||||
|
|
||||||
#include "utils/CalamaresUtilsGui.h"
|
#include "utils/CalamaresUtilsGui.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
@@ -594,7 +595,11 @@ ChoicePage::doAlongsideApply()
|
|||||||
qint64 oldLastSector = candidate->lastSector();
|
qint64 oldLastSector = candidate->lastSector();
|
||||||
qint64 newLastSector = firstSector +
|
qint64 newLastSector = firstSector +
|
||||||
m_afterPartitionSplitterWidget->splitPartitionSize() /
|
m_afterPartitionSplitterWidget->splitPartitionSize() /
|
||||||
|
#ifdef WITH_KPMCORE3
|
||||||
|
dev->logicalSize();
|
||||||
|
#else
|
||||||
dev->logicalSectorSize();
|
dev->logicalSectorSize();
|
||||||
|
#endif
|
||||||
|
|
||||||
m_core->resizePartition( dev, candidate, firstSector, newLastSector );
|
m_core->resizePartition( dev, candidate, firstSector, newLastSector );
|
||||||
Partition* newPartition = nullptr;
|
Partition* newPartition = nullptr;
|
||||||
@@ -1106,7 +1111,7 @@ ChoicePage::createBootloaderComboBox( QWidget* parent )
|
|||||||
|
|
||||||
// When the chosen bootloader device changes, we update the choice in the PCM
|
// When the chosen bootloader device changes, we update the choice in the PCM
|
||||||
connect( bcb, static_cast< void (QComboBox::*)(int) >( &QComboBox::currentIndexChanged ),
|
connect( bcb, static_cast< void (QComboBox::*)(int) >( &QComboBox::currentIndexChanged ),
|
||||||
[this]( int newIndex )
|
this, [this]( int newIndex )
|
||||||
{
|
{
|
||||||
QComboBox* bcb = qobject_cast< QComboBox* >( sender() );
|
QComboBox* bcb = qobject_cast< QComboBox* >( sender() );
|
||||||
if ( bcb )
|
if ( bcb )
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include <core/PartitionModel.h>
|
#include <core/PartitionModel.h>
|
||||||
#include <core/ColorUtils.h>
|
#include <core/ColorUtils.h>
|
||||||
|
#include "PartitionConfig.h"
|
||||||
|
|
||||||
#include <utils/CalamaresUtilsGui.h>
|
#include <utils/CalamaresUtilsGui.h>
|
||||||
#include <utils/Logger.h>
|
#include <utils/Logger.h>
|
||||||
@@ -47,7 +48,11 @@ QStringList
|
|||||||
buildUnknownDisklabelTexts( Device* dev )
|
buildUnknownDisklabelTexts( Device* dev )
|
||||||
{
|
{
|
||||||
QStringList texts = { QObject::tr( "Unpartitioned space or unknown partition table" ),
|
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() ) };
|
KFormat().formatByteSize( dev->totalSectors() * dev->logicalSectorSize() ) };
|
||||||
|
#endif
|
||||||
return texts;
|
return texts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "core/ColorUtils.h"
|
#include "core/ColorUtils.h"
|
||||||
#include "core/KPMHelpers.h"
|
#include "core/KPMHelpers.h"
|
||||||
|
#include "PartitionConfig.h"
|
||||||
|
|
||||||
// Qt
|
// Qt
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
@@ -135,7 +136,11 @@ PartitionSizeController::updatePartResizerWidget()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_updating = true;
|
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();
|
qint64 sectorSize = qint64( m_spinBox->value() ) * 1024 * 1024 / m_device->logicalSectorSize();
|
||||||
|
#endif
|
||||||
|
|
||||||
qint64 firstSector = m_partition->firstSector();
|
qint64 firstSector = m_partition->firstSector();
|
||||||
qint64 lastSector = firstSector + sectorSize - 1;
|
qint64 lastSector = firstSector + sectorSize - 1;
|
||||||
@@ -185,7 +190,11 @@ PartitionSizeController::doUpdateSpinBox()
|
|||||||
{
|
{
|
||||||
if ( !m_spinBox )
|
if ( !m_spinBox )
|
||||||
return;
|
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;
|
qint64 mbSize = m_partition->length() * m_device->logicalSectorSize() / 1024 / 1024;
|
||||||
|
#endif
|
||||||
m_spinBox->setValue( mbSize );
|
m_spinBox->setValue( mbSize );
|
||||||
if ( m_currentSpinBoxValue != -1 && //if it's not the first time we're setting it
|
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
|
m_currentSpinBoxValue != mbSize ) //and the operation changes the SB value
|
||||||
|
|||||||
@@ -437,7 +437,39 @@ PartitionViewStep::onLeave()
|
|||||||
QMessageBox::warning( m_manualPartitionPage,
|
QMessageBox::warning( m_manualPartitionPage,
|
||||||
message,
|
message,
|
||||||
description );
|
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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include "core/KPMHelpers.h"
|
#include "core/KPMHelpers.h"
|
||||||
#include "Branding.h"
|
#include "Branding.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
#include "PartitionConfig.h"
|
||||||
|
|
||||||
// CalaPM
|
// CalaPM
|
||||||
#include <kpmcore/core/device.h>
|
#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 );
|
const FS::luks* luksFs = dynamic_cast< const FS::luks* >( &fsRef );
|
||||||
if ( luksFs )
|
if ( luksFs )
|
||||||
{
|
{
|
||||||
|
#ifdef WITH_KPMCORE3
|
||||||
|
map[ "luksMapperName" ] = luksFs->mapperName().split( "/" ).last();
|
||||||
|
#else
|
||||||
map[ "luksMapperName" ] = luksFs->mapperName( partition->partitionPath() ).split( "/" ).last();
|
map[ "luksMapperName" ] = luksFs->mapperName( partition->partitionPath() ).split( "/" ).last();
|
||||||
|
#endif
|
||||||
map[ "luksUuid" ] = getLuksUuid( partition->partitionPath() );
|
map[ "luksUuid" ] = getLuksUuid( partition->partitionPath() );
|
||||||
map[ "luksPassphrase" ] = luksFs->passphrase();
|
map[ "luksPassphrase" ] = luksFs->passphrase();
|
||||||
cDebug() << "luksMapperName:" << map[ "luksMapperName" ];
|
cDebug() << "luksMapperName:" << map[ "luksMapperName" ];
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
#include "jobs/CheckFileSystemJob.h"
|
#include "jobs/CheckFileSystemJob.h"
|
||||||
#include "jobs/MoveFileSystemJob.h"
|
#include "jobs/MoveFileSystemJob.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
#include "PartitionConfig.h"
|
||||||
|
|
||||||
// KPMcore
|
// KPMcore
|
||||||
#include <kpmcore/backend/corebackend.h>
|
#include <kpmcore/backend/corebackend.h>
|
||||||
@@ -93,7 +94,11 @@ public:
|
|||||||
break;
|
break;
|
||||||
case FileSystem::cmdSupportFileSystem:
|
case FileSystem::cmdSupportFileSystem:
|
||||||
{
|
{
|
||||||
|
#ifdef WITH_KPMCORE3
|
||||||
|
qint64 byteLength = m_device->logicalSize() * m_length;
|
||||||
|
#else
|
||||||
qint64 byteLength = m_device->logicalSectorSize() * m_length;
|
qint64 byteLength = m_device->logicalSectorSize() * m_length;
|
||||||
|
#endif
|
||||||
bool ok = fs.resize( report, m_partition->partitionPath(), byteLength );
|
bool ok = fs.resize( report, m_partition->partitionPath(), byteLength );
|
||||||
if ( !ok )
|
if ( !ok )
|
||||||
return Calamares::JobResult::error(
|
return Calamares::JobResult::error(
|
||||||
|
|||||||
@@ -15,3 +15,6 @@ targets:
|
|||||||
disable:
|
disable:
|
||||||
- name: "pacman-init"
|
- name: "pacman-init"
|
||||||
mandatory: false
|
mandatory: false
|
||||||
|
|
||||||
|
# Example to express an empty list:
|
||||||
|
# disable: []
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ calamares_add_plugin( summary
|
|||||||
SummaryViewStep.cpp
|
SummaryViewStep.cpp
|
||||||
SummaryPage.cpp
|
SummaryPage.cpp
|
||||||
UI
|
UI
|
||||||
LINK_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
calamaresui
|
calamaresui
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ calamares_add_plugin( users
|
|||||||
page_usersetup.ui
|
page_usersetup.ui
|
||||||
RESOURCES
|
RESOURCES
|
||||||
users.qrc
|
users.qrc
|
||||||
LINK_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
calamaresui
|
calamaresui
|
||||||
${CRYPT_LIBRARIES}
|
${CRYPT_LIBRARIES}
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
/* === 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
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* 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." ),
|
return Calamares::JobResult::error( tr( "Bad destination system path." ),
|
||||||
tr( "rootMountPoint is %1" ).arg( destDir.absolutePath() ) );
|
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(
|
QString encrypted = QString::fromLatin1(
|
||||||
crypt( m_newPassword.toLatin1(),
|
crypt( m_newPassword.toLatin1(),
|
||||||
QString( "$6$%1$" )
|
QString( "$6$%1$" )
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
/* === 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
|
* Portions from the Manjaro Installation Framework
|
||||||
* by Roland Singer <roland@manjaro.org>
|
* by Roland Singer <roland@manjaro.org>
|
||||||
@@ -138,6 +138,12 @@ UsersPage::createJobs( const QStringList& defaultGroupsList )
|
|||||||
ui->textBoxRootPassword->text() );
|
ui->textBoxRootPassword->text() );
|
||||||
list.append( Calamares::job_ptr( j ) );
|
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() );
|
j = new SetHostNameJob( ui->textBoxHostname->text() );
|
||||||
list.append( Calamares::job_ptr( j ) );
|
list.append( Calamares::job_ptr( j ) );
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ calamares_add_plugin( webview
|
|||||||
EXPORT_MACRO PLUGINDLLEXPORT_PRO
|
EXPORT_MACRO PLUGINDLLEXPORT_PRO
|
||||||
SOURCES
|
SOURCES
|
||||||
WebViewStep.cpp
|
WebViewStep.cpp
|
||||||
LINK_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
${CALA_WEBVIEW_LINK_LIBRARIES}
|
${CALA_WEBVIEW_LINK_LIBRARIES}
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include <QWebView>
|
#include <QWebView>
|
||||||
#else
|
#else
|
||||||
#include <QWebEngineView>
|
#include <QWebEngineView>
|
||||||
|
#include <QtWebEngine>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CALAMARES_PLUGIN_FACTORY_DEFINITION( WebViewStepFactory, registerPlugin<WebViewStep>(); )
|
CALAMARES_PLUGIN_FACTORY_DEFINITION( WebViewStepFactory, registerPlugin<WebViewStep>(); )
|
||||||
@@ -33,6 +34,9 @@ WebViewStep::WebViewStep( QObject* parent )
|
|||||||
: Calamares::ViewStep( parent )
|
: Calamares::ViewStep( parent )
|
||||||
{
|
{
|
||||||
emit nextStatusChanged( true );
|
emit nextStatusChanged( true );
|
||||||
|
#ifdef WEBVIEW_WITH_WEBENGINE
|
||||||
|
QtWebEngine::initialize();
|
||||||
|
#endif
|
||||||
m_view = new C_QWEBVIEW();
|
m_view = new C_QWEBVIEW();
|
||||||
#ifdef WEBVIEW_WITH_WEBKIT
|
#ifdef WEBVIEW_WITH_WEBKIT
|
||||||
m_view->settings()->setFontFamily( QWebSettings::StandardFont,
|
m_view->settings()->setFontFamily( QWebSettings::StandardFont,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui )
|
include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui )
|
||||||
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules )
|
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules )
|
||||||
find_package( LIBPARTED REQUIRED )
|
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 )
|
set_source_files_properties( checker/partman_devices.c PROPERTIES LANGUAGE CXX )
|
||||||
|
|
||||||
@@ -14,6 +14,7 @@ set( CHECKER_SOURCES
|
|||||||
set( CHECKER_LINK_LIBRARIES
|
set( CHECKER_LINK_LIBRARIES
|
||||||
${LIBPARTED_LIBS}
|
${LIBPARTED_LIBS}
|
||||||
Qt5::DBus
|
Qt5::DBus
|
||||||
|
Qt5::Network
|
||||||
)
|
)
|
||||||
|
|
||||||
calamares_add_plugin( welcome
|
calamares_add_plugin( welcome
|
||||||
@@ -25,7 +26,7 @@ calamares_add_plugin( welcome
|
|||||||
WelcomePage.cpp
|
WelcomePage.cpp
|
||||||
UI
|
UI
|
||||||
WelcomePage.ui
|
WelcomePage.ui
|
||||||
LINK_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
calamaresui
|
calamaresui
|
||||||
${CHECKER_LINK_LIBRARIES}
|
${CHECKER_LINK_LIBRARIES}
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
@@ -336,30 +337,8 @@ RequirementsChecker::checkHasPower()
|
|||||||
bool
|
bool
|
||||||
RequirementsChecker::checkHasInternet()
|
RequirementsChecker::checkHasInternet()
|
||||||
{
|
{
|
||||||
const QString NM_SVC_NAME( "org.freedesktop.NetworkManager" );
|
// default to true in the QNetworkAccessManager::UnknownAccessibility case
|
||||||
const QString NM_INTF_NAME( "org.freedesktop.NetworkManager" );
|
bool hasInternet = QNetworkAccessManager(this).networkAccessible() != QNetworkAccessManager::NotAccessible;
|
||||||
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;
|
|
||||||
|
|
||||||
Calamares::JobQueue::instance()->globalStorage()->insert( "hasInternet", hasInternet );
|
Calamares::JobQueue::instance()->globalStorage()->insert( "hasInternet", hasInternet );
|
||||||
return hasInternet;
|
return hasInternet;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user