teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone

Blame SOURCES/sysusers.prov

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