[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gforge-commits] gforge/deb-specific install-ldap.sh, 1.58, 1.59 install
From: |
lo-lan-do |
Subject: |
[Gforge-commits] gforge/deb-specific install-ldap.sh, 1.58, 1.59 install-db.sh, 1.28, 1.29 install-apache.sh, 1.15, 1.16 |
Date: |
Sat, 10 Jan 2004 16:14:08 -0600 |
Update of /cvsroot/gforge/gforge/deb-specific
In directory db.perdue.net:/tmp/cvs-serv23776/deb-specific
Modified Files:
install-ldap.sh install-db.sh install-apache.sh
Log Message:
Merging Branch_3_1 back into the trunk (at tag Branch_3_1-merge_3).
Index: install-ldap.sh
===================================================================
RCS file: /cvsroot/gforge/gforge/deb-specific/install-ldap.sh,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- install-ldap.sh 10 Nov 2003 22:49:31 -0000 1.58
+++ install-ldap.sh 10 Jan 2004 22:14:05 -0000 1.59
@@ -122,6 +122,22 @@
fi
}
+# Check admin password
+check_password() {
+ tmpcheckpwd=$(mktemp $tmpfile_pattern)
+ if ldapsearch -D $slapd_admin_dn -x -w$slapd_admin_passwd -n
$slapd_admin_dn > $tmpcheckpwd 2>&1 ; then
+ echo "Password checked OK." > /dev/null
+ else
+ if grep -q "ldap_bind: Invalid credentials" $tmpcheckpwd ; then
+ rm $tmpcheckpwd
+ exit 5 # Wrong password
+ else
+ rm $tmpcheckpwd
+ exit 99 # Unknown error
+ fi
+ fi
+}
+
# Should I do something for /etc/pam_ldap.conf ?
modify_pam_ldap(){
echo -n
@@ -295,15 +311,13 @@
# Load ldap database from gforge database
load_ldap(){
- if [ "x$slapd_admin_passwd" != "x" ] ; then
-
- # First, let's make sure our base DN exists
- if ! exists_dn $gforge_base_dn ; then
- tmpldif=$(mktemp $tmpfile_pattern)
- tmpldifadd=$(mktemp $tmpfile_pattern)
- tmpldifmod=$(mktemp $tmpfile_pattern)
- dc=$(echo $gforge_base_dn | cut -d, -f1 | cut -d= -f2)
- echo >> $tmpldif <<EOF
+ # First, let's make sure our base DN exists
+ if ! exists_dn $gforge_base_dn ; then
+ tmpldif=$(mktemp $tmpfile_pattern)
+ tmpldifadd=$(mktemp $tmpfile_pattern)
+ tmpldifmod=$(mktemp $tmpfile_pattern)
+ dc=$(echo $gforge_base_dn | cut -d, -f1 | cut -d= -f2)
+ echo >> $tmpldif <<EOF
dn: $sys_ldap_base_dn
dc: $dc
objectClass: top
@@ -311,44 +325,12 @@
objectClass: domainRelatedObject
associatedDomain: $sys_default_domain
EOF
- # echo "Filling LDAP with database"
- if ! eval "ldapadd -r -c -D '$slapd_admin_dn' -x
-w'$slapd_admin_passwd' -f $tmpldif > $tmpldifadd 2>&1" ; then
- # Some entries could not be added (already there?)
- # Therefore, we try to modify them
- if ! eval "ldapmodify -r -c -D '$slapd_admin_dn' -x
-w'$slapd_admin_passwd' -f $tmpldif > $tmpldifmod 2>&1" ; then
- echo "WARNING WARNING WARNING Something wrong happened in
ldapmodify"
- echo "please check and report following error"
- echo
========================================================================================
- cat $tmpldifmod | perl -pi -e 's/^\n//' | perl -pi -e
's/modifying.*\"\n//'
- echo
========================================================================================
- echo SEE ALSO result of ldapadd in:
- echo $tmpldifadd
- echo AND result of ldapmodify in:
- echo $tmpldifmod
- echo AND ldif file in:
- echo $tmpldif
- echo
========================================================================================
- exit 4
- fi
- fi
- rm -f $tmpldif $tmpldifadd $tmpldifmod
- fi
-
-# CLEANUP: should be done with the robot
- # This loads the ldap database
- # echo "Our base DN is $gforge_base_dn"
- # echo "Creating ldif file from database"
- tmpldif=$(mktemp $tmpfile_pattern)
- tmpldifadd=$(mktemp $tmpfile_pattern)
- tmpldifmod=$(mktemp $tmpfile_pattern)
- dc=$(echo $gforge_base_dn | cut -d, -f1 | cut -d= -f2)
- /usr/lib/gforge/bin/sql2ldif.pl >> $tmpldif
# echo "Filling LDAP with database"
- if ! eval "ldapadd -r -c -D '$slapd_admin_dn' -x
-w'$slapd_admin_passwd' -f $tmpldif > $tmpldifadd 2>&1" ; then
- # Some entries could not be added (already there)
- # Therefore, we have to modify them
- if ! eval "ldapmodify -r -c -D '$slapd_admin_dn' -x
-w'$slapd_admin_passwd' -f $tmpldif > $tmpldifmod 2>&1" ; then
- echo "WARNING WARNING WARNING Something wrong happened in
ldapmodify"
+ if ! eval "ldapadd -r -c -D '$robot_dn' -x -w'$robot_passwd' -f
$tmpldif > $tmpldifadd 2>&1" ; then
+ # Some entries could not be added (already there?)
+ # Therefore, we try to modify them
+ if ! eval "ldapmodify -r -c -D '$robot_dn' -x -w'$robot_passwd' -f
$tmpldif > $tmpldifmod 2>&1" ; then
+ echo "WARNING WARNING WARNING Something wrong happened in
ldapmodify"
echo "please check and report following error"
echo
========================================================================================
cat $tmpldifmod | perl -pi -e 's/^\n//' | perl -pi -e
's/modifying.*\"\n//'
@@ -360,17 +342,42 @@
echo AND ldif file in:
echo $tmpldif
echo
========================================================================================
- exit 4
- fi
+ exit 99
+ fi
fi
rm -f $tmpldif $tmpldifadd $tmpldifmod
- else
- echo "It seems the admin password is not known to me."
- echo "I can't fill the LDAP directory without it."
- echo "Normally, libpam-ldap stores this password in /etc/ldap.secret."
- echo "Please check that file."
- exit 1
fi
+
+ # CLEANUP: should be done with the robot
+ # This loads the ldap database
+ # echo "Our base DN is $gforge_base_dn"
+ # echo "Creating ldif file from database"
+ tmpldif=$(mktemp $tmpfile_pattern)
+ tmpldifadd=$(mktemp $tmpfile_pattern)
+ tmpldifmod=$(mktemp $tmpfile_pattern)
+ dc=$(echo $gforge_base_dn | cut -d, -f1 | cut -d= -f2)
+ /usr/lib/gforge/bin/sql2ldif.pl >> $tmpldif
+ # echo "Filling LDAP with database"
+ if ! eval "ldapadd -r -c -D '$robot_dn' -x -w'$robot_passwd' -f $tmpldif >
$tmpldifadd 2>&1" ; then
+ # Some entries could not be added (already there)
+ # Therefore, we have to modify them
+ if ! eval "ldapmodify -r -c -D '$robot_dn' -x -w'$robot_passwd' -f
$tmpldif > $tmpldifmod 2>&1" ; then
+ echo "WARNING WARNING WARNING Something wrong happened in
ldapmodify"
+ echo "please check and report following error"
+ echo
========================================================================================
+ cat $tmpldifmod | perl -pi -e 's/^\n//' | perl -pi -e
's/modifying.*\"\n//'
+ echo
========================================================================================
+ echo SEE ALSO result of ldapadd in:
+ echo $tmpldifadd
+ echo AND result of ldapmodify in:
+ echo $tmpldifmod
+ echo AND ldif file in:
+ echo $tmpldif
+ echo
========================================================================================
+ exit 99
+ fi
+ fi
+ rm -f $tmpldif $tmpldifadd $tmpldifmod
}
print_ldif_default(){
@@ -405,9 +412,13 @@
# The first account is only used in a multiserver SF
check_server
if ! exists_dn "$robot_dn" || ! exists_dn "ou=People,$gforge_base_dn" ;
then
+ check_password
echo "Adding robot accounts and sub-trees"
dc=$(echo $gforge_base_dn | cut -d, -f1 | cut -d= -f2)
- { eval "ldapadd -r -c -D '$slapd_admin_dn' -x -w'$slapd_admin_passwd'
$DEVNULL12" || true ; } <<-FIN
+ tmpldif=$(mktemp $tmpfile_pattern)
+ tmpldifadd=$(mktemp $tmpfile_pattern)
+ tmpldifmod=$(mktemp $tmpfile_pattern)
+ echo > $tmpldif <<-FIN
dn: $gforge_base_dn
objectClass: domain
dc: $dc
@@ -443,20 +454,51 @@
description: SF the Robot
objectClass: organizationalRole
objectClass: simpleSecurityObject
-userPassword: {CRYPT}xxxxx
+userPassword: $robot_cryptedpasswd
cn: SF_robot
+
+dn: uid=dummy,ou=People,$gforge_base_dn
+uid: dummy
+cn: Dummy User
+objectClass: account
+objectClass: posixAccount
+objectClass: top
+objectClass: shadowAccount
+objectClass: debGforgeAccount
+userPassword: {crypt}x
+shadowLastChange: 10879
+shadowMax: 99999
+shadowWarning: 7
+loginShell: /bin/false
+debGforgeCvsShell: /bin/false
+uidNumber: 9999
+gidNumber: 9999
+homeDirectory: /tmp
+gecos: Dummy User
+
FIN
+
+ if ! eval "ldapadd -r -c -D '$slapd_admin_dn' -x
-w'$slapd_admin_passwd' > $tmpldifadd 2>&1" < $tmpldif ; then
+ if ! eval "ldapmodify -r -c -D '$slapd_admin_dn' -x
-w'$slapd_admin_passwd' > $tmpldifadd 2>&1" < $tmpldif ; then
+ echo "WARNING WARNING WARNING Something wrong happened when
setting up the robot"
+ echo "please check and report following error"
+ echo
========================================================================================
+ cat $tmpldifmod | perl -pi -e 's/^\n//' | perl -pi -e
's/modifying.*\"\n//'
+ echo
========================================================================================
+ echo SEE ALSO result of ldapadd in:
+ echo $tmpldifadd
+ echo AND result of ldapmodify in:
+ echo $tmpldifmod
+ echo AND ldif file in:
+ echo $tmpldif
+ echo
========================================================================================
+ exit 99
+ fi
+ fi
else
echo "Robot accounts already present, not adding"
fi
- check_server
- eval "ldapmodify -v -c -D '$slapd_admin_dn' -x -w'$slapd_admin_passwd'
$DEVNULL12" <<-FIN
-dn: $robot_dn
-changetype: modify
-replace: userPassword
-userPassword: $robot_cryptedpasswd
-FIN
check_server
# echo "Testing LDAP"
if ! exists_dn uid=dummy,ou=People,$gforge_base_dn ; then
@@ -553,6 +595,7 @@
echo $robot_dn
} | sort -u # ...then uniquify that list
}
+ check_password
get_our_entries | eval "ldapdelete -D '$slapd_admin_dn' -x
-w'$slapd_admin_passwd' -c $DEVNULL12" || true
;;
reset)
Index: install-db.sh
===================================================================
RCS file: /cvsroot/gforge/gforge/deb-specific/install-db.sh,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- install-db.sh 22 Nov 2003 17:41:56 -0000 1.28
+++ install-db.sh 10 Jan 2004 22:14:05 -0000 1.29
@@ -91,7 +91,7 @@
if dpkg --compare-versions $pg_version lt 7.3 ; then
if su -s /bin/sh postgres -c "createuser --no-createdb --no-adduser
$db_user" 1> $tmp1 2> $tmp2 \
&& [ "$(head -1 $tmp1)" = 'CREATE USER' ] \
- || grep -q "^ERROR: CREATE USER: user name \"$db_user\"
already exists$" $tmp2 ; then
+ || grep -q "^ERROR: .* user name \"$db_user\" already exists$"
$tmp2 ; then
# Creation OK or user already existing -- no problem here
rm -f $tmp1 $tmp2
else
@@ -131,7 +131,7 @@
tmp2=$(mktemp /tmp/$pattern)
if su -s /bin/sh postgres -c "createdb --encoding=UNICODE $db_name" 1>
$tmp1 2> $tmp2 \
&& [ "$(head -1 $tmp1)" = 'CREATE DATABASE' ] \
- || grep -q "ERROR: CREATE DATABASE: database \"$db_name\" already
exists" $tmp2 ; then
+ || grep -q "ERROR: .* database \"$db_name\" already exists" $tmp2 ;
then
# Creation OK or database already existing -- no problem here
echo -n ""
rm -f $tmp1 $tmp2
@@ -243,7 +243,7 @@
fi
echo "Restoring $RESTFILE"
su -s /bin/sh postgres -c "dropdb $db_name" || true
- su -s /bin/sh postgres -c "createdb $db_name" || true
+ su -s /bin/sh postgres -c "createdb --encoding=UNICODE $db_name" ||
true
su -s /bin/sh postgres -c "/usr/lib/postgresql/bin/psql -f $RESTFILE
$db_name"
perl -pi -e "s/### Next line inserted by GForge restore\n//"
/etc/postgresql/pg_hba.conf
perl -pi -e "s/$localtrust\n//" /etc/postgresql/pg_hba.conf
Index: install-apache.sh
===================================================================
RCS file: /cvsroot/gforge/gforge/deb-specific/install-apache.sh,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- install-apache.sh 22 Nov 2003 17:41:56 -0000 1.15
+++ install-apache.sh 10 Jan 2004 22:14:05 -0000 1.16
@@ -14,28 +14,17 @@
case "$1" in
configure-files)
- # Make sure Apache sees us
- if [ -e /etc/apache/httpd.conf ] ; then
- cp -a /etc/apache/httpd.conf /etc/apache/httpd.conf.gforge-new
-
- if ! grep -q "^Include /etc/gforge/httpd.conf"
/etc/apache/httpd.conf.gforge-new ; then
- echo "### Next line inserted by GForge install" >>
/etc/apache/httpd.conf.gforge-new
- echo "Include /etc/gforge/httpd.conf" >>
/etc/apache/httpd.conf.gforge-new
- fi
- fi
-
- if [ -e /etc/apache-ssl/httpd.conf ] ; then
- cp -a /etc/apache-ssl/httpd.conf
/etc/apache-ssl/httpd.conf.gforge-new
- perl -pi -e "s/# *LoadModule php4_module/LoadModule php4_module/gi"
/etc/apache-ssl/httpd.conf.gforge-new
- perl -pi -e "s/# *LoadModule apache_ssl_module/LoadModule
apache_ssl_module/gi" /etc/apache-ssl/httpd.conf.gforge-new
- perl -pi -e "s/# *LoadModule env_module/LoadModule env_module/gi"
/etc/apache-ssl/httpd.conf.gforge-new
- perl -pi -e "s/# *LoadModule vhost_alias_module/LoadModule
vhost_alias_module/gi" /etc/apache-ssl/httpd.conf.gforge-new
-
- if ! grep -q "^Include /etc/gforge/httpd.conf"
/etc/apache-ssl/httpd.conf.gforge-new ; then
- echo "### Next line inserted by GForge install" >>
/etc/apache-ssl/httpd.conf.gforge-new
- echo "Include /etc/gforge/httpd.conf" >>
/etc/apache-ssl/httpd.conf.gforge-new
+ # Remove old hack to have Apache see us
+ for flavour in apache apache-perl apache-ssl ; do
+ if [ -e /etc/$flavour/httpd.conf ] && grep -q "Include
/etc/gforge/httpd.conf" /etc/$flavour/httpd.conf ; then
+ cp -a /etc/$flavour/httpd.conf
/etc/$flavour/httpd.conf.gforge-new
+ pattern=$(basename $0)
+ tmp=$(mktemp /tmp/$pattern.XXXXXX)
+ grep -v "Include /etc/gforge/httpd.conf\|### Next line inserted
by GForge install" /etc/$flavour/httpd.conf.gforge-new > $tmp
+ cat $tmp > /etc/$flavour/httpd.conf.gforge-new
+ rm -f $tmp
fi
- fi
+ done
# Make sure pgsql, ldap and gd are enabled in the PHP config files
cp -a /etc/php4/apache/php.ini /etc/php4/apache/php.ini.gforge-new
@@ -64,54 +53,41 @@
;;
configure)
/usr/lib/gforge/bin/prepare-vhosts-file.pl
- if [ -e /etc/apache/httpd.conf ] ; then
- /usr/sbin/modules-config apache enable mod_php4
- /usr/sbin/modules-config apache enable mod_ssl
- /usr/sbin/modules-config apache enable mod_env
- /usr/sbin/modules-config apache enable mod_vhost_alias
- fi
- if [ -e /etc/apache-perl/httpd.conf ] ; then
- /usr/sbin/modules-config apache-perl enable mod_php4
- /usr/sbin/modules-config apache-perl enable mod_ssl
- /usr/sbin/modules-config apache-perl enable mod_env
- /usr/sbin/modules-config apache-perl enable mod_vhost_alias
- fi
- if [ -e /etc/apache-ssl/httpd.conf ] ; then
- /usr/sbin/modules-config apache-ssl enable mod_php4
- /usr/sbin/modules-config apache-ssl enable mod_env
- /usr/sbin/modules-config apache-ssl enable mod_vhost_alias
- fi
- if [ -x /usr/sbin/apache ]; then
- invoke-rc.d apache restart || true
- fi
- if [ -x /usr/sbin/apache-perl ]; then
- invoke-rc.d apache-perl restart || true
- fi
- if [ -x /usr/sbin/apache-ssl ]; then
- invoke-rc.d apache-ssl restart || true
- fi
+ for flavour in apache apache-perl apache-ssl ; do
+ if [ -e /etc/$flavour/httpd.conf ] ; then
+ /usr/sbin/modules-config $flavour enable mod_php4
+ if [ $flavour != apache-ssl ] ; then
+ /usr/sbin/modules-config $flavour enable mod_ssl
+ fi
+ /usr/sbin/modules-config $flavour enable mod_env
+ /usr/sbin/modules-config $flavour enable mod_vhost_alias
+ [ ! -e /etc/$flavour/conf.d/gforge.httpd.conf ] && ln -s
/etc/gforge/httpd.conf /etc/$flavour/conf.d/gforge.httpd.conf
+ fi
+ if [ -x /usr/sbin/$flavour ]; then
+ invoke-rc.d $flavour restart || true
+ fi
+ done
;;
purge-files)
- cp -a /etc/apache/httpd.conf /etc/apache/httpd.conf.gforge-new
- if grep -q "Include /etc/gforge/httpd.conf"
/etc/apache/httpd.conf.gforge-new ; then
- pattern=$(basename $0)
- tmp=$(mktemp /tmp/$pattern.XXXXXX)
- grep -v "Include /etc/gforge/httpd.conf\|### Next line inserted by
GForge install" /etc/apache/httpd.conf.gforge-new > $tmp
- cat $tmp > /etc/apache/httpd.conf.gforge-new
- rm -f $tmp
- fi
+ for flavour in apache apache-perl apache-ssl ; do
+ if [ -e /etc/$flavour/httpd.conf ] && grep -q "Include
/etc/gforge/httpd.conf" /etc/$flavour/httpd.conf ; then
+ cp -a /etc/$flavour/httpd.conf
/etc/$flavour/httpd.conf.gforge-new
+ pattern=$(basename $0)
+ tmp=$(mktemp /tmp/$pattern.XXXXXX)
+ grep -v "Include /etc/gforge/httpd.conf\|### Next line inserted
by GForge install" /etc/$flavour/httpd.conf.gforge-new > $tmp
+ cat $tmp > /etc/$flavour/httpd.conf.gforge-new
+ rm -f $tmp
+ fi
+ done
;;
purge)
- if [ -x /usr/sbin/apache ]; then
- invoke-rc.d apache restart || true
- fi
- if [ -x /usr/sbin/apache-perl ]; then
- invoke-rc.d apache-perl restart || true
- fi
- if [ -x /usr/sbin/apache-ssl ]; then
- invoke-rc.d apache-ssl restart || true
- fi
+ for flavour in apache apache-perl apache-ssl ; do
+ [ ! -e /etc/$flavour/conf.d/gforge.httpd.conf ] && rm -f
/etc/$flavour/conf.d/gforge.httpd.conf
+ if [ -x /usr/sbin/$flavour ]; then
+ invoke-rc.d $flavour restart || true
+ fi
+ done
;;
*)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gforge-commits] gforge/deb-specific install-ldap.sh, 1.58, 1.59 install-db.sh, 1.28, 1.29 install-apache.sh, 1.15, 1.16,
lo-lan-do <=
- Prev by Date:
[Gforge-commits] gforge/debian/dsf-helper replace-files.prerm, 1.3, 1.4 replace-files.postinst, 1.3, 1.4
- Next by Date:
[Gforge-commits] gforge/etc/local.d 25features,NONE,1.1
- Previous by thread:
[Gforge-commits] gforge/debian/dsf-helper replace-files.prerm, 1.3, 1.4 replace-files.postinst, 1.3, 1.4
- Next by thread:
[Gforge-commits] gforge/etc/local.d 25features,NONE,1.1
- Index(es):