Merge pull request #87 from YunoHost/improve_deb

Improve deb
This commit is contained in:
Jérôme Lebleu 2015-09-10 20:10:03 +02:00
commit 3bbfd1dbeb
24 changed files with 82 additions and 90 deletions

View file

@ -1,5 +1,3 @@
#!/bin/bash
backup_dir="$1/ldap"
mkdir -p $backup_dir

View file

@ -1,5 +1,3 @@
#!/bin/bash
backup_dir="$1/ssh"
mkdir -p $backup_dir

View file

@ -1,5 +1,3 @@
#!/bin/bash
backup_dir="$1/mysql"
mkdir -p $backup_dir

View file

@ -1,5 +1,3 @@
#!/bin/bash
backup_dir="$1/ssowat"
mkdir -p $backup_dir

View file

@ -1,5 +1,3 @@
#!/bin/bash
backup_dir="$1/home"
mkdir -p $backup_dir

View file

@ -1,5 +1,3 @@
#!/bin/bash
backup_dir="$1/yunohost"
mkdir -p $backup_dir

View file

@ -1,5 +1,3 @@
#!/bin/bash
backup_dir="$1/mail"
sudo cp -a /var/mail/. $backup_dir

View file

@ -1,5 +1,3 @@
#!/bin/bash
backup_dir="$1/xmpp"
mkdir -p $backup_dir/{etc,var}

View file

@ -1,5 +1,3 @@
#!/bin/bash
backup_dir="$1/nginx"
mkdir -p $backup_dir

View file

@ -1,5 +1,3 @@
#!/bin/bash
backup_dir="$1/cron"
mkdir -p $backup_dir

View file

@ -1,5 +1,3 @@
#!/bin/bash
backup_dir="$1/ldap"
if [ -z "$2" ]; then

View file

@ -1,5 +1,3 @@
#!/bin/bash
backup_dir="$1/ssh"
sudo cp -a $backup_dir/. /etc/ssh

View file

@ -1,5 +1,3 @@
#!/bin/bash
backup_dir="$1/mysql"
mysqlpwd=$(sudo cat /etc/yunohost/mysql)

View file

@ -1,5 +1,3 @@
#!/bin/bash
backup_dir="$1/ssowat"
sudo cp -a $backup_dir/. /etc/ssowat

View file

@ -1,5 +1,3 @@
#!/bin/bash
backup_dir="$1/home"
sudo cp -a $backup_dir/. /home

View file

@ -1,5 +1,3 @@
#!/bin/bash
backup_dir="$1/yunohost"
sudo cp -a $backup_dir/. /etc/yunohost

View file

@ -1,5 +1,3 @@
#!/bin/bash
backup_dir="$1/mail"
sudo cp -a $backup_dir/. /var/mail

View file

@ -1,5 +1,3 @@
#!/bin/bash
backup_dir="$1/xmpp"
sudo cp -a $backup_dir/etc/. /etc/metronome

View file

@ -1,5 +1,3 @@
#!/bin/bash
backup_dir="$1/nginx"
sudo cp -a $backup_dir/. /etc/nginx/conf.d

View file

@ -1,5 +1,3 @@
#!/bin/bash
backup_dir="$1/cron"
sudo cp -a $backup_dir/. /etc/cron.d

122
debian/postinst vendored
View file

