Hi Everyone,<br><br>I hope you all had a great time at DebConf. I wish I was there in person to meet the Debian developers and users, but it was not possible this time around. I hope to attend the next DebConf. Here is my fourth bi-weekly report :<br>
<br>Fourth Report<br>============<br><br>Project - Sys-V init file creator from systemd service files<br>============================================================<br><br>Status of the project so far :<br>=============================<br>
<br>A lot of progress happened in the last fortnight. I was able to code the conversion logic for most of the major systemd options and now we have a basic version of the converter script working. Here is a list of options with a short description and their corresponding conversion logic which were heavily modified in past week :<br>
<br>DefaultDependencies : This option takes a boolean argument. If this option is set to yes, then a few default dependencies is created for the service file. No default dependency is kept if this option is explicitly set to no.<br>
Conversion : Syslog and local_fs are kept as default dependencies for most of the services. Services which have "/usr" on the execution path also have remote_fs as one of the default dependency.<br><br>ExecStopPost : This option takes command line(s) that are executed after the service was stopped using the commands configured in ExecStop option.<br>
Conversion : Script to save all the commands in a list and then execute them using the start_daemon() method present in the standard /lib/lsb/init-functions.<br><br>ExecReload : This option takes commands to execute in order to trigger a configuration reload in the service. <br>
Conversion : This option is used in the implementation of the force-reload functionality.<br><br>TimeoutSec : This option configures the time to wait for start-up and stop for the service. This takes a value of time (in seconds) as argument.<br>
Conversion : We have a script to check whether a daemon service signals start-up completion within the above value of time. If not, then the start up is considered failed and service is stopped. If the action is stop instead of start and the service does not terminate in the time specified, then it is terminated forcibly via SIGTERM and after another delay of the specified time with SIGKILL. <br>
<br>Apart from these Systemd options, some basic error handling was done to ensure that the converter exits gracefully with lsb-compliant exit codes in cases of crash, invalid arguments, invalid actions etc. Also the Provides keyword was added in the generated LSB header. Also the support for the following functionalities was added :<br>
<br>Reload action : This is an optional action that can be supported by LSB-complaint init scripts {start, stop, restart and force-reload are mandatory as per the debian policy [0]. Here is the basic logic behind this functionality : If ExecReload statement already exists in the service file, then it will be executed. However, ExecReload is an optional option and is absent in many service files. In this case, we need to find the service's PID. We can find the PID by using the pidofproc() method defined in the standard /lib/lsb/init-functions.<br>
<br>Force-Reload action : This is a mandatory option which has to be supported by all the init scripts as per the debian policy. It reloads the service's configuration if the service supports reload (i.e has the ExecReload option) else it restarts the service.<br>
<br>Logging with the help of log_*_msg() functions defined in /lib/lsb/init-functions : We use these log_*_msg() methods to log or display messages. This introduces consistent output in the init scripts. Also the message follow the syntax defined in the debian policy[1].<br>
<br>Handling specifiers : We added support for handling specifiers like %i, %I, %f etc. as defined in the Systemd.unit man page[2].<br><br>A new dict for .ini parser - For fetching multiple options of the same name(exec{start,stop}post etc.), we had to create new dict for using with Python's config parser.<br>
<br>The code is present in my git repository[3].<br><br>Future Plans :<br>==============<br><br>Now the main task is to test the converter on as many systemd service files as possible and use the results to improve the conversion logic. I started a basic testing this week. Manual generation using conf files from F17. I also intend to make a proper logging infrastructure to warn users when they are using systemd options that are incompatible with SysV. There are certain issues with regard to the LSB header (especially the soft dependencies like Should-{start/stop}) which I will discuss with the mentor in the coming week. Once this is settled, I'll prepare a document listing the conversion logic used in the script, usage etc. We'll then announce an alpha release of the product on the mailing list and ask the admins/package-maintainers to use it and share their valuable feedback. In parallel, I'll be working on the packaging for making this available in the Debian repo.<br>
<br>Kind Regards,<br>Akhil Vij <br><br>[0] : <a href="http://www.debian.org/doc/debian-policy/ch-opersys.html#s9.3.2">http://www.debian.org/doc/debian-policy/ch-opersys.html#s9.3.2</a><br>[1] : <a href="http://www.debian.org/doc/debian-policy/ch-opersys.html#s9.4">http://www.debian.org/doc/debian-policy/ch-opersys.html#s9.4</a><br>
[2] : <a href="http://0pointer.de/public/systemd-man/systemd.unit.html">http://0pointer.de/public/systemd-man/systemd.unit.html</a><br>[3] : <a href="https://github.com/akhilvij/systemd-to-sysvinit-converter">https://github.com/akhilvij/systemd-to-sysvinit-converter</a><br>
<br>