[enh] postinst : only respond to configure

This commit is contained in:
Julien Malik 2015-09-09 18:37:52 +02:00 committed by kload
parent 659b3126cc
commit 17e4872a98

95
debian/postinst vendored
View file

@ -1,56 +1,85 @@
#!/bin/bash #!/bin/bash
#!/bin/sh
# postinst script for yunohost-config-metronome
TMP=/usr/share/yunohost/yunohost-config/moulinette set -e
if [ ! -d /etc/yunohost ]; do_configure() {
then TMP=/usr/share/yunohost/yunohost-config/moulinette
if [ ! -d /etc/yunohost ];
then
mkdir -p /etc/yunohost mkdir -p /etc/yunohost
fi fi
# Allow users to access /media directory # Allow users to access /media directory
if [ ! -d /etc/skel/media ]; if [ ! -d /etc/skel/media ];
then then
mkdir -p /media mkdir -p /media
ln -s /media /etc/skel/ ln -s /media /etc/skel/
fi fi
#Firewall #Firewall
grep -q "UPNP:" /etc/yunohost/firewall.yml > /dev/null 2>&1 grep -q "UPNP:" /etc/yunohost/firewall.yml > /dev/null 2>&1
if [[ $? -eq 0 ]] || [ ! -f /etc/yunohost/firewall.yml ]; if [[ $? -eq 0 ]] || [ ! -f /etc/yunohost/firewall.yml ];
then then
cp $TMP/firewall.yml /etc/yunohost/ cp $TMP/firewall.yml /etc/yunohost/
fi fi
# App fetchlist # App fetchlist
if [ -f /etc/cron.d/yunohost-applist-yunohost ]; if [ -f /etc/cron.d/yunohost-applist-yunohost ];
then then
sed -i "s/--no-ldap //g" /etc/cron.d/yunohost-applist-yunohost sed -i "s/--no-ldap //g" /etc/cron.d/yunohost-applist-yunohost
fi fi
# Service list # Service list
if [ ! -f /etc/yunohost/services.yml ]; if [ ! -f /etc/yunohost/services.yml ];
then then
cp $TMP/services.yml /etc/yunohost/ cp $TMP/services.yml /etc/yunohost/
fi fi
# Stop old API # Stop old API
ps aux | grep "yunohost.tac" | grep -qv grep ps aux | grep "yunohost.tac" | grep -qv grep
if [[ $? -eq 0 ]]; if [[ $? -eq 0 ]];
then then
killall twistd killall twistd
fi fi
rm -rf /var/cache/moulinette/* rm -rf /var/cache/moulinette/*
update-rc.d yunohost-api defaults update-rc.d yunohost-api defaults
service yunohost-api restart service yunohost-api restart
# Reload SSOwat conf if obsolete # Reload SSOwat conf if obsolete
if [ -f /etc/yunohost/installed ]; if [ -f /etc/yunohost/installed ];
then then
yunohost firewall upnp | grep -qi "true" yunohost firewall upnp | grep -qi "true"
if [[ $? -eq 0 ]]; if [[ $? -eq 0 ]];
then then
yunohost firewall upnp enable yunohost firewall upnp enable
fi fi
yunohost app ssowatconf yunohost app ssowatconf
fi fi
}
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
configure)
do_configure
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac