📜 ⬆️ ⬇️

Desktop Setup in Calculate Linux 11.9

In the new version of the Calculate Linux 11.9 distribution, the user profile setting method has changed. In this article I want to describe the process on the example of Calculate Linux Desktop, highlighting the main points.

Calculate Linux Desktop KDECalculate Linux Desktop GNOMECalculate Linux Desktop XFCE


Calculate Utility Packages


Calculate utilities written in Python fulfill the entire burden of work, not only on installation, but also on setting up the system. The 'calculate-desktop' package is responsible for setting the user profile. Unlike other utilities, it can make settings not only for system files, but also for user files (within the home directory). Example:
')
# cl-desktop alex
* alex ...


Setup is done using utility templates, but more on that below.

Calculate utility variables


Calculate utility packages have sets of their own variables. Calculate-desktop includes user session variable settings. You can view them by running the command 'cl-desktop -v'. Example:
# cl-desktop -v alex
...
os_linux_name [r] Calculate Linux Desktop
os_linux_shortname [r] CLD
os_linux_subname [r] KDE
os_linux_ver [r] 11.9
os_locale_lang [r] ru_RU
os_locale_language [r] ru
os_locale_xkb [r] us,ru(winkeys)
os_locale_xkbname [r] us,ru
os_net_hostname [w] calculate
os_root_type [r] hdd
os_x11_composite [r] on
os_x11_height [w] 1050
os_x11_standart [r] 1680x1050
os_x11_video_drv [r] nvidia
os_x11_width [w] 1680
ur_fullname [r]
ur_group [r] family
ur_home_path [r] /home/alex
ur_jid [r]
ur_login [r] alex
ur_mail [r]
...

Variable names necessarily include type and purpose. Variables are directly involved in customization, their value can be substituted into the configuration file or used in conditional expressions.

Calculate utility templates


A few years ago, as part of a project to create a new website engine, Calculate Next, a number of methods were written to convert text with markup to XML format and back. Despite the fact that the engine was never completed, many developments were included in other projects, in particular, in Calculate Utilities 2.

It is known that in most cases it is enough to change several parameters of the configuration file so that the service or application will work according to your requirements. This rule is taken as the basis for the work of templates that understand most of the popular configuration file formats, including apache, bind, compiz, dhcp, dovecot, kde, ldap, openrc, plasma, postfix, procmail, proftpd, samba, squid, xml_gconf, xml_gconf_tree xml_xfce, xml_xfcepanel. For other formats, you can use textual raw, binary bin and patch format.

Templates are not just configuration files that can be combined with system ones. They can contain conditional expressions, functions, and, of course, variables. During the merging process, the template and the configuration file are converted to the XML format, then they are combined, after which the XML is converted again to the specified format of the configuration file and copied to the system.

Example 1. Configuring trusted applications kwallet, kwallertc file:
# Calculate format=kde path=~/.kde4/share/config

# Applications that access is allowed
[Auto Allow]
#?os_locale_lang==en_US#
kdewallet=Kopete,KMail,Konqueror,Chromium,Chrome,Network Management,Akonadi Resource,KDE Daemon
#os_locale_lang#
#?os_locale_lang==ru_RU#
kdewallet=Kopete,KMail,Konqueror,Chromium,Chrome,Network Management, Akonadi, KDE
#os_locale_lang#
...


For some time now, KDE applications have begun to use localization. In order not to load the settings of all possible languages, a check and adjustment is made according to the system language.

Example 2. Creating a link to the default browser icon in the bottom panel of XFCE, file browser.desktop:
# Calculate exists(/usr/share/applications/calculate-browser.desktop)!= link=/usr/share/applications/calculate-browser.desktop name=10000000030.desktop symbolic force

The example creates a symbolic link with the name 10000000030.desktop on the file calculate-browser.desktop, checks for the presence of the file. In the case of a file with the same name, the file is overwritten.

Pattern Storage Paths


