yast/yast-yast2

View on GitHub
library/network/src/scrconf/network.scr

Summary

Maintainability
Test Coverage
// @configure_input@
/**
 * File:    network.scr
 * Summary:    Agent for /etc/sysconfig/network/ifcfg-*
 * Author:    Michal Svec <msvec@suse.cz>
 * Access:    read / write
 * See:        sysconfig.rpm
 *
 * General syntax:
 *     # comment0
 *     VAR1=val1 # comment1
 *     VAR2="val 2 #blah" # comment2
 *     VAR3='val3 x #blah2' # comment3
 *
 * $Id$
 *
 * <p>Reads/writes <tt>/etc/sysconfig/network/ifcfg-*</tt>. For more details
 * see its own documentation.</p>
 */
.network

`ag_ini(
    `IniAgent( [ "/etc/sysconfig/network/ifcfg-*" ],
    $[
        /* values at the top level, allow comments after value */
        "options"    : [ "global_values", "comments_last", "shell_quoted_value" ],
        /* empty lines, comments after value and whole-line comments */
        "comments"    : [ "^[ \t]*$", "[ \t]*#.*$", "^[ \t]*#.*$" ],
        /* matching rules */
        "params"    : [
                $[ "match" : [ "^[ \t]*([a-zA-Z_][a-zA-Z0-9_]*)=[ \t]*(.*)[ \t]*", "%s=%s" ] ],
        ],
        /* matching rules */
        "rewrite"    : [
        [ "/etc/sysconfig/network/ifcfg-(.*)", "/etc/sysconfig/network/ifcfg-%s" ],
        ],
    ]
))