Subversion Repositories se3

Rev

Rev 5837 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#! /bin/sh
#$Id:$
# postinst script for smbedu
#
# see: dh_installdeb(1)

set -e

# 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 /usr/doc/packaging-manual/
#
# quoting from the policy:
#     Any necessary prompting should almost always be confined to the
#     post-installation script, and should be protected with a conditional
#     so that unnecessary prompting doesn't happen if a package's
#     installation fails and the `postinst' is called with `abort-upgrade',
#     `abort-remove' or `abort-deconfigure'.
case "$1" in
    configure)
    . /usr/share/se3/includes/functions.inc.sh
    . /usr/share/se3/includes/config.inc.sh -cls
        echo "Installation du serveur unison..."
        echo " configuration des droits"
            ldapsearch -xLLL -h $ldap_server:$ldap_port -b $rightsRdn,$ldap_base_dn "(cn=unison_users)" cn | grep -q "cn:" ||\
                (echo "dn: cn=unison_users,$rightsRdn,$ldap_base_dn"
                        echo "cn: unison_users"
                echo "objectClass: groupOfNames"
                echo "description: utilisateurs pouvant utiliser la synchro"
                echo "member: cn=admin,$peopleRdn,$ldap_base_dn"
                        )| ldapadd  -x -h $ldap_server:$ldap_port  -D $adminRdn,$ldap_base_dn -w $adminPw > /dev/null
                
        echo "ajout aux sudoers" 
                grep -q "/usr/share/se3/scripts/unison_keys.sh" /etc/sudoers ||\
                sed -i 's|^# Commandes Sudo Lcs$|Cmnd_Alias UNISON = /usr/share/se3/scripts/unison_links.sh, /usr/share/se3/scripts/unison_keys.sh\n# Commandes Sudo Lcs|;s|^www-se3 ALL=|www-se3 ALL=NOPASSWD:UNISON,|' /etc/sudoers && /etc/init.d/sudo restart
        echo "installation du serveur ssh sur le port 22222"
        if [ ! -L /usr/sbin/sshd_ext ]; then 
            ln -s /usr/sbin/sshd /usr/sbin/sshd_ext
        fi
        if [ -f /etc/init.d/sshd ]; then
            # lenny et +
            sshd="sshd"
        else
            #etch
            sshd="ssh"
        fi             
            sed  "s/sshd/sshd_ext/g" /etc/init.d/$sshd > /etc/init.d/${sshd}_ext
        chmod 755 /etc/init.d/${sshd}_ext
        sed  "s/^SSHD_OPTS=/SSHD_OPTS=\"-f \/etc\/ssh\/sshd_ext_config\"/g" /etc/default/$sshd > /etc/default/${sshd}_ext
        chmod 755 /etc/init.d/${sshd}_ext
        sed "s/^Port 22$/Port 22222/g;s/^PermitRootLogin yes/PermitRootLogin no/g;s/^UsePAM yes/UsePAM no/g" /etc/ssh/sshd_config > /etc/ssh/sshd_ext_config
        update-rc.d ${sshd}_ext defaults
        /etc/init.d/${sshd}_ext start
    echo "ajout du shell scponly"
        if  [ "$defaultshell" == "/usr/bin/scponly" ]; then 
            grep -q "/usr/bin/scponly" /etc/shells || echo "/usr/bin/scponly" >> /etc/shells
        fi
    echo "modif des droits"
        chown www-se3:root /var/www/se3/includes/menu.d/98synchro.inc
        chown -R www-se3:root /var/www/se3/unison
        chown -R root:root /var/se3/synchro  
    echo "configuration du domaine"
        if [ "$unison" == "" ]; then
            SETMYSQL unison 1 "Activation du module de synchronisation de fichiers" 6
        elif [ "$unison" == "0" ]; then
            CHANGEMYSQL unison 1
        fi
        if [ "$unison_name" == "" ]; then
            unison_name="$netbios_name.$domain"
            echo "unison_name=$unison_name"
            SETMYSQL unison_name "$unison_name" "nom DNS du serveur unison" 6
        fi
        . /usr/share/se3/includes/config.inc.sh -csf 
   ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 0
    ;;
esac

exit 0