Compare commits
	
		
			19 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | ff3391f67b | ||
|   | b60b21b680 | ||
|   | 8a533d22be | ||
|   | 6f32c18ef9 | ||
|   | f36f21c55c | ||
|   | bcacab531f | ||
|   | 85586293c8 | ||
|   | e71eb01feb | ||
|   | 3eb3e9c98d | ||
|   | 2bf5706f73 | ||
|   | 76885c7fe1 | ||
|   | fad0575e4d | ||
|   | 550f7d40ef | ||
|   | 6c07d39374 | ||
|   | 4285ccebd7 | ||
|   | 320d67a5ba | ||
|   | 6a80ce6dab | ||
|   | 33678a6a16 | ||
|   | 2c91dc4664 | 
							
								
								
									
										17
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								CHANGES
									
									
									
									
									
								
							| @@ -6,8 +6,19 @@ This is the changelog for Calamares-Extensions. For each release, the major | ||||
| changes and contributors are listed. Note that Calamares-Extensions does not | ||||
| have a historical changelog -- this log starts with version 1.0.0. | ||||
|  | ||||
| # 1.1.2 (2021-05-14) | ||||
|  | ||||
| # 1.1.1 (2021-02-23) # | ||||
| This release contains contributions from (alphabetically by first name): | ||||
|  - Oliver Smith | ||||
|  | ||||
| Changes and new modules in this release: | ||||
|  - New *os-* modules are intended for OS-specific work. They don't | ||||
|    do anything concrete yet, though. | ||||
|  - The *mobile* module has new features thanks to Oliver, with | ||||
|    keyboard selection (numeric / alpha) for PIN / password entry among them. | ||||
|  | ||||
|  | ||||
| # 1.1.1 (2021-02-23) | ||||
|  | ||||
| This release contains contributions from (alphabetically by first name): | ||||
|  - Oliver Smith | ||||
| @@ -22,7 +33,7 @@ Changes and new modules in this release: | ||||
|  - *mobile* wait screen has been re-worded. | ||||
|  | ||||
|  | ||||
| # 1.1.0 (2021-01-04) # | ||||
| # 1.1.0 (2021-01-04) | ||||
|  | ||||
| This release contains contributions from (alphabetically by first name): | ||||
|  - Oliver Smith | ||||
| @@ -32,7 +43,7 @@ Changes and new modules in this release: | ||||
|  - *mobile* module SSH daemon can be disabled | ||||
|  | ||||
|  | ||||
| # 1.0.0 (2020-12-05) # | ||||
| # 1.0.0 (2020-12-05) | ||||
|  | ||||
| This release contains contributions from (alphabetically by first name): | ||||
|  - Oliver Smith | ||||
|   | ||||
| @@ -24,13 +24,32 @@ | ||||
| # distro can use an unmodified (upstream) Calamares package and a local | ||||
| # customisation package in tandem. | ||||
| # | ||||
| # Besides being an example repository, it is also a collection of modules | ||||
| # and branding that is usable in its own right. | ||||
| # | ||||
| ### CONFIGURING | ||||
| # | ||||
| # By default, all the branding examples and all the modules are built. | ||||
| # This can be influenced through: | ||||
| #   SKIP_MODULES    : a space or semicolon-separated list of directory names | ||||
| #                     under src/modules that should not be built. | ||||
| #   USE_*           : fills in SKIP_MODULES for modules called *-<something> | ||||
| # In this repository, there is just one "group" to which USE_* applies: | ||||
| #   USE_os          : operating-system-specific modules. | ||||
| cmake_minimum_required(VERSION 3.3 FATAL_ERROR) | ||||
| project(calamares-extensions | ||||
|     VERSION 1.1.1 | ||||
|     VERSION 1.1.2 | ||||
|     LANGUAGES CXX | ||||
| ) | ||||
|  | ||||
| find_package(Calamares 3.2.26 REQUIRED) | ||||
| # On developer's machine, the user package registry breaks | ||||
| # consumers by loading the developer's config from a build | ||||
| # directory (which doesn't have the rest of the config | ||||
| # installed inside it). | ||||
| find_package(Calamares 3.2.26 REQUIRED NO_CMAKE_PACKAGE_REGISTRY) | ||||
| if (NOT TARGET Calamares::calamares OR NOT TARGET Calamares::calamaresui) | ||||
|     message(FATAL_ERROR "Calamares found with missing CMake targets") | ||||
| endif() | ||||
|  | ||||
| find_package(YAMLCPP REQUIRED)  # Needed to untangle some dependencies before Calamares 3.2.36 | ||||
|  | ||||
| @@ -76,16 +95,18 @@ calamares_add_branding_subdirectory( branding/kaos_branding NAME kaos ) | ||||
| # | ||||
| # Add one of more modules, either C++ or Python. | ||||
| # | ||||
| set(SKIPPED_MODULES "") | ||||
| set(LIST_SKIPPED_MODULES "") | ||||
|  | ||||
| calamares_add_module_subdirectory( modules/filekeeper )  # C++ job | ||||
| calamares_add_module_subdirectory( modules/freebsddisk )  # C++ viewmodule | ||||
| calamares_add_module_subdirectory( modules/mobile ) | ||||
| calamares_add_module_subdirectory( modules/slowpython )  # Python job | ||||
| calamares_add_module_subdirectory( modules/filekeeper LIST_SKIPPED_MODULES )  # C++ job | ||||
| calamares_add_module_subdirectory( modules/freebsddisk LIST_SKIPPED_MODULES )  # C++ viewmodule | ||||
| calamares_add_module_subdirectory( modules/mobile LIST_SKIPPED_MODULES ) | ||||
| calamares_add_module_subdirectory( modules/os-freebsd LIST_SKIPPED_MODULES ) | ||||
| calamares_add_module_subdirectory( modules/os-nixos LIST_SKIPPED_MODULES ) | ||||
| calamares_add_module_subdirectory( modules/slowpython LIST_SKIPPED_MODULES )  # Python job | ||||
|  | ||||
| # If modules cannot be built, they usually call a macro | ||||
| # which builds a list of explanations; show that list. | ||||
| calamares_explain_skipped_modules( ${SKIPPED_MODULES} ) | ||||
| calamares_explain_skipped_modules( ${LIST_SKIPPED_MODULES} ) | ||||
|  | ||||
| ### RELEASE SUPPORT | ||||
| # | ||||
|   | ||||
							
								
								
									
										10
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								README.md
									
									
									
									
									
								
							| @@ -172,9 +172,13 @@ phase). | ||||
