#!/bin/bash

if [ ! -e /home/wpkg/hosts.xml ]; then
    cat > /home/wpkg/hosts.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<wpkg>
<host />
</wpkg>
EOF
fi

if [ ! -e /home/wpkg/profiles.xml ]; then
    cat > /home/wpkg/profiles.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<profiles>
    <profile/>
</profiles>
EOF
fi

if [ ! -d /home/wpkg/profiles ]; then
    #WPKG n'a jamais été utilisé => initialisation des droits
    #Ensuite, ne plus y toucher pour .EtatsClients (rapports WPKG)
    mkdir -p /home/wpkg/profiles
    chmod -R 755 /home/wpkg
    getfacl --access --absolute-names /home/wpkg|setfacl -d -RM - /home/wpkg
fi
