User:Rabisg/GSOC 14

=[GSoC'14] netifrc on Systemd=

Abstract
The goal of this project is to abstract away the tight dependence of netifrc on OpenRC and write a compatibility layer for netifrc to work with other init systems like Systemd

Further details of the proposal can be found at this page

April 21 - May 18 : Community bonding period

 * 1) Read up shell programming in general
 * 2) Read up systemd - its management and philosophies | Freedesktop: Systemd
 * 3) Read through the source code of netifrc.
 * 4) Checked out tools like checkbashism (suggested by @robbat2) and shellcheck and fixed the bugs in the module for iw which I had started writing earlier

May 19 - May 25 : Initial systemd design

 * Created a systemd wrapper to be called by the unit file
 * It sets up the initial environment for non-systemd settings
 * Sources the conf.d/net file manually
 * Sources the net.lo file and relays calls to start, stop and restart to the net.lo script


 * Refactor common functionality in sh/functions.sh
 * Functionality like finding the interface name from the runscript which is required on any target but which differs depending on the target (Gentoo v/s non-Gentoo, openrc v/s systemd) are to be refactored in this file. For example it presently contains get_interface which finds out the interface name depending on the init system
 * It also checks whether ebegin, etc. is present in the scope. If not, then it tries to source /lib/gentoo/functions.sh. Else as a fallback it contains the definitions of those functions (Adapted from sys-apps/gentoo-functions)

May 26 - June 1 : OpenRC Compatibility Layer

 * Discussed the design further with @robbat2 and decided to remove e* functions from functions.sh and instead add gentoo-functions as a dependency
 * Changed the build process to include the new files and tested it locally. Subsequently fixed the errors that I could I find.
 * Updated the ebuild (maintained at https://github.com/rabisg/gentoo-overlay/tree/master/net-misc/netifrc) and added a systemd service file (To be tested)


 * Started with the compatibility layer: Discussed the semantics of service_set_value and service_get_value at #openrc and also had a peek at openrc's codebase. Finally decided that the best way to implement it using files in /run/netifrc similar to what is done by openrc (which stores it at $SVCDIR/options/$SVCNAME/$KEY )

June 2nd - June 8
I could not work the usual duration because I had to move to college from home and had some things I had to take care of at college. Setting up systemd helped me better understand systemd itself, especially unit files and their handling. During this I also had to to look into netctl (the archlinux project to manage network connections)which has many similarities to my current work
 * However I set up the various VMs which will be required to test the project
 * Gentoo Stable
 * Gentoo Unstable
 * Gentoo with Systemd
 * Gentoo Unstable with Systemd
 * Archlinux


 * Also started looking into mark_service calls in openrc

June 9th - June 15 : Testing on a Systemd system
Please feel free to point out mistakes and help me out in understanding it further
 * Read through the codebase of openrc and tried to understand the semantics of marking services. I have also discussed this with people at #openrc but am still not 100% confident about understanding the semantics of the same. I have also written a small wiki entry trying to explain my understanding of the concerned openrc functionality here
 * Successfully tested netifrc running on a Gentoo systemd stable machine (only tested setting up "lo" for now). The changes I had to make in the code and the service file are recorded in the main repo and my local overlay respectively

June 16 - June 22

 * This week I tested the codebase on gentoo+systemd machines. Upon testing it on a actual systemd machine, I figured out the missing functions and fixed a few bugs. I could successfully test eth0 and lo interfaces. I also tested it on a gentoo+openrc system to make sure that I did not introduce any breaking changes
 * Added the prototype for is_net_fs function and defined functions primarily used in the depend block (program, after, need, etc.)

VirtualBox image: Gentoo - https://drive.google.com/folderview?id=0B8yZctFMulwlT2hwanNpTVdJWkE&usp=sharing

Build Instructions:
 * 1) After getting the VM running, I generally mount   and   from my local machine   is my local overlay: https://github.com/rabisg/gentoo-overlay. But this image has netifrc-9999 is installed anyways
 * 2) You can directly run