diff --git a/Makefile b/Makefile index 1143ae28..686875c4 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,8 @@ install-common: test -d $(DESTDIR)/etc || mkdir -p $(DESTDIR)/etc cp -r etc/alternc $(DESTDIR)/etc cp -r etc/incron.d $(DESTDIR)/etc + install -o root -g root -m 440 etc/sudoers.d/alternc $(DESTDIR)/etc/sudoers.d +# SVN cleanup (bad if installing without DESTDIR, FIXME) find $(DESTDIR)/etc/ -depth -type d -name ".svn" -exec rm {} -rf \; chmod 755 $(DESTDIR)/etc/alternc etc/incron.d diff --git a/debian/alternc.dirs b/debian/alternc.dirs index 41336d9e..ee02ab9b 100644 --- a/debian/alternc.dirs +++ b/debian/alternc.dirs @@ -1,3 +1,4 @@ +etc/sudoers.d etc/alternc etc/alternc/apache-panel.d etc/alternc/templates diff --git a/debian/alternc.postinst b/debian/alternc.postinst index 72c90641..7923270e 100644 --- a/debian/alternc.postinst +++ b/debian/alternc.postinst @@ -251,42 +251,19 @@ EOF # Apache will not start without this file touch /var/lib/alternc/apache-vhost/vhosts_all.conf - #sudo stuff allowing alterncpanel to use quota - if [ -d /etc/sudoers.d ]; then - cp /etc/alternc/alternc-sudoers /etc/sudoers.d/alternc-sudoers - chmod 0440 /etc/sudoers.d/alternc-sudoers - if ! grep -q '#includedir /etc/sudoers.d' "/etc/sudoers"; then - echo "*************************************************" - echo "* *" - echo "* /!\ WARNING /!\ *" - echo "* Please add yourself the following directive : *" - echo "* #includedir /etc/sudoers.d *" - echo "* in file /etc/sudoers (use visudo command) *" - echo "* Else you'll have troubles with some features *" - echo "* of AlternC *" - echo "* *" - echo "*************************************************" - fi - else - echo "running an older version of sudo" - #FIXME - echo "copy content of /usr/share/doc/examples/example.sudoers into /etc/sudoers.d to run properly" - fi - # important: postinst freezes without that: db_stop # instead of preinst, we launch it here : /usr/lib/alternc/fixperms.sh - echo "**********************************************" + echo -e "\033[31m**********************************************" + echo "* *" + echo "* ALTERNC ACTION REQUESTED *" echo "* *" - echo "* /!\ /!\ *" - echo "* ALTERNC: *" echo "* Please run alternc.install to fully deploy *" echo "* *" - echo "* *" - echo "* *" echo "**********************************************" + echo -e "\033[0m" ;; abort-upgrade|abort-remove|abort-deconfigure) diff --git a/etc/alternc/alternc-sudoers b/etc/sudoers.d/alternc similarity index 100% rename from etc/alternc/alternc-sudoers rename to etc/sudoers.d/alternc diff --git a/install/alternc.install b/install/alternc.install index 4289fc90..dd82800e 100644 --- a/install/alternc.install +++ b/install/alternc.install @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e # ---------------------------------------------------------------------- # AlternC - Web Hosting System @@ -28,8 +28,6 @@ if [ `id -u` -ne 0 ]; then exit 1 fi -set -e - for i in $*; do case "$i" in -f|--force) @@ -114,6 +112,8 @@ fi # Upgrade the DATA and DB SCHEMA /usr/share/alternc/install/upgrade_check.sh +# Launch upgrade of alternc modules +run-parts --arg=upgrade /usr/lib/alternc/install.d ####################################################################### @@ -340,6 +340,26 @@ if [ -x /usr/sbin/apache2 ]; then SERVICES="$SERVICES $s" fi +# Manage sudoers.d include appearing in Squeeze: +# if the "includedir" is not here, we add it ONLY IF visudo -c is happy. +if ! grep -q "#includedir */etc/sudoers.d" /etc/sudoers ; then + if ! cat /etc/sudoers.d/* | visudo -c -f - >/dev/null ; then + echo -e "\033[31m**********************************************" + echo "* *" + echo "* ALTERNC ACTION REQUESTED *" + echo "* *" + echo "* SUDO is NOT configured properly *" + echo "* check your files in /etc/sudoers.d ! *" + echo "* then launch alternc.install again *" + echo "* *" + echo "**********************************************" + echo -e "\033[0m" + exit 1 + else + echo "#includedir */etc/sudoers.d" >>/etc/sudoers + fi +fi + # Copy postfix *_checks if they do not exist for file in body_checks header_checks; do if [ ! -e "/etc/postfix/$file" ]; then @@ -355,12 +375,17 @@ fi if [ ! -f /etc/postfix/main.cf ] then - echo "****************************************" - echo "POSTFIX is NOT configured properly" - echo "please launch dpkg-reconfigure -plow postfix" - echo "and choose 'Internet Site'" - echo "then launch alternc.install again" - echo "****************************************" + echo -e "\033[31m**********************************************" + echo "* *" + echo "* ALTERNC ACTION REQUESTED *" + echo "* *" + echo "* POSTFIX is NOT configured properly *" + echo "* launch dpkg-reconfigure -plow postfix *" + echo "* and choose 'Internet Site' *" + echo "* then launch alternc.install again *" + echo "* *" + echo "**********************************************" + echo -e "\033[0m" exit 1 fi @@ -381,13 +406,14 @@ grep -v '^\ *#' $postfix_conf |while read line ; do if [ -e $cert_file ];then postconf -e "$line" else - echo "****************************************" - echo "The certificate file : $cert_file does not exists" - echo "please go to https://alternc.org/wiki/SSL to get information on how to create a certificate" - echo "Then edit the file /etc/alternc/postfix/postfix.cf to add" - echo "the cert file path name to the key :smtpd_tls_cert_file" - echo "Finally relaunch alternc.install" - echo "****************************************" + echo -e "\033[31m*****************************************************" + echo "* The certificate file : $cert_file does not exists *" + echo "* If you want to be able to use SSL/TLS *" + echo "* please go to https://alternc.org/wiki/SSL *" + echo "* to get information on how to create a certificate *" + echo "* Finally relaunch alternc.install *" + echo "*****************************************************" + echo -e "\033[0m" fi else postconf -e "$line"