From 81631ed23c8f2abc2d318f191fce6fdbbdc25151 Mon Sep 17 00:00:00 2001 From: Twilighttony Date: Thu, 30 Sep 2021 22:03:01 -0400 Subject: [PATCH] New Package: Calamares-3.2.44.3 --- .../files/49-nopasswd-calamares.rules | 8 + .../calamares/patches/services-runit.patch | 227 ++++++++++++++++++ srcpkgs/calamares/template | 38 +++ 3 files changed, 273 insertions(+) create mode 100644 srcpkgs/calamares/files/49-nopasswd-calamares.rules create mode 100644 srcpkgs/calamares/patches/services-runit.patch create mode 100644 srcpkgs/calamares/template diff --git a/srcpkgs/calamares/files/49-nopasswd-calamares.rules b/srcpkgs/calamares/files/49-nopasswd-calamares.rules new file mode 100644 index 000000000000..c152890aabd7 --- /dev/null +++ b/srcpkgs/calamares/files/49-nopasswd-calamares.rules @@ -0,0 +1,8 @@ +/* Allow Calamares to be started without password authentication + */ +polkit.addRule(function(action, subject) { + if ((action.id == "com.github.calamares.calamares.pkexec.run")) + { + return polkit.Result.YES; + } +}); diff --git a/srcpkgs/calamares/patches/services-runit.patch b/srcpkgs/calamares/patches/services-runit.patch new file mode 100644 index 000000000000..158296115783 --- /dev/null +++ b/srcpkgs/calamares/patches/services-runit.patch @@ -0,0 +1,227 @@ +From 1eb51f4ec5f4f3c601d0100bba01b836b67e649d Mon Sep 17 00:00:00 2001 +From: artoo +Date: Wed, 9 Dec 2020 00:16:52 +0100 +Subject: [PATCH] add services-runit + +--- + src/modules/services-runit/main.py | 144 ++++++++++++++++++ + src/modules/services-runit/module.desc | 5 + + .../services-runit/services-runit.conf | 44 ++++++ + 3 files changed, 193 insertions(+) + create mode 100644 src/modules/services-runit/main.py + create mode 100644 src/modules/services-runit/module.desc + create mode 100644 src/modules/services-runit/services-runit.conf + +diff --git a/src/modules/services-runit/main.py b/src/modules/services-runit/main.py +new file mode 100644 +index 000000000..8b616191d +--- /dev/null ++++ b/src/modules/services-runit/main.py +@@ -0,0 +1,144 @@ ++#!/usr/bin/env python3 ++# -*- coding: utf-8 -*- ++# ++# === This file is part of Calamares - === ++# ++# Copyright 2018-2019, Adriaan de Groot ++# Copyright 2019, Artoo ++# ++# Calamares is free software: you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation, either version 3 of the License, or ++# (at your option) any later version. ++# ++# Calamares is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with Calamares. If not, see . ++ ++import libcalamares ++ ++from libcalamares.utils import target_env_call, warning ++from os.path import exists, join ++ ++ ++import gettext ++_ = gettext.translation("calamares-python", ++ localedir=libcalamares.utils.gettext_path(), ++ languages=libcalamares.utils.gettext_languages(), ++ fallback=True).gettext ++ ++ ++def pretty_name(): ++ return _("Configure Runit services") ++ ++ ++class RunitController: ++ """ ++ This is the runit service controller. ++ All of its state comes from global storage and the job ++ configuration at initialization time. ++ """ ++ ++ def __init__(self): ++ self.root = libcalamares.globalstorage.value('rootMountPoint') ++ ++ # Translate the entries in the config to the actions passed to sv-helper ++ self.services = dict() ++ self.services["enable"] = libcalamares.job.configuration.get('services', []) ++ self.services["disable"] = libcalamares.job.configuration.get('disable', []) ++ ++ self.svDir = libcalamares.job.configuration['svDir'] ++ self.runsvDir = libcalamares.job.configuration['runsvDir'] ++ ++ ++ def make_failure_description(self, state, name, runlevel): ++ """ ++ Returns a generic "could not " failure message, specialized ++ for the action @p state and the specific service @p name in @p runlevel. ++ """ ++ if state == "enable": ++ description = _("Cannot enable service {name!s} to run-level {level!s}.") ++ elif state == "disable": ++ description = _("Cannot disable service {name!s} from run-level {level!s}.") ++ else: ++ description = _("Unknown service-action {arg!s} for service {name!s} in run-level {level!s}.") ++ ++ return description.format(arg=state, name=name, level=runlevel) ++ ++ ++ def update(self, state): ++ """ ++ Call sv-helper for each service listed ++ in services for the given @p state. ++ """ ++ ++ for svc in self.services.get(state, []): ++ if isinstance(svc, str): ++ name = svc ++ runlevel = "default" ++ mandatory = False ++ else: ++ name = svc["name"] ++ runlevel = svc.get("runlevel", "default") ++ mandatory = svc.get("mandatory", False) ++ ++ service_path = self.root + self.svDir + "/" + name ++ runlevel_path = self.root + self.runsvDir + "/" + runlevel ++ src = self.svDir + "/" + name ++ dest = self.runsvDir + "/" + runlevel + "/" ++ ++ if state == 'enable': ++ cmd = ["ln", "-sv", src, dest] ++ elif state == 'disable': ++ cmd = ["rm", "-rv", dest] ++ ++ if exists(service_path): ++ if exists(runlevel_path): ++ ec = target_env_call(cmd) ++ if ec != 0: ++ warning("Cannot {} service {} to {}".format(state, name, runlevel)) ++ warning("{} returned error code {!s}".format(cmd, ec)) ++ if mandatory: ++ title = _("Cannot modify service") ++ diagnostic = _("cmd {arg!s} call in chroot returned error code {num!s}.").format(arg=state, num=ec) ++ return (title, ++ self.make_failure_description(state, name, runlevel) + " " + diagnostic ++ ) ++ else: ++ warning("Target runlevel {} does not exist for {}.".format(runlevel, name)) ++ if mandatory: ++ title = _("Target runlevel does not exist") ++ diagnostic = _("The path for runlevel {level!s} is {path!s}, which does not exist.").format(level=runlevel, path=runlevel_path) ++ ++ return (title, ++ self.make_failure_description(state, name, runlevel) + " " + diagnostic ++ ) ++ else: ++ warning("Target service {} does not exist in {}.".format(name, self.svDir)) ++ if mandatory: ++ title = _("Target service does not exist") ++ diagnostic = _("The path for service {name!s} is {path!s}, which does not exist.").format(name=name, path=service_path) ++ return (title, ++ self.make_failure_description(state, name, runlevel) + " " + diagnostic ++ ) ++ ++ ++ def run(self): ++ """Run the controller ++ """ ++ ++ for state in ("enable", "disable"): ++ r = self.update(state) ++ if r is not None: ++ return r ++ ++def run(): ++ """ ++ Setup services ++ """ ++ ++ return RunitController().run() +diff --git a/src/modules/services-runit/module.desc b/src/modules/services-runit/module.desc +new file mode 100644 +index 000000000..29737c13e +--- /dev/null ++++ b/src/modules/services-runit/module.desc +@@ -0,0 +1,5 @@ ++--- ++type: "job" ++name: "services-runit" ++interface: "python" ++script: "main.py" +diff --git a/src/modules/services-runit/services-runit.conf b/src/modules/services-runit/services-runit.conf +new file mode 100644 +index 000000000..04476b107 +--- /dev/null ++++ b/src/modules/services-runit/services-runit.conf +@@ -0,0 +1,44 @@ ++# runit services module to modify service runlevels via symlinks in the chroot ++# ++# Services can be added (to any runlevel, or multiple runlevels) or deleted. ++# Handle disable with care and only use it if absolutely necessary. ++# ++# if a service is listed in the conf but is not present/detected on the target system, ++# or a runlevel does not exist, it will be ignored and skipped; a warning is logged. ++# ++--- ++# svDir: holds the runit service directory location ++svDir: /etc/runit/sv ++ ++# runsvDir: holds the runlevels directory location ++runsvDir: /etc/runit/runsvdir ++ ++# services: a list of entries to **enable** ++# disable: a list of entries to **disable** ++# ++# Each entry has three fields: ++# - name: the service name ++# - (optional) runlevel: can hold any runlevel present on the target ++# system; if no runlevel is provided, "default" is assumed. ++# - (optional) mandatory: if set to true, a failure to modify ++# the service will result in installation failure, rather than just ++# a warning. The default is false. ++# ++# an entry may also be a single string, which is interpreted ++# as the name field (runlevel "default" is assumed then, and not-mandatory). ++# ++# # Example services and disable settings: ++# # - add foo1 to default, but it must succeed ++# # - add foo2 to nonetwork ++# # - remove foo3 from default ++# # - remove foo4 from default ++# services: ++# - name: foo1 ++# mandatory: true ++# - name: foo2 ++# runlevel: nonetwork ++# disable: ++# - name: foo3 ++# - foo4 ++services: [] ++disable: [] +-- +2.29.2 diff --git a/srcpkgs/calamares/template b/srcpkgs/calamares/template new file mode 100644 index 000000000000..870a61663ffb --- /dev/null +++ b/srcpkgs/calamares/template @@ -0,0 +1,38 @@ +# Template file for 'calamares' +pkgname=calamares +version=3.2.44.3 +revision=1 +build_style=cmake +configure_args="-DCMAKE_BUILD_TYPE=Release + -DCMAKE_INSTALL_PREFIX=/usr + -DCMAKE_INSTALL_LIBDIR=lib + -DWITH_PYTHONQT:BOOL=ON + -DINSTALL_CONFIG:BOOL=ON + -DINSTALL_POLKIT:BOOL=ON + -DBoost_NO_BOOST_CMAKE=ON + -DSKIP_MODULES='webview;interactiveterminal;services-systemd;dummyprocess;dummypython;dummycpp;dummypythonqt'" +hostmakedepends="git extra-cmake-modules pkg-config gettext + ckbcomp kcoreaddons kdelibs4support python3-QtPy libpwquality + AppStream-qt python3-yaml python3-jsonschema" +makedepends="python3-devel python3-jsonschema yaml-cpp-devel python3-yaml boost-devel qt5-devel python3-devel kpmcore-devel + qt5-tools qt5-translations boost boost-python3-1.72 python3-QtPy qt5-svg-devel + libpwquality qt5-webengine AppStream-qt plasma-framework-devel qt5-webengine" +depends="kconfig kcoreaddons kiconthemes ki18n kio ksolid yaml-cpp kpmcore boost ckbcomp + hardinfo qt5-svg polkit-qt5 gtk-update-icon-cache plasma-framework qt5-xmlpatterns + squashfs-tools libpwquality AppStream-qt icu" +short_desc="Distribution-independent installer framework" +maintainer="Twilighttony " +license="GPL-3.0-or-later" +homepage="https://calamares.io" +distfiles="https://github.com/${pkgname}/${pkgname}/archive/refs/tags/v${version}.tar.gz" +checksum=a7772d50baf35cfb7d74db3c0a46fb72a74e069a78a8e984c2ed1d115abc944c + +pre_configure() { + vsed -i -e "s/desired_size = 512 \* 1024 \* 1024 \# 512MiB/desired_size = 512 \* 1024 \* 1024 \* 4 \# 2048MiB/" src/modules/fstab/main.py + vsed -i -e 's/"Install configuration files" OFF/"Install configuration files" ON/' CMakeLists.txt +} + +post_install() { + vmkdir etc/polkit-1/rules.d/ + vinstall ${FILESDIR}/49-nopasswd-calamares.rules 644 etc/polkit-1/rules.d/ +}