|  | ||||
| - [mobile](modules/mobile/CMakeLists.txt) is a QML **view** that | ||||
|   takes over a number of other view steps. It is specific to | ||||
|   mobile phone use, possibly specific to PostmarketOS. It does | ||||
|   a number of "welcome to your new phone" things, e.g. | ||||
|   with PostmarketOS installed on a PinePhone. | ||||
|   mobile phone use, and as of writing used by | ||||
|   [postmarketOS](https://postmarketos.org) and | ||||
|   [Mobian](https://mobian-project.org/).  Among other things, it | ||||
|   allows to set up full disk encryption and to configure the | ||||
|   default user's password.  Read the | ||||
|   [on-device installer](https://wiki.postmarketos.org/wiki/On-device_installer) | ||||
|   article for more information. | ||||
|  | ||||
| ### CMake Preparation | ||||
|  | ||||
|   | ||||
| @@ -6,13 +6,9 @@ calamares_add_plugin( mobile | ||||
|     EXPORT_MACRO PLUGINDLLEXPORT_PRO | ||||
|     SOURCES | ||||
|         Config.cpp | ||||
|         Config.h | ||||
|         MobileQmlViewStep.cpp | ||||
|         MobileQmlViewStep.h | ||||
|         PartitionJob.cpp | ||||
|         PartitionJob.h | ||||
|         UsersJob.cpp | ||||
|         UsersJob.h | ||||
|     RESOURCES | ||||
|         mobile.qrc | ||||
|     SHARED_LIB | ||||
|   | ||||
| @@ -25,6 +25,9 @@ Config::setConfigurationMap( const QVariantMap& cfgMap ) | ||||
|     m_userInterface = getString( cfgMap, "userInterface", "(unknown)" ); | ||||
|     m_version = getString( cfgMap, "version", "(unknown)" ); | ||||
|     m_username = getString( cfgMap, "username", "user" ); | ||||
|     m_userPasswordNumeric = getBool( cfgMap, "userPasswordNumeric", true ); | ||||
|  | ||||
|     m_builtinVirtualKeyboard = getBool( cfgMap, "builtinVirtualKeyboard", true ); | ||||
|  | ||||
|     m_featureSshd = getBool( cfgMap, "featureSshd", true ); | ||||
|     m_featureFsType = getBool( cfgMap, "featureFsType", false ); | ||||
|   | ||||
| @@ -10,6 +10,9 @@ | ||||
| class Config : public QObject | ||||
| { | ||||
|     Q_OBJECT | ||||
|     /* installer UI */ | ||||
|     Q_PROPERTY( bool builtinVirtualKeyboard READ builtinVirtualKeyboard CONSTANT FINAL ) | ||||
|  | ||||
|     /* welcome */ | ||||
|     Q_PROPERTY( QString osName READ osName CONSTANT FINAL ) | ||||
|     Q_PROPERTY( QString arch READ arch CONSTANT FINAL ) | ||||
| @@ -20,6 +23,7 @@ class Config : public QObject | ||||
|     /* default user */ | ||||
|     Q_PROPERTY( QString username READ username CONSTANT FINAL ) | ||||
|     Q_PROPERTY( QString userPassword READ userPassword WRITE setUserPassword NOTIFY userPasswordChanged ) | ||||
|     Q_PROPERTY( bool userPasswordNumeric READ userPasswordNumeric CONSTANT FINAL ) | ||||
|  | ||||
|     /* ssh server + credentials */ | ||||
|     Q_PROPERTY( bool featureSshd READ featureSshd CONSTANT FINAL ) | ||||
| @@ -58,6 +62,9 @@ public: | ||||
|     void setConfigurationMap( const QVariantMap& ); | ||||
|     Calamares::JobList createJobs(); | ||||
|  | ||||
|     /* installer UI */ | ||||
|     bool builtinVirtualKeyboard() { return m_builtinVirtualKeyboard; } | ||||
|  | ||||
|     /* welcome */ | ||||
|     QString osName() const { return m_osName; } | ||||
|     QString arch() const { return m_arch; } | ||||
| @@ -69,6 +76,7 @@ public: | ||||
|     QString username() const { return m_username; } | ||||
|     QString userPassword() const { return m_userPassword; } | ||||
|     void setUserPassword( const QString& userPassword ); | ||||
|     bool userPasswordNumeric() const { return m_userPasswordNumeric; } | ||||
|  | ||||
|     /* ssh server + credetials */ | ||||
|     bool featureSshd() { return m_featureSshd; } | ||||
| @@ -117,6 +125,9 @@ public: | ||||
|     QString cmdSshdUseradd() const { return m_cmdSshdUseradd; } | ||||
|  | ||||
| private: | ||||
|     /* installer UI */ | ||||
|     bool m_builtinVirtualKeyboard; | ||||
|  | ||||
|     /* welcome */ | ||||
|     QString m_osName; | ||||
|     QString m_arch; | ||||
| @@ -127,23 +138,24 @@ private: | ||||
|     /* default user */ | ||||
|     QString m_username; | ||||
|     QString m_userPassword; | ||||
|     bool m_userPasswordNumeric; | ||||
|  | ||||
|     /* ssh server + credetials */ | ||||
|     bool m_featureSshd; | ||||
|     /* ssh server + credentials */ | ||||
|     bool m_featureSshd = false; | ||||
|     QString m_sshdUsername; | ||||
|     QString m_sshdPassword; | ||||
|     bool m_isSshEnabled; | ||||
|     bool m_isSshEnabled = false; | ||||
|  | ||||
|     /* full disk encryption */ | ||||
|     QString m_fdePassword = ""; | ||||
|     QString m_fdePassword; | ||||
|     bool m_isFdeEnabled = false; | ||||
|  | ||||
|     /* filesystem selection */ | ||||
|     bool m_featureFsType; | ||||
|     bool m_featureFsType = false; | ||||
|     QString m_defaultFs; | ||||
|     QString m_fsType; | ||||
|     // Index of the currently selected filesystem in UI. | ||||
|     int m_fsIndex; | ||||
|     int m_fsIndex = -1; | ||||
|     QStringList m_fsList; | ||||
|  | ||||
|     /* partition job */ | ||||
|   | ||||
| @@ -11,6 +11,10 @@ | ||||
| ## User Interface name (e.g. Plasma Mobile) | ||||
| # userInterface: "(unknown)" | ||||
|  | ||||
| ## User Interface assumes that the password is numeric (as of writing, this is | ||||
| ## the case with Plasma Mobile and Phosh) | ||||
| # userPasswordNumeric: true | ||||
|  | ||||
| ## OS version | ||||
| # version: "(unknown)" | ||||
|  | ||||
| @@ -64,6 +68,10 @@ | ||||
| ## this gets used without asking the user. | ||||
| # defaultFs: ext4 | ||||
|  | ||||
| ## Start Qt's virtual keyboard within the mobile module. Disable if you bring | ||||
| ## your own virtual keyboard (e.g. svkbd). | ||||
| # builtinVirtualKeyboard: true | ||||
|  | ||||
| ####### | ||||
| ### Commands running in the installer OS | ||||
| ####### | ||||
|   | ||||
| @@ -19,7 +19,7 @@ Page | ||||
|         "welcome": null, /* titlebar disabled */ | ||||
|         "install_target": "Installation target", | ||||
|         "install_target_confirm": "Warning", | ||||
|         "default_pin": "Lockscreen PIN", | ||||
|         "user_pass": "User password", | ||||
|         "ssh_confirm": "SSH server", | ||||
|         "ssh_credentials": "SSH credentials", | ||||
|         "fs_selection": "Root filesystem", | ||||
| @@ -33,8 +33,8 @@ Page | ||||
|          "screens": ["welcome"]}, | ||||
|         {"name": "installTarget", | ||||
|          "screens": ["install_target", "install_target_confirm"]}, | ||||
|         {"name": "userPin", | ||||
|          "screens": ["default_pin"]}, | ||||
|         {"name": "userPassword", | ||||
|          "screens": ["user_pass"]}, | ||||
|         {"name": "sshd", | ||||
|          "screens": ["ssh_confirm", "ssh_credentials"]}, | ||||
|         {"name": "fsType", | ||||
| @@ -46,7 +46,7 @@ Page | ||||
|     ] | ||||
|     property var featureIdByScreen: (function() { | ||||
|         /* Put "features" above into an index of screen name -> feature id: | ||||
|          * featureIdByScreen = {"welcome": 0, "default_pin": 1, ...} */ | ||||
|          * featureIdByScreen = {"welcome": 0, "user_pass": 1, ...} */ | ||||
|         var ret = {}; | ||||
|         for (var i=0; i<features.length; i++) { | ||||
|             for (var j=0; j<features[i]["screens"].length; j++) { | ||||
| @@ -55,8 +55,8 @@ Page | ||||
|         } | ||||
|         return ret; | ||||
|     }()) | ||||
|     /* Only allow characters, that can be typed in with the initramfs on-screen keyboard | ||||
|      * (osk-sdl: see src/keyboard.cpp). FIXME: make configurable, but keep this as default? */ | ||||
|     /* Only allow characters, that can be typed in with osk-sdl | ||||
|      * (src/keyboard.cpp). Details in big comment in validatePassword(). */ | ||||
|      property var allowed_chars: | ||||
|         /* layer 0 */ "abcdefghijklmnopqrstuvwxyz" + | ||||
|         /* layer 1 */ "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + | ||||
| @@ -142,6 +142,7 @@ Page | ||||
|     InputPanel { | ||||
|         id: inputPanel | ||||
|         y: Qt.inputMethod.visible ? parent.height - inputPanel.height : parent.height | ||||
|         visible: config.builtinVirtualKeyboard | ||||
|         anchors.left: parent.left | ||||
|         anchors.right: parent.right | ||||
|     } | ||||
| @@ -183,10 +184,10 @@ Page | ||||
|         timer.start(); | ||||
|     } | ||||
|     function navNextFeature() { | ||||
|         var id = featureIdByScreen[screen] + 1; | ||||
|         var id; | ||||
|  | ||||
|         /* Skip disabled features */ | ||||
|         do { | ||||
|         for (id = featureIdByScreen[screen] + 1; id < features.length; id++) { | ||||
|             /* First letter uppercase */ | ||||
|             var name = features[id]["name"]; | ||||
|             var nameUp = name.charAt(0).toUpperCase() + name.slice(1); | ||||
| @@ -195,7 +196,6 @@ Page | ||||
|             var configOption = "feature" + nameUp; | ||||
|             if (config[configOption] === false) { | ||||
|                 console.log("Skipping feature (disabled in config): " + name); | ||||
|                 id += 1; | ||||
|                 continue; | ||||
|             } | ||||
|  | ||||
| @@ -204,10 +204,11 @@ Page | ||||
|             if (eval("typeof " + funcName) === "function" | ||||
|                 && eval(funcName + "()")) { | ||||
|                 console.log("Skipping feature (skip function): " + name); | ||||
|                 id += 1; | ||||
|                 continue; | ||||
|             } | ||||
|         } while(false); | ||||
|  | ||||
|             break; | ||||
|         } | ||||
|  | ||||
|         console.log("Navigating to feature: " + features[id]["name"]); | ||||
|         return navTo(features[id]["screens"][0]); | ||||
| @@ -252,7 +253,7 @@ Page | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     /* Input validation: user-screens (default_pin, ssh_credentials) */ | ||||
|     /* Input validation: user-screens (user_pass, ssh_credentials) */ | ||||
|     function validatePin(userPin, userPinRepeat, errorText) { | ||||
|         var pin = userPin.text; | ||||
|         var repeat = userPinRepeat.text; | ||||
| @@ -388,11 +389,21 @@ Page | ||||
|         if (pass == "") | ||||
|             return validationFailure(errorText); | ||||
|  | ||||
|         /* This function gets called for the FDE password and for the user | ||||
|          * password. As of writing, all distributions shipping the mobile | ||||
|          * module are using osk-sdl to type in the FDE password after the | ||||
|          * installation, and another keyboard after booting up, to type in the | ||||
|          * user password. The osk-sdl password has the same keys as | ||||
|          * squeekboard's default layout, and other keyboards should be able to | ||||
|          * type these characters in as well. For now, verify that the password | ||||
|          * only contains characters that can be typed in by osk-sdl. If you | ||||
|          * need this to be more sophisticated, feel free to submit patches to | ||||
|          * make this more configurable. */ | ||||
|         if (!check_chars(pass)) | ||||
|             return validationFailure(errorText, | ||||
|                                      "The password must only contain" + | ||||
|                                      " these characters, others cannot be" + | ||||
|                                      " typed in at boot time:\n" + | ||||
|                                      " these characters, others can possibly" + | ||||
|                                      " not be typed in after installation:\n" + | ||||
|                                      "\n" + | ||||
|                                      allowed_chars_multiline()); | ||||
|  | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|   <file>install_target.qml</file> <!-- install from external to internal? --> | ||||
|   <file>install_target_confirm.qml</file> <!-- overwrite internal storage? --> | ||||
|  | ||||
|   <file>default_pin.qml</file> <!-- default user: pin --> | ||||
|   <file>user_pass.qml</file> <!-- default user: password --> | ||||
|   <file>ssh_confirm.qml</file> <!-- sshd: enable or not? --> | ||||
|   <file>ssh_credentials.qml</file> <!-- sshd user: username, password --> | ||||
|   <file>fs_selection.qml</file> <!-- filesystem selection --> | ||||
|   | ||||
| @@ -12,6 +12,17 @@ import QtQuick.Window 2.3 | ||||
| import QtQuick.VirtualKeyboard 2.1 | ||||
| 
 | ||||
| Item { | ||||
|     property var placeholder: (config.userPasswordNumeric | ||||
|                                ? "PIN" | ||||
|                                : "Password") | ||||
|     property var hints: (config.userPasswordNumeric | ||||
|                          ? Qt.ImhDigitsOnly | ||||
|                          : Qt.ImhPreferLowercase) | ||||
|     property var validateFunc: (config.userPasswordNumeric | ||||
|                                 ? validatePin | ||||
|                                 : validatePassword); | ||||
| 
 | ||||
| 
 | ||||
|     anchors.left: parent.left | ||||
|     anchors.top: parent.top | ||||
|     anchors.right: parent.right | ||||
| @@ -25,23 +36,31 @@ Item { | ||||
|         anchors.topMargin: 30 | ||||
|         wrapMode: Text.WordWrap | ||||
| 
 | ||||
|         text: "Set the numeric password of your user. The lockscreen will" + | ||||
|               " ask for this PIN. This is <i>not</i> the PIN of your SIM" + | ||||
|               " card. Make sure to remember it." | ||||
|         text: (function() { | ||||
|             if (config.userPasswordNumeric) { | ||||
|                 return "Set the numeric password of your user. The" + | ||||
|                        " lockscreen will ask for this PIN. This is" + | ||||
|                        " <i>not</i> the PIN of your SIM card. Make sure to" + | ||||
|                        " remember it."; | ||||
|             } else { | ||||
|                 return "Set the password of your user. The lockscreen will" + | ||||
|                       " ask for this password. Make sure to remember it."; | ||||
|             } | ||||
|         }()) | ||||
| 
 | ||||
|         width: 500 | ||||
|     } | ||||
| 
 | ||||
|     TextField { | ||||
|         id: userPin | ||||
|         id: userPass | ||||
|         anchors.top: description.bottom | ||||
|         placeholderText: qsTr("PIN") | ||||
|         placeholderText: qsTr(placeholder) | ||||
|         echoMode: TextInput.Password | ||||
|         onTextChanged: validatePin(userPin, userPinRepeat, errorText) | ||||
|         onTextChanged: validateFunc(userPass, userPassRepeat, errorText) | ||||
|         text: config.userPassword | ||||
| 
 | ||||
|         /* Let the virtual keyboard change to digits only */ | ||||
|         inputMethodHints: Qt.ImhDigitsOnly | ||||
|         inputMethodHints: hints | ||||
|         onActiveFocusChanged: { | ||||
|             if(activeFocus) { | ||||
|                 Qt.inputMethod.update(Qt.ImQueryInput) | ||||
| @@ -54,12 +73,12 @@ Item { | ||||
|     } | ||||
| 
 | ||||
|     TextField { | ||||
|         id: userPinRepeat | ||||
|         anchors.top: userPin.bottom | ||||
|         placeholderText: qsTr("PIN (repeat)") | ||||
|         inputMethodHints: Qt.ImhDigitsOnly | ||||
|         id: userPassRepeat | ||||
|         anchors.top: userPass.bottom | ||||
|         placeholderText: qsTr(placeholder + " (repeat)") | ||||
|         inputMethodHints: hints | ||||
|         echoMode: TextInput.Password | ||||
|         onTextChanged: validatePin(userPin, userPinRepeat, errorText) | ||||
|         onTextChanged: validateFunc(userPass, userPassRepeat, errorText) | ||||
|         text: config.userPassword | ||||
| 
 | ||||
|         anchors.horizontalCenter: parent.horizontalCenter | ||||
| @@ -68,7 +87,7 @@ Item { | ||||
|     } | ||||
| 
 | ||||
|     Text { | ||||
|         anchors.top: userPinRepeat.bottom | ||||
|         anchors.top: userPassRepeat.bottom | ||||
|         id: errorText | ||||
|         visible: false | ||||
|         wrapMode: Text.WordWrap | ||||
| @@ -86,8 +105,8 @@ Item { | ||||
| 
 | ||||
|         text: qsTr("Continue") | ||||
|         onClicked: { | ||||
|             if (validatePin(userPin, userPinRepeat, errorText)) { | ||||
|                 config.userPassword = userPin.text; | ||||
|             if (validateFunc(userPass, userPassRepeat, errorText)) { | ||||
|                 config.userPassword = userPass.text; | ||||
|                 navNext(); | ||||
|             } | ||||
|         } | ||||
							
								
								
									
										20
									
								
								modules/os-freebsd/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								modules/os-freebsd/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| # The OS-FreeBSD module does "all the things" in a FreeBSD installation. | ||||
| # Since the other modules -- users, fstab, grub, pretty much all of them | ||||
| # -- are Linux-specific, it doesn't make much sense to fork each of them | ||||
| # or provide alternatives, so instead we have one module that completes | ||||
| # a FreeBSD installation based on the GlobalStorage values set by | ||||
| # Calamares viewmodules. | ||||
| # | ||||
| #   SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org> | ||||
| #   SPDX-License-Identifier: GPL-3.0-or-later | ||||
| #   License-Filename: LICENSE | ||||
| # | ||||
|  | ||||
| calamares_add_plugin( os-freebsd | ||||
|     TYPE job | ||||
|     EXPORT_MACRO PLUGINDLLEXPORT_PRO | ||||
|     SOURCES | ||||
|         FreeBSDJob.cpp | ||||
|     SHARED_LIB | ||||
|     NO_CONFIG | ||||
| ) | ||||
							
								
								
									
										58
									
								
								modules/os-freebsd/FreeBSDJob.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								modules/os-freebsd/FreeBSDJob.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,58 @@ | ||||
| /* === This file is part of Calamares - <https://github.com/calamares> === | ||||
|  * | ||||
|  *   SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org> | ||||
|  *   SPDX-License-Identifier: GPL-3.0-or-later | ||||
|  *   License-Filename: LICENSE | ||||
|  */ | ||||
|  | ||||
| #include "FreeBSDJob.h" | ||||
|  | ||||
| #include "CalamaresVersion.h" | ||||
| #include "GlobalStorage.h" | ||||
| #include "JobQueue.h" | ||||
| #include "utils/Logger.h" | ||||
|  | ||||
| #include <QDateTime> | ||||
| #include <QProcess> | ||||
| #include <QThread> | ||||
|  | ||||
|  | ||||
| FreeBSDJob::FreeBSDJob( QObject* parent ) | ||||
|     : Calamares::CppJob( parent ) | ||||
| { | ||||
| } | ||||
|  | ||||
|  | ||||
| FreeBSDJob::~FreeBSDJob() {} | ||||
|  | ||||
|  | ||||
| QString | ||||
| FreeBSDJob::prettyName() const | ||||
| { | ||||
|     return tr( "FreeBSD Installation Job" ); | ||||
| } | ||||
|  | ||||
| Calamares::JobResult | ||||
| FreeBSDJob::exec() | ||||
| { | ||||
|     emit progress( 0.1 ); | ||||
|     cDebug() << "[FREEBSD]"; | ||||
|  | ||||
|     Calamares::JobQueue::instance()->globalStorage()->debugDump(); | ||||
|     emit progress( 0.5 ); | ||||
|  | ||||
|     QThread::sleep( 3 ); | ||||
|     emit progress( 1.0 ); | ||||
|  | ||||
|     return Calamares::JobResult::ok(); | ||||
| } | ||||
|  | ||||
|  | ||||
| void | ||||
| FreeBSDJob::setConfigurationMap( const QVariantMap& configurationMap ) | ||||
| { | ||||
|     // TODO: actually fetch something from that configuration | ||||
|     m_configurationMap = configurationMap; | ||||
| } | ||||
|  | ||||
| CALAMARES_PLUGIN_FACTORY_DEFINITION( FreeBSDJobFactory, registerPlugin< FreeBSDJob >(); ) | ||||
							
								
								
									
										39
									
								
								modules/os-freebsd/FreeBSDJob.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								modules/os-freebsd/FreeBSDJob.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,39 @@ | ||||
| /* === This file is part of Calamares - <https://github.com/calamares> === | ||||
|  * | ||||
|  *   SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org> | ||||
|  *   SPDX-License-Identifier: GPL-3.0-or-later | ||||
|  *   License-Filename: LICENSE | ||||
|  */ | ||||
|  | ||||
| #ifndef FREEBSDJOB_H | ||||
| #define FREEBSDJOB_H | ||||
|  | ||||
| #include "CppJob.h" | ||||
| #include "DllMacro.h" | ||||
| #include "utils/PluginFactory.h" | ||||
|  | ||||
| #include <QObject> | ||||
| #include <QVariantMap> | ||||
|  | ||||
|  | ||||
| class PLUGINDLLEXPORT FreeBSDJob : public Calamares::CppJob | ||||
| { | ||||
|     Q_OBJECT | ||||
|  | ||||
| public: | ||||
|     explicit FreeBSDJob( QObject* parent = nullptr ); | ||||
|     virtual ~FreeBSDJob() override; | ||||
|  | ||||
|     QString prettyName() const override; | ||||
|  | ||||
|     Calamares::JobResult exec() override; | ||||
|  | ||||
|     void setConfigurationMap( const QVariantMap& configurationMap ) override; | ||||
|  | ||||
| private: | ||||
|     QVariantMap m_configurationMap; | ||||
| }; | ||||
|  | ||||
| CALAMARES_PLUGIN_FACTORY_DECLARATION( FreeBSDJobFactory ) | ||||
|  | ||||
| #endif  // FREEBSDJOB_H | ||||
							
								
								
									
										83
									
								
								modules/os-nixos/main.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								modules/os-nixos/main.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,83 @@ | ||||
| #!/usr/bin/env python3 | ||||
| # -*- coding: utf-8 -*- | ||||
| # | ||||
| # === This file is part of Calamares - <https://github.com/calamares> === | ||||
| # | ||||
| #   Calamares is free software: you can redistribute it and/or modify | ||||
| #   it under the terms of the GNU General Public License as published by | ||||
| #   the Free Software Foundation, either version 3 of the License, or | ||||
| #   (at your option) any later version. | ||||
| # | ||||
| #   Calamares is distributed in the hope that it will be useful, | ||||
| #   but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| #   GNU General Public License for more details. | ||||
| # | ||||
| #   You should have received a copy of the GNU General Public License | ||||
| #   along with Calamares. If not, see <http://www.gnu.org/licenses/>. | ||||
| # | ||||
| #   SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org> | ||||
| #   SPDX-License-Identifier: GPL-3.0-or-later | ||||
| #   License-Filename: LICENSE | ||||
| # | ||||
|  | ||||
| """ | ||||
| === NixOS Configuration | ||||
|  | ||||
| NixOS has its own "do all the things" configuration file which | ||||
| declaratively handles what things need to be done in the target | ||||
| system, and it has an existing tool to "execute" that declarative | ||||
| specification. This module takes configuration values set by | ||||
| Calamares viewmodules (e.g. the users module) and puts | ||||
| them into the configuration file in the target system, | ||||
| and then runs the necessary NixOS specific tools. | ||||
| """ | ||||
|  | ||||
| import libcalamares | ||||
| import os | ||||
| from time import gmtime, strftime, sleep | ||||
|  | ||||
| import gettext | ||||
| _ = gettext.translation("calamares-python", | ||||
|                         localedir=libcalamares.utils.gettext_path(), | ||||
|                         languages=libcalamares.utils.gettext_languages(), | ||||
|                         fallback=True).gettext | ||||
|  | ||||
|  | ||||
| def pretty_name(): | ||||
|     return _("NixOS Configuration.") | ||||
|  | ||||
|  | ||||
| def run(): | ||||
|     """NixOS Configuration.""" | ||||
|     libcalamares.utils.debug("LocaleDir=" + | ||||
|                              str(libcalamares.utils.gettext_path())) | ||||
|     libcalamares.utils.debug("Languages=" + | ||||
|                              str(libcalamares.utils.gettext_languages())) | ||||
|  | ||||
|     # TODO: probably want to use the job configuration | ||||
|     #       with a key "stage" to distinguish generate-config | ||||
|     #       from execute-config; maybe it wants an "all" as well | ||||
|     #       to do both. | ||||
|     accumulator = "*** Job configuration\n" | ||||
|     accumulator += str(libcalamares.job.configuration) | ||||
|     libcalamares.utils.debug(accumulator) | ||||
|  | ||||
|     accumulator = "*** GlobalStorage configuration\n" | ||||
|     accumulator += "count: " + str(libcalamares.globalstorage.count()) + "\n" | ||||
|     accumulator += "keys: {}\n".format(str(libcalamares.globalstorage.keys())) | ||||
|     libcalamares.utils.debug(accumulator) | ||||
|  | ||||
|     libcalamares.utils.debug("Run NixOS tools.") | ||||
|  | ||||
|     libcalamares.job.setprogress( 0.1 ) | ||||
|     sleep(1) | ||||
|     libcalamares.job.setprogress( 0.5 ) | ||||
|     sleep(1) | ||||
|     libcalamares.job.setprogress( 1.0 ) | ||||
|  | ||||
|     sleep(3) | ||||
|  | ||||
|     # To indicate an error, return a tuple of: | ||||
|     # (message, detailed-error-message) | ||||
|     return None | ||||
							
								
								
									
										5
									
								
								modules/os-nixos/module.desc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								modules/os-nixos/module.desc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| --- | ||||
| type:       "job" | ||||
| name:       "os-nixos" | ||||
| interface:  "python" | ||||
| script:     "main.py" | ||||
		Reference in New Issue
	
	Block a user