PREIN
/bin/sh
/usr/share/rpm-helper/add-user flumotion $1 flumotion /usr/share/flumotion /sbin/nologin
/usr/sbin/usermod -G audio,video flumotion
PREUN
/bin/sh
/usr/share/rpm-helper/del-service flumotion $1 flumotion
POSTIN
/bin/sh
if [ -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi
/usr/share/rpm-helper/add-service flumotion $1 flumotion
# generate a default .pem certificate ?
PEM_FILE="/etc/flumotion/default.pem"
if ! test -e ${PEM_FILE}
then
sh /usr/share/flumotion/make-dummy-cert ${PEM_FILE}
chown :flumotion ${PEM_FILE}
chmod 640 ${PEM_FILE}
fi
# create a default planet config if no manager configs present
# the default login will be user/test
# FIXME: still need a way of specifying we really do not want a default manager
if ! ls /etc/flumotion/managers/*/*.xml >/dev/null 2>&1
then
cat > /etc/flumotion/managers/default/planet.xml <<EOF
<planet>
<manager>
<host>localhost</host>
<component name="manager-bouncer" type="htpasswdcrypt">
<data><![CDATA[
user:PSfNpHTkpTx1M
]]></data>
</component>
</manager>
</planet>
EOF
fi
# create a default worker config if no worker configs present
# the default login will be user/test
# FIXME: still need a way of specifying we really do not want a default worker
if ! test -e /etc/flumotion/*/default.xml
then
cat > /etc/flumotion/workers/default.xml <<EOF
<worker>
<manager>
</manager>
<authentication type="plaintext">
<username>user</username>
<password>test</password>
</authentication>
</worker>
EOF
fi
POSTUN
/bin/sh
if [ "$1" = "0" -a -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi
/usr/share/rpm-helper/del-user flumotion $1 flumotion
# if removal and not upgrade, clean up user and config
if [ $1 -eq 0 ]
then
/usr/sbin/userdel flumotion
rm -rf /etc/flumotion/*
rm -rf /var/lock/flumotion*
rm -rf /var/run/flumotion*
fi