Compare commits
6 Commits
v3.3.0
...
services-s
Author | SHA1 | Date | |
---|---|---|---|
abf3b69766 | |||
![]() |
115f00f5cd | ||
![]() |
e73f5fb9fe | ||
![]() |
cd0a381a35 | ||
![]() |
709296940c | ||
![]() |
00821945c5 |
12
CHANGES-3.3
12
CHANGES-3.3
@@ -8,6 +8,18 @@ changelog -- this log starts with version 3.3.0. See CHANGES-3.2 for
|
||||
the history of the 3.2 series (2018-05 - 2022-08).
|
||||
|
||||
|
||||
# 3.3.1 (unreleased)
|
||||
|
||||
This release contains contributions from (alphabetically by first name):
|
||||
- Nobody yet!
|
||||
|
||||
## Core ##
|
||||
- No changes of note.
|
||||
|
||||
## Modules ##
|
||||
- No changes of note.
|
||||
|
||||
|
||||
# 3.3.0 (2023-12-12)
|
||||
|
||||
This release contains contributions from (alphabetically by first name):
|
||||
|
@@ -47,8 +47,8 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
|
||||
|
||||
set(CALAMARES_VERSION 3.3.0)
|
||||
set(CALAMARES_RELEASE_MODE ON) # Set to ON during a release
|
||||
set(CALAMARES_VERSION 3.3.1)
|
||||
set(CALAMARES_RELEASE_MODE OFF) # Set to ON during a release
|
||||
|
||||
if(CMAKE_SCRIPT_MODE_FILE)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/CMakeModules/ExtendedVersion.cmake)
|
||||
@@ -513,6 +513,7 @@ if(NOT CALAMARES_RELEASE_MODE)
|
||||
list(APPEND CALAMARES_TRANSLATION_LANGUAGES ${_tx_incomplete})
|
||||
endif()
|
||||
list(SORT CALAMARES_TRANSLATION_LANGUAGES)
|
||||
list(REMOVE_DUPLICATES CALAMARES_TRANSLATION_LANGUAGES)
|
||||
|
||||
add_subdirectory(lang) # i18n tools
|
||||
|
||||
|
@@ -43,4 +43,8 @@ zypper --non-interactive in \
|
||||
|
||||
# Not actual dependencies, but good to have
|
||||
zypper --non-interactive in python311-PyYAML python311-jsonschema
|
||||
# vi to edit things inside the docker
|
||||
zypper --non-interactive in vim
|
||||
# noto so that running Calamares in the docker is readable
|
||||
zypper --non-interactive in noto-sans-fonts
|
||||
true
|
||||
|
@@ -378,7 +378,7 @@ LocaleTests::testTZLookup()
|
||||
|
||||
QVERIFY( zones.find( "America", "New_York" ) );
|
||||
QCOMPARE( zones.find( "America", "New_York" )->zone(), QStringLiteral( "New_York" ) );
|
||||
QCOMPARE( zones.find( "America", "New_York" )->tr(), QStringLiteral( "New York" ) );
|
||||
QCOMPARE( zones.find( "America", "New_York" )->translated(), QStringLiteral( "New York" ) );
|
||||
|
||||
QVERIFY( !zones.find( "Europe", "New_York" ) );
|
||||
QVERIFY( !zones.find( "America", "New York" ) );
|
||||
|
@@ -76,7 +76,7 @@ TimeZoneData::TimeZoneData( const QString& region,
|
||||
}
|
||||
|
||||
QString
|
||||
TimeZoneData::tr() const
|
||||
TimeZoneData::translated() const
|
||||
{
|
||||
// NOTE: context name must match what's used in zone-extractor.py
|
||||
return QObject::tr( m_human, "tz_names" );
|
||||
@@ -86,11 +86,11 @@ class RegionData : public TranslatableString
|
||||
{
|
||||
public:
|
||||
using TranslatableString::TranslatableString;
|
||||
QString tr() const override;
|
||||
QString translated() const override;
|
||||
};
|
||||
|
||||
QString
|
||||
RegionData::tr() const
|
||||
RegionData::translated() const
|
||||
{
|
||||
// NOTE: context name must match what's used in zone-extractor.py
|
||||
return QObject::tr( m_human, "tz_regions" );
|
||||
@@ -276,7 +276,7 @@ RegionsModel::data( const QModelIndex& index, int role ) const
|
||||
const auto& region = m_private->m_regions[ index.row() ];
|
||||
if ( role == NameRole )
|
||||
{
|
||||
return region->tr();
|
||||
return region->translated();
|
||||
}
|
||||
if ( role == KeyRole )
|
||||
{
|
||||
@@ -292,13 +292,13 @@ RegionsModel::roleNames() const
|
||||
}
|
||||
|
||||
QString
|
||||
RegionsModel::tr( const QString& region ) const
|
||||
RegionsModel::translated( const QString& region ) const
|
||||
{
|
||||
for ( const auto* p : m_private->m_regions )
|
||||
{
|
||||
if ( p->key() == region )
|
||||
{
|
||||
return p->tr();
|
||||
return p->translated();
|
||||
}
|
||||
}
|
||||
return region;
|
||||
@@ -330,7 +330,7 @@ ZonesModel::data( const QModelIndex& index, int role ) const
|
||||
switch ( role )
|
||||
{
|
||||
case NameRole:
|
||||
return zone->tr();
|
||||
return zone->translated();
|
||||
case KeyRole:
|
||||
return zone->key();
|
||||
case RegionRole:
|
||||
|
@@ -48,7 +48,7 @@ class TimeZoneData : public QObject, TranslatableString
|
||||
|
||||
Q_PROPERTY( QString region READ region CONSTANT )
|
||||
Q_PROPERTY( QString zone READ zone CONSTANT )
|
||||
Q_PROPERTY( QString name READ tr CONSTANT )
|
||||
Q_PROPERTY( QString name READ translated CONSTANT )
|
||||
Q_PROPERTY( QString countryCode READ country CONSTANT )
|
||||
|
||||
public:
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
TimeZoneData( const TimeZoneData& ) = delete;
|
||||
TimeZoneData( TimeZoneData&& ) = delete;
|
||||
|
||||
QString tr() const override;
|
||||
QString translated() const override;
|
||||
|
||||
QString region() const { return m_region; }
|
||||
QString zone() const { return key(); }
|
||||
@@ -106,7 +106,7 @@ public Q_SLOTS:
|
||||
* Returns @p region unchanged if there is no such region
|
||||
* or no translation for the region's name.
|
||||
*/
|
||||
QString tr( const QString& region ) const;
|
||||
QString translated( const QString& region ) const;
|
||||
|
||||
private:
|
||||
Private* m_private;
|
||||
|
@@ -41,7 +41,7 @@ public:
|
||||
virtual ~TranslatableString();
|
||||
|
||||
/// @brief Give the localized human-readable form
|
||||
virtual QString tr() const = 0;
|
||||
virtual QString translated() const = 0;
|
||||
QString key() const { return m_key; }
|
||||
|
||||
bool operator==( const TranslatableString& other ) const { return m_key == other.m_key; }
|
||||
|
@@ -73,7 +73,9 @@ ExecutionViewStep::ExecutionViewStep( QObject* parent )
|
||||
{
|
||||
m_widget->setObjectName( "slideshow" );
|
||||
m_progressBar->setObjectName( "exec-progress" );
|
||||
m_progressBar->setFormat( tr( "%p%", "Progress percentage indicator: %p is where the number 0..100 is placed" ) );
|
||||
CALAMARES_RETRANSLATE(
|
||||
m_progressBar->setFormat( tr( "%p%", "Progress percentage indicator: %p is where the number 0..100 is placed" ) );
|
||||
);
|
||||
m_label->setObjectName( "exec-message" );
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout( m_widget );
|
||||
|
@@ -390,7 +390,7 @@ Config::currentTimezoneName() const
|
||||
{
|
||||
if ( m_currentLocation )
|
||||
{
|
||||
return m_regionModel->tr( m_currentLocation->region() ) + '/' + m_currentLocation->tr();
|
||||
return m_regionModel->translated( m_currentLocation->region() ) + '/' + m_currentLocation->translated();
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
@@ -144,7 +144,7 @@ TimeZoneWidget::paintEvent( QPaintEvent* )
|
||||
#else
|
||||
auto textwidth = [ & ]( const QString& s ) { return fontMetrics.width( s ); };
|
||||
#endif
|
||||
const int textWidth = textwidth( m_currentLocation ? m_currentLocation->tr() : QString() );
|
||||
const int textWidth = textwidth( m_currentLocation ? m_currentLocation->translated() : QString() );
|
||||
const int textHeight = fontMetrics.height();
|
||||
|
||||
QRect rect = QRect( point.x() - textWidth / 2 - 5, point.y() - textHeight - 8, textWidth + 10, textHeight - 2 );
|
||||
@@ -170,7 +170,7 @@ TimeZoneWidget::paintEvent( QPaintEvent* )
|
||||
painter.setBrush( QColor( 40, 40, 40 ) );
|
||||
painter.drawRoundedRect( rect, 3, 3 );
|
||||
painter.setPen( Qt::white );
|
||||
painter.drawText( rect.x() + 5, rect.bottom() - 4, m_currentLocation ? m_currentLocation->tr() : QString() );
|
||||
painter.drawText( rect.x() + 5, rect.bottom() - 4, m_currentLocation ? m_currentLocation->translated() : QString() );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
101
src/modules/services-s6/main.py
Normal file
101
src/modules/services-s6/main.py
Normal file
@@ -0,0 +1,101 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# === This file is part of Calamares - <https://github.com/calamares> ===
|
||||
#
|
||||
# Copyright 2018-2019, Adriaan de Groot <groot@kde.org>
|
||||
# Copyright 2019, Artoo <artoo@artixlinux.org>
|
||||
#
|
||||
# Calamares is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# 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/>.
|
||||
|
||||
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 s6 services")
|
||||
|
||||
|
||||
class S6Controller:
|
||||
"""
|
||||
This is the s6 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')
|
||||
|
||||
self.svDir = libcalamares.job.configuration['svDir']
|
||||
self.dbDir = libcalamares.job.configuration['dbDir']
|
||||
self.defaultBundle = libcalamares.job.configuration['defaultBundle']
|
||||
|
||||
self.services = dict()
|
||||
self.services["add"] = libcalamares.job.configuration.get('services', [])
|
||||
self.services["delete"] = libcalamares.job.configuration.get('disable', [])
|
||||
|
||||
|
||||
def makeBundle(self):
|
||||
"""
|
||||
Call s6-rc-bundle with each service listed
|
||||
in services as arg.
|
||||
"""
|
||||
|
||||
deleteBundles = self.services.get("delete", [])
|
||||
|
||||
if deleteBundles:
|
||||
ec = target_env_call(["s6-rc-bundle", "-c", self.dbDir, "delete", *deleteBundles])
|
||||
if ec != 0:
|
||||
warning("Cannot delete {}".format(*deleteBundles))
|
||||
warning("s6-rc-bundle returned error code {!s}".format(ec))
|
||||
|
||||
for svc in self.services.get('add', []):
|
||||
ec = target_env_call(["s6-rc-db", "-c", self.dbDir, "type", svc])
|
||||
if ec != 0:
|
||||
warning("Service {} does not exist.".format(svc))
|
||||
warning("s6-rc-db returned error code {!s}".format(ec))
|
||||
else:
|
||||
ec = target_env_call(["s6-service", "add", self.defaultBundle, svc])
|
||||
if ec != 0:
|
||||
warning("Cannot add service {} to {} bundle".format(svc, self.defaultBundle))
|
||||
warning("s6-service returned error code {!s}".format(ec))
|
||||
|
||||
ec = target_env_call(["s6-db-reload", "-r"])
|
||||
if ec != 0:
|
||||
warning("Cannot reload service db.")
|
||||
warning("s6-db-reload returned error code {!s}".format(ec))
|
||||
|
||||
def run(self):
|
||||
"""Run the controller
|
||||
"""
|
||||
|
||||
r = self.makeBundle()
|
||||
if r is not None:
|
||||
return r
|
||||
|
||||
def run():
|
||||
"""
|
||||
Setup services
|
||||
"""
|
||||
|
||||
return S6Controller().run()
|
5
src/modules/services-s6/module.desc
Normal file
5
src/modules/services-s6/module.desc
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
type: "job"
|
||||
name: "services-s6"
|
||||
interface: "python"
|
||||
script: "main.py"
|
33
src/modules/services-s6/services-s6.conf
Normal file
33
src/modules/services-s6/services-s6.conf
Normal file
@@ -0,0 +1,33 @@
|
||||
# s6 services module to create a services bundle via s6-rc-bundle in the chroot
|
||||
#
|
||||
# Services can be added to default bundle
|
||||
# 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,
|
||||
# it will be ignored and skipped; a warning is logged.
|
||||
#
|
||||
---
|
||||
|
||||
# services path
|
||||
svDir: /etc/s6/sv
|
||||
|
||||
# database path
|
||||
dbDir: /etc/s6/rc/compiled
|
||||
|
||||
# default bundle name
|
||||
defaultBundle: default
|
||||
|
||||
# services: a list of services to **add** to the default bundle
|
||||
# disable: a list of bundles to **delete**
|
||||
#
|
||||
# Each entry:
|
||||
# - the name
|
||||
# # Example services and disable settings:
|
||||
# services:
|
||||
# - foo1
|
||||
# - foo2
|
||||
# disable:
|
||||
# - foo3
|
||||
# - foo4
|
||||
services: []
|
||||
disable: []
|
Reference in New Issue
Block a user