[IDEA] Configuration scripts for rpm's

For many years, Debian had something not existing in many other distributions - way to configure packages, when installing. Another approach to not allow to configure packages, while installing is better in many ways, but lacks for many people.

The idea is about how to connect both world:

  • Allow to configure applications/packages, before or after installing it
  • Force normal packages to been configured by default

Repositories should contains links to interactive pre-configure and (non-interactive) post-configure script for each package, that needs it. Package managers could allows to install an package normally or to select configure option (if available for a given package). This option will download pre-configure package contains JavaScript + HTML code and run it and post-configure script. User may use this web page to write configuration in some special place (/var/run/new-packages ?) and this web page could selects another packages to install, like data, additional modules, etc. When user install original package, post-configure script will be run, which reads data from /var/run/new-packages/package-name and configure newly installed packages. User could rerun pre-configure script at any time. Pre-configure could be distro-agnostic and created by program maintainers, while post-configure could be distro dependent.

Use case:
I decided to install MySQL, but don’t know how to configure it, so I select “Configure before install” option. Package manager will read link to pre-configure script and post-configre script and run pre-configure script. After launch it, I can configure mysql and check PhpMyAdmin to install. After installation done, system will run post-configure scirpt.

Use case 2:
I decided to install Mysql. Install it in normal way. After all I don’t know how to configure it, so I run package manager, search for Mysql package (installed) and click configure option.

Questions:
How to handle situation, when user change configuration by hand and will run configure scripts? Introduce new script, to convert distro dependent configuration into pre-configure understood format?

Hi
Not sure what your trying to achieve, do you mean end user configuration files? If so, this is already done via sysconfig, which you can modify as required via YaST /etc/sysconfig editor? If there are configurations your wanting, branch/update and submit… They don’t need to be active, present is enough (in the sysconfig file and format).

For example, here is one I did for Pihole DNS;

There are many scripts (well macros) that run pre/post install, you can pass options through rpm also when installing manually…

Sysconfig does not solve all the problems. In some cases, we need user interaction and showing nice configuration dialog is nicer than editing in dialog similar to regedit.exe :wink: . Also we can handle many other things, when realizing this idea, like package autoselection.

How about giving you all the tools to rapidly create your own scripts?

What you’re describing is exactly my approach to setting up and configuring systems in an automated way(without installing an Enterprise solution like Chef or Puppet which can be overkill in a small shop)… The idea is that if I want to install a known standard setup on a machine, I only have install the basic OS, then run a script. The basic OS might be the original OS, it might be a later version… depending on the effort I want to put into the script, it might support different releases (eg LEAP and TW), different distro versions (eg LEAP 42.3, 15, 15.1) or even distros besides openSUSE. Multiple app versions might be supported, or if not usually require only minor tweaks to update for new app versions.

And of course although an install and configure script won’t cover the data, if I ever had to do a disaster recovery and rebuild a system, a script can save hours and hours of work.

So, here you go…

A collection of scripts including some zypper commands for OS detection and unattended installation of repos and packages… Plus specific to your MySQL case how to automatically set up a MariaDB/MySQL initial security…

https://en.opensuse.org/User:Tsu2/Scripts_and_Scriplets

An example follows of a script I built and offered to the lc0 project that detects the openSUSE version, installs the repos for that distro version, installs the required C development environment, and executes the build… Completely unattended. If you want to see how it works, you can run in a throwaway virtual machine just to see the magic, or if you run on your physical machine go through the work of manually removing everything if you don’t want all that to stay on your machine…

https://github.com/putztzu/lc0/blob/master/install_openSUSE_lc0.sh

Aside from the comments embedded in the above script, the related documentation follows…

https://github.com/putztzu/lc0/blob/master/openSUSE_install.md

You’ll find examples of other similar “install and configure” scripts sprinkled throughout my Wiki, although several are out of date and lack the attention I would have to apply to keep them current…

https://en.opensuse.org/User:Tsu2

If you have any questions or comment, things to add or find needs to be fixed for your purpose, you can post in this or the Installation of Applications forums or PM me… Or make your changes directly to the wiki if you know the fix (If I really have a problem with anything I can roll back).

Another script worth looking at which invokes various sub-scripts and uses a couple answer files is the Devstack script I wrote long ago… I’d be surprised if it still works today, but it contains numerous useful methods

https://en.opensuse.org/User:Tsu2/openstack-install

HTH,
TSU

The MySQL/MariaDB script I provide in the above links shows how you can construct a HereDoc with answer file to run an interactive script, automatically providing answers so the script becomes “unattended.” Of course, if your objective isn’t to run an unattended install, you can let the scripts run “as is” instead or invoke an ncurses interface, but that does require installing non-default packages… And as much as possible I try to write all my scripts to run on a default system without any prerequisites or else I’d have to install those packages as part of the script(I’m sure no one wants to use scripts you have to remember need something else done first before they can run).

Note that the BASH scripts I offer are intended to run on any openSUSE, usually on a fresh install, default system created separately.
If you want to make even the OS installation unattended, then you should look at AutoYaST.

TSU