[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-synchro/DEBIAN/ -> postinst (source)

   1  #! /bin/bash
   2  #$Id:$
   3  # postinst script for smbedu
   4  #
   5  # see: dh_installdeb(1)
   6  
   7  set -e
   8  
   9  # summary of how this script can be called:
  10  #        * <postinst> `configure' <most-recently-configured-version>
  11  #        * <old-postinst> `abort-upgrade' <new version>
  12  #        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
  13  #          <new-version>
  14  #        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
  15  #          <failed-install-package> <version> `removing'
  16  #          <conflicting-package> <version>
  17  # for details, see /usr/doc/packaging-manual/
  18  #
  19  # quoting from the policy:
  20  #     Any necessary prompting should almost always be confined to the
  21  #     post-installation script, and should be protected with a conditional
  22  #     so that unnecessary prompting doesn't happen if a package's
  23  #     installation fails and the `postinst' is called with `abort-upgrade',
  24  #     `abort-remove' or `abort-deconfigure'.
  25  case "$1" in
  26      configure)
  27      . /usr/share/se3/includes/functions.inc.sh
  28      . /usr/share/se3/includes/config.inc.sh -cls
  29      echo "Installation du serveur unison..."
  30      echo " configuration des droits"
  31          ldapsearch -xLLL  -b $rightsRdn,$ldap_base_dn "(cn=unison_users)" cn | grep -q "cn:" ||\
  32              (echo "dn: cn=unison_users,$rightsRdn,$ldap_base_dn"
  33              echo "cn: unison_users"
  34              echo "objectClass: groupOfNames"
  35              echo "description: utilisateurs pouvant utiliser la synchro"
  36              echo "member: cn=admin,$peopleRdn,$ldap_base_dn"
  37              )| ldapadd  -x  -D $adminRdn,$ldap_base_dn -w $adminPw > /dev/null
  38          
  39      echo "ajout aux sudoers" 
  40          grep -q "/usr/share/se3/scripts/unison_keys.sh" /etc/sudoers ||\
  41          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
  42      echo "installation du serveur ssh sur le port 22222"
  43          if [ ! -L /usr/sbin/sshd_ext ]; then 
  44              ln -s /usr/sbin/sshd /usr/sbin/sshd_ext
  45          fi
  46          if [ -f /etc/init.d/sshd ]; then
  47              # lenny et +
  48              sshd="sshd"
  49          else
  50              #etch
  51              sshd="ssh"
  52          fi             
  53          sed  "s|sshd|sshd_ext|g;s|/etc/default/ssh|/etc/default/ssh_ext|g" /etc/init.d/$sshd > /etc/init.d/$sshd}_ext
  54          chmod 755 /etc/init.d/$sshd}_ext
  55          sed  "s|^SSHD_OPTS=|SSHD_OPTS=\"-f /etc/ssh/sshd_ext_config\"|g" /etc/default/ssh > /etc/default/ssh_ext
  56          chmod 755 /etc/init.d/$sshd}_ext
  57          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
  58          update-rc.d $sshd}_ext defaults
  59          /etc/init.d/$sshd}_ext start
  60      echo "ajout du shell scponly"
  61          if  [ "$defaultshell" == "/usr/bin/scponly" ]; then 
  62              grep -q "/usr/bin/scponly" /etc/shells || echo "/usr/bin/scponly" >> /etc/shells
  63          fi
  64      echo "modif des droits"
  65          chown www-se3:root /var/www/se3/includes/menu.d/98synchro.inc
  66          chown -R www-se3:root /var/www/se3/unison
  67          chown -R root:root /var/se3/synchro  
  68      echo "configuration du domaine"
  69          if [ "$unison" == "" ]; then
  70              SETMYSQL unison 1 "Activation du module de synchronisation de fichiers" 6
  71          elif [ "$unison" == "0" ]; then
  72              CHANGEMYSQL unison 1
  73          fi
  74          if [ "$unison_name" == "" ]; then
  75              unison_name="$netbios_name.$domain"
  76              echo "unison_name=$unison_name"
  77              SETMYSQL unison_name "$unison_name" "nom DNS du serveur unison" 6
  78          fi
  79          . /usr/share/se3/includes/config.inc.sh -csf 
  80     ;;
  81  
  82      *)
  83          echo "postinst called with unknown argument \`$1'" >&2
  84          exit 0
  85      ;;
  86  esac
  87  
  88  exit 0


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1