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" backup_dir="$1/ldap"
mkdir -p $backup_dir mkdir -p $backup_dir

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

122
debian/postinst vendored
View file

@ -1,56 +1,86 @@
#!/bin/bash #!/bin/bash
TMP=/usr/share/yunohost/yunohost-config/moulinette set -e
if [ ! -d /etc/yunohost ]; do_configure() {
then TMP=/usr/share/yunohost/yunohost-config/moulinette
mkdir -p /etc/yunohost
fi
# Allow users to access /media directory if [ ! -d /etc/yunohost ];
if [ ! -d /etc/skel/media ]; then
then mkdir -p /etc/yunohost
mkdir -p /media fi
ln -s /media /etc/skel/
fi
#Firewall # Allow users to access /media directory
grep -q "UPNP:" /etc/yunohost/firewall.yml > /dev/null 2>&1 if [ ! -d /etc/skel/media ];
if [[ $? -eq 0 ]] || [ ! -f /etc/yunohost/firewall.yml ]; then
then mkdir -p /media
cp $TMP/firewall.yml /etc/yunohost/ ln -s /media /etc/skel/
fi fi
# App fetchlist #Firewall
if [ -f /etc/cron.d/yunohost-applist-yunohost ]; grep -q "UPNP:" /etc/yunohost/firewall.yml > /dev/null 2>&1
then if [[ $? -eq 0 ]] || [ ! -f /etc/yunohost/firewall.yml ];
sed -i "s/--no-ldap //g" /etc/cron.d/yunohost-applist-yunohost then
fi cp $TMP/firewall.yml /etc/yunohost/
fi
# Service list # App fetchlist
if [ ! -f /etc/yunohost/services.yml ]; if [ -f /etc/cron.d/yunohost-applist-yunohost ];
then then
cp $TMP/services.yml /etc/yunohost/ sed -i "s/--no-ldap //g" /etc/cron.d/yunohost-applist-yunohost
fi fi
# Stop old API # Service list
ps aux | grep "yunohost.tac" | grep -qv grep if [ ! -f /etc/yunohost/services.yml ];
if [[ $? -eq 0 ]]; then
then cp $TMP/services.yml /etc/yunohost/
killall twistd fi
fi
rm -rf /var/cache/moulinette/* # Stop old API
update-rc.d yunohost-api defaults ps aux | grep "yunohost.tac" | grep -qv grep
service yunohost-api restart if [[ $? -eq 0 ]];
then
killall twistd
fi
# Reload SSOwat conf if obsolete rm -rf /var/cache/moulinette/*
if [ -f /etc/yunohost/installed ]; update-rc.d yunohost-api defaults > /dev/null
then service yunohost-api restart
yunohost firewall upnp | grep -qi "true"
if [[ $? -eq 0 ]]; # Firewall
then update-rc.d yunohost-firewall defaults > /dev/null
yunohost firewall upnp enable
fi # Reload SSOwat conf if obsolete
yunohost app ssowatconf if [ -f /etc/yunohost/installed ];
fi 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-Start: 2 3 4 5
# Default-Stop: 0 1 6 # Default-Stop: 0 1 6
# Short-Description: Start/stop YunoHost API # Short-Description: Start/stop YunoHost API
# Description: Start/stop YunoHost API
### END INIT INFO ### END INIT INFO
DAEMON=/usr/bin/yunohost-api 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 kill `ps aux | grep 'yunohost-api' | grep -v grep | grep -v stop | awk '{print $2}'` > /dev/null 2>&1
log_end_msg 0 log_end_msg 0
;; ;;
restart) restart|force-reload)
logger "YunoHost API: Restarting" logger "YunoHost API: Restarting"
log_daemon_msg "Restarting API: YunoHost" log_daemon_msg "Restarting API: YunoHost"
if [ -f /var/run/yunohost-api.pid ]; then if [ -f /var/run/yunohost-api.pid ]; then
@ -66,7 +67,7 @@ case "$1" in
;; ;;
*) *)
logger "YunoHost API: Invalid usage" 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 exit 1
;; ;;
esac esac

View file

@ -6,6 +6,7 @@
# Default-Start: 2 3 4 5 # Default-Start: 2 3 4 5
# Default-Stop: 0 1 6 # Default-Stop: 0 1 6
# Short-Description: Start/stop YunoHost firewall # Short-Description: Start/stop YunoHost firewall
# Description: Start/stop YunoHost firewall
### END INIT INFO ### END INIT INFO
DAEMON=/usr/bin/yunohost DAEMON=/usr/bin/yunohost
@ -30,7 +31,7 @@ case "$1" in
/usr/bin/yunohost firewall stop /usr/bin/yunohost firewall stop
log_end_msg $? log_end_msg $?
;; ;;
restart) restart|force-reload)
logger "YunoHost firewall: Restarting" logger "YunoHost firewall: Restarting"
log_daemon_msg "Restarting firewall: YunoHost" log_daemon_msg "Restarting firewall: YunoHost"
/usr/bin/yunohost firewall reload /usr/bin/yunohost firewall reload
@ -44,7 +45,7 @@ case "$1" in
;; ;;
*) *)
logger "YunoHost API: Invalid usage" 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 exit 1
;; ;;
esac esac

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