If the paths of Calculate utilities are of little concern to us, then the location of the templates plays an important role, because using their example we can build our own templates. For convenience, all Calculate 2.2 templates are in the same 'calculate-templates' package. During installation, the contents of the package are expanded to the / usr / share / calculate / templates directory. Here you can find user profile settings. The directory names in the templates are not fixed, their properties are set in the '.calculate_directory' files inside the directories. For the directory, general template rules apply. The templates with which the calculate-desktop package works are in the '/ usr / share / calculate / templates / desktop' directory. The .calculate_directory file describing the properties of this directory contains the header of the desktop directory template:

# Calculate append=skip cl_name==calculate-desktop&&cl_ver>=2.2.1

Here it is clearly indicated that the templates belong to the package, the utility version is checked. User program settings are stored in the '/ usr / share / calculate / templates / desktop / desktop' directory. An example, the '60 -mc-4.7 'directory contains Midnight Commander customization templates.

Setup Events


Calculate Linux uses Portage as its package management system. This extremely flexible system provides greater freedom to include third-party development. Using the profile.bashrc script, Calculate utilities are integrated through the system profile with the emerge package manager. Thus, at the time of the package installation, the system setup is invoked using Calculate utilities. Calculate-desktop searches for templates for the package being installed and, if necessary, configures it. If the settings are not limited to the user profile, the package can modify the system files. Portage will consider these files as its own. The paths to the new and modified files with their hashes will remain in the local database of the installed packages.

In addition to installing packages, there are many other events during which the program is configured. For example, when logging into the session via kdm / gdm, if the user does not have a directory, it will be created and configured. All these events are described in specialized variables, with which conditional expressions are built in templates.

Custom Package Information


User profile settings templates, using standard utility methods, store their settings in the file '~ / .calculate / ini.env'. The samba-like file contains 4 main sections: “main” - general settings, “ver” - customized software versions, “update” - update disable flag for each installed program, “resource” - paths to standard user directories. The number of sections is not limited, for example, in our company we use the section “office” to account for our specific settings. When you log into a domain user session, the profile is configured with templates. Settings are usually needed when making changes when updating software or fixing some application settings.

With the help of ini.env, you can allow or prohibit updates for all as well as for a single application. For example, you can restore the initial settings of a program.

Changes in Calculate Linux 11.9 templates


In 99% of cases, setting up a user profile at login was unnecessary. In Calculate Linux 11.9, the line was drawn between local users and domain users. If earlier utilities could make changes to profiles of only users working in the system, for setting up programs before the first launch, now profiles of all local users are configured. This allowed to remove the update when entering the session, saving up to 5 seconds. In case of changes, modified files are displayed during package installation.

Upgrading the system by installing a new ISO image will also not cause problems. When you first boot, the update utilities will run. For example, when upgrading from KDE 4.6 to version 4.7, only one configuration file of the 'nepomukserverrc' pattern is changed /usr/share/calculate/templates/desktop/desktop/20-kde-4.6-4.7/.kde4/share/config/nepomukserverrc ', with the following content:
# Calculate format=kde

[Basic Settings]
Start Nepomuk=true


Before KDE 4.7, the absence of the Nepomuk daemon did not bother anyone.

Differences of the Calculate package settings system


Differences

You can summarize a brief summary and compare with other distribution packages.
Ubuntu:
To configure a user profile, pre-configured system files are used, sometimes Skel.
Sabayon:
To set up a user profile, use the / etc / skel directory, which contains the settings for all, including those missing in the distribution package.
Calculate:
To set up a user profile, Calculate utility templates are used.

Advantages and disadvantages

+ More options in the configuration, because / etc / skel is limited to static settings that do not allow the indication of user login, screen resolution, hardware features, etc.
+ Settings are made only for software installed in the system, if necessary, you can use the delete settings method.
+ User can create his own application settings templates.
+ It is always possible to use the original program settings.
+ Supports the possibility of smooth migration between versions of programs.
- Before updating the software, it is desirable to update the package with utility templates.

Related Links


Calculate utility templates: www.calculate-linux.ru/main/ru/calculate_utilities_templates
Template variables: www.calculate-linux.ru/main/ru/templates_variables
Storing user profile settings: www.calculate-linux.ru/main/ru/user_profile_storage_settings

Source: https://habr.com/ru/post/129658/


All Articles