@ -1,56 +1,86 @@
#!/bin/bash
TMP=/usr/share/yunohost/yunohost-config/moulinette
set -e
if [ ! -d /etc/yunohost ];
then
mkdir -p /etc/yunohost
fi
do_configure() {
TMP=/usr/share/yunohost/yunohost-config/moulinette
# Allow users to access /media directory
if [ ! -d /etc/skel/media ];
then
mkdir -p /media
ln -s /media /etc/skel/
fi
if [ ! -d /etc/yunohost ];
then
mkdir -p /etc/yunohost
fi
#Firewall
grep -q "UPNP:" /etc/yunohost/firewall.yml > /dev/null 2>&1
if [[ $? -eq 0 ]] || [ ! -f /etc/yunohost/firewall.yml ];
then
cp $TMP/firewall.yml /etc/yunohost/
fi
# Allow users to access /media directory
if [ ! -d /etc/skel/media ];
then
mkdir -p /media
ln -s /media /etc/skel/
fi
# App fetchlist
if [ -f /etc/cron.d/yunohost-applist-yunohost ];
then
sed -i "s/--no-ldap //g" /etc/cron.d/yunohost-applist-yunohost
fi
#Firewall
grep -q "UPNP:" /etc/yunohost/firewall.yml > /dev/null 2>&1
if [[ $? -eq 0 ]] || [ ! -f /etc/yunohost/firewall.yml ];
then
cp $TMP/firewall.yml /etc/yunohost/
fi
# Service list
if [ ! -f /etc/yunohost/services.yml ];
then
cp $TMP/services.yml /etc/yunohost/
fi
# App fetchlist
if [ -f /etc/cron.d/yunohost-applist-yunohost ];
then
sed -i "s/--no-ldap //g" /etc/cron.d/yunohost-applist-yunohost
fi
# Stop old API
ps aux | grep "yunohost.tac" | grep -qv grep
if [[ $? -eq 0 ]];
then
killall twistd
fi
# Service list
if [ ! -f /etc/yunohost/services.yml ];
then
cp $TMP/services.yml /etc/yunohost/
fi
rm -rf /var/cache/moulinette/*
update-rc.d yunohost-api defaults
service yunohost-api restart
# Stop old API
ps aux | grep "yunohost.tac" | grep -qv grep
if [[ $? -eq 0 ]];
then
killall twistd
fi
# Reload SSOwat conf if obsolete
if [ -f /etc/yunohost/installed ];
then
yunohost firewall upnp | grep -qi "true"
if [[ $? -eq 0 ]];
then
yunohost firewall upnp enable
fi
yunohost app ssowatconf
fi
rm -rf /var/cache/moulinette/*
update-rc.d yunohost-api defaults > /dev/null
service yunohost-api restart
# Firewall
update-rc.d yunohost-firewall defaults > /dev/null
# Reload SSOwat conf if obsolete
if [ -f /etc/yunohost/installed ];
then
yunohost firewall upnp | grep -qi "true"
if [[ $? -eq 0 ]];
then
yunohost firewall upnp enable
fi
yunohost app ssowatconf
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

View file

@ -6,6 +6,7 @@
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop YunoHost API
# Description: Start/stop YunoHost API
### END INIT INFO
DAEMON=/usr/bin/yunohost-api
@ -40,7 +41,7 @@ case "$1" in
kill `ps aux | grep 'yunohost-api' | grep -v grep | grep -v stop | awk '{print $2}'` > /dev/null 2>&1
log_end_msg 0
;;
restart)
restart|force-reload)
logger "YunoHost API: Restarting"
log_daemon_msg "Restarting API: YunoHost"
if [ -f /var/run/yunohost-api.pid ]; then
@ -66,7 +67,7 @@ case "$1" in
;;
*)
logger "YunoHost API: Invalid usage"
echo "Usage: /etc/init.d/yunohost-api {start|stop|restart|status}" >&2
echo "Usage: /etc/init.d/yunohost-api {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac

View file

@ -6,6 +6,7 @@
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop YunoHost firewall
# Description: Start/stop YunoHost firewall
### END INIT INFO
DAEMON=/usr/bin/yunohost
@ -30,7 +31,7 @@ case "$1" in
/usr/bin/yunohost firewall stop
log_end_msg $?
;;
restart)
restart|force-reload)
logger "YunoHost firewall: Restarting"
log_daemon_msg "Restarting firewall: YunoHost"
/usr/bin/yunohost firewall reload
@ -44,7 +45,7 @@ case "$1" in
;;
*)
logger "YunoHost API: Invalid usage"
echo "Usage: /etc/init.d/yunohost-api {start|stop|restart|status}" >&2
echo "Usage: /etc/init.d/yunohost-api {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac

0
lib/yunohost/__init__.py Executable file → Normal file
View file