daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
4295f9
#!/bin/bash
4295f9
4295f9
parse() {
4295f9
    while read line; do
4295f9
        [ "${line:0:1}" = '#' -o "${line:0:1}" = ';' ] && continue
4295f9
        line="${line## *}"
4295f9
        [ -z "$line" ] && continue
4295f9
        set -- $line
4295f9
        case "$1" in
4295f9
            ('u')
4295f9
                echo "user($2)"
4295f9
                echo "group($2)"
4295f9
                # TODO: user:group support
4295f9
                ;;
4295f9
            ('g')
4295f9
                echo "group($2)"
4295f9
                ;;
4295f9
            ('m')
4295f9
                echo "user($2)"
4295f9
                echo "group($3)"
4295f9
                ;;
4295f9
        esac
4295f9
    done
4295f9
}
4295f9
4295f9
while read fn; do
4295f9
    parse < "$fn"
4295f9
done