#! /bin/sh
+# This script is used by the debian and RPM packages to set up fusionforge.
usage() {
- echo "$0: [-interact] [-help] [-debug] [-confdir confdir] [-input conffile] [-output conffile] [-httpdconf gforgehttpdconf] [-httpdsecrets gforgehttpdsecrets] [-localinc gforgelocalinc] [-example|-fhs] [-clean] [-noapache] [-dovhost] [-home homepath] [-group grouppath] [-listen80|nolisten80]"
+ echo "$0: [-interact] [-help] [-debug] [-confdir confdir] [-input conffile] [-output conffile] [-httpdconf gforgehttpdconf] [-httpdsecrets gforgehttpdsecrets] [-localinc gforgelocalinc] [-example|-fhs] [-clean] [-noapache] [-dovhost] [-novhost] [-home homepath] [-group grouppath] [-listen80|nolisten80] [-nossl]"
}
getval(){
computedefault(){
echo "Calculating defaults"
# This is used to make a default working gforge.conf
- DEFAULTsystem_name=MyGForge
+ DEFAULTsystem_name=MyForge
DEFAULTdomain_name=`hostname -f`
DEFAULTserver_admin=webmaster@$DEFAULTdomain_name
- DEFAULTdb_host=`hostname -i`
+ DEFAULTdb_host=
+ DEFAULTdb_port=
DEFAULTdb_name=gforge
DEFAULTdb_user=gforge
DEFAULTdb_password=$(dd if=/dev/urandom count=256 bs=1 2> /dev/null | md5sum | cut -b1-8)
DEFAULTshell_host=shell.$DEFAULTdomain_name
DEFAULTusers_host=users.$DEFAULTdomain_name
DEFAULTlists_host=lists.$DEFAULTdomain_name
- DEFAULTdocs_host=gfdocs.$DEFAULTdomain_name
+ # The following three have to be synced when domain_name changes
+ # and docs_host is supposed not to be used
+ #DEFAULTdocs_host=gfdocs.$DEFAULTdomain_name
DEFAULTjabber_host=jabber.$DEFAULTdomain_name
- DEFAULTdownload_host=download.$DEFAULTdomain_name
DEFAULTupload_host=upload.$DEFAULTdomain_name
- DEFAULTstatsadmin_groupid=2
- DEFAULTnewsadmin_groupid=3
+ #
+ DEFAULTdownload_host=download.$DEFAULTdomain_name
+ # The following is upload host and dir for FRS
+ DEFAULTftpuploadhost=upload.$DEFAULTdomain_name
+ DEFAULTftpuploaddir=$GFGDIR/var/lib/gforge/chroot/ftproot
+ #
+ DEFAULTnewsadmin_groupid=2
+ DEFAULTstatsadmin_groupid=3
DEFAULTpeerrating_groupid=4
+ DEFAULTtemplate_project=5
DEFAULTadmin_login=admin
DEFAULTadmin_password=$(dd if=/dev/urandom count=256 bs=1 2> /dev/null | md5sum | cut -b1-8)
DEFAULTskill_list="Ada;C;C++;HTML;LISP;Perl;PHP;Python;SQL"
DEFAULTldap_host=localhost
DEFAULTldap_base_dn="dc=`echo $DEFAULTdomain_name | sed 's/\./,dc=/g'`"
DEFAULTldap_web_add_password=$(dd if=/dev/urandom count=256 bs=1 2> /dev/null | md5sum | cut -b1-8)
+ DEFAULTsys_path_to_mailman=$(if test -d /usr/lib/mailman; then echo /usr/lib/mailman; else echo /var/mailman; fi)
DEFAULTcgidir=$CGIDIR
DEFAULTcronolog_path=$(findcronolog)
+ DEFAULTsys_sendmail_path=$(findsendmail)
DEFAULTsys_path_to_jpgraph=/usr/share/jpgraph/
- DEFAULTsys_path_to_scmweb=/usr/lib/gforge/bin/
+ DEFAULTsys_path_to_scmweb=/usr/share/gforge/bin/
DEFAULTgforge_chroot=$CHROOT
DEFAULTgforge_etc=$ETCDIR
DEFAULTsys_custom_path=$ETCDIR/custom
DEFAULThomedir=$HOMEPATH
DEFAULTcvsdir=$CVSPATH
DEFAULTsvndir=$SVNPATH
+ # The place where file uploaded with http are stored for download
DEFAULTuploaddir=$GFGDIR/var/lib/gforge/download/
DEFAULTsys_urlroot=$SHAREDIR/www/
DEFAULTsys_jabber_pass=$(dd if=/dev/urandom count=256 bs=1 2> /dev/null | md5sum | cut -b1-8)
DEFAULTsys_account_manager_type=$SYSTEM
DEFAULTsys_use_jabber=0
DEFAULTsys_use_auth_ldap=1
- DEFAULTsys_ldap_auth_host=localhost
+ # Couldn't find where this is used, maybe some rest of ext auth
+ #DEFAULTsys_ldap_auth_host=localhost
DEFAULTsys_ldap_auth_port=389
DEFAULTsys_ldap_auth_version=3
DEFAULTsys_ldap_auth_dn="dc=`echo $DEFAULTdomain_name | sed 's/\./,dc=/g'`"
DEFAULTsys_use_ftp=true
DEFAULTsys_use_trove=true
DEFAULTsys_use_snippet=true
+ DEFAULTsys_use_shell=true
+ DEFAULTsys_use_ratings=true
DEFAULTsys_use_ssl=false
DEFAULTsys_use_people=true
DEFAULTsys_use_ftpuploads=false
+ DEFAULTsys_use_diary=true
+ DEFAULTsys_use_bookmarks=true
+ DEFAULTsys_use_project_tags=true
+ DEFAULTsys_use_project_full_list=true
DEFAULTsys_use_gateways=true
DEFAULTsys_use_project_vhost=true
DEFAULTsys_use_project_database=false
DEFAULTsys_use_project_multimedia=false
+ DEFAULTsys_use_private_project=true
DEFAULTsys_project_reg_restricted=false
DEFAULTsys_user_reg_restricted=false
- DEFAULTsys_localization_enable_caching=true
- DEFAULTsys_localization_cache_path=$GFGDIR/var/cache/gforge/
- DEFAULTsys_localization_enable_timestamp_checking=true
+ DEFAULTsys_require_accept_conditions=false
+ DEFAULTsys_require_unique_email=false
DEFAULTsys_localinc=$ETCDIR/local.inc
DEFAULTsys_jabber_pass=$(dd if=/dev/urandom count=256 bs=1 2> /dev/null | md5sum | cut -b1-8)
- DEFAULTsys_plugins_path=/usr/lib/gforge/plugins/
+ DEFAULTsys_plugins_path=$SHAREDIR/plugins/
DEFAULTsys_sslcrt=$(findcrt)
DEFAULTsys_sslkey=$(findkey)
DEFAULTnoreply_to_bitbucket=true
+ DEFAULTsys_simple_dns=true
DEFAULTsys_apache_user=$(findapacheowner)
DEFAULTsys_apache_group=$(findapacheowner)
+ DEFAULTsys_forum_return_domain=$DEFAULTdomain_name
+ DEFAULTsys_block_anonymous_downloads=false
+ DEFAULTsys_urlprefix=/
+ DEFAULTdovhost=$dovhost
#
# TODO
#usr_lib_gforge=$GFGDIR
}
findcrt(){
- if [ -f /etc/apache2/ssl/apache.pem ]
- then
- echo /etc/apache2/ssl/apache.pem
- else
- if [ -f /etc/apache/ssl.crt/server.crt ]
- then
- echo /etc/apache/ssl.crt/server.crt
- fi
+ if [ -e /etc/gforge/ssl-cert.pem ] ; then
+ echo /etc/gforge/ssl-cert.pem
+ elif [ -f /etc/apache2/ssl/apache.pem ] ; then
+ echo /etc/apache2/ssl/apache.pem
+ elif [ -f /etc/apache/ssl.crt/server.crt ] ; then
+ echo /etc/apache/ssl.crt/server.crt
fi
}
findkey(){
- if [ -f /etc/apache2/ssl/apache.pem ]
- then
- echo /etc/apache2/ssl/apache.pem
- else
- if [ -f /etc/apache/ssl.key/server.key ]
- then
- echo /etc/apache/ssl.key/server.key
- fi
+ if [ -e /etc/gforge/ssl-cert.key ] ; then
+ echo /etc/gforge/ssl-cert.key
+ elif [ -f /etc/apache2/ssl/apache.pem ] ; then
+ echo /etc/apache2/ssl/apache.pem
+ elif [ -f /etc/apache/ssl.key/server.key ] ; then
+ echo /etc/apache/ssl.key/server.key
fi
}
-
findcronolog(){
- if [ -x /usr/sbin/cronolog ]
+ if [ -x /usr/bin/cronolog ]
then
- echo /usr/sbin/cronolog
+ echo /usr/bin/cronolog
else
if [ -x /usr/sbin/cronolog ]
then
- echo /usr/bin/cronolog
+ echo /usr/sbin/cronolog
else
which cronolog
fi
fi
}
+findsendmail(){
+ if [ -x /usr/sbin/sendmail ]
+ then
+ echo /usr/sbin/sendmail
+ else
+ which sendmail
+ fi
+}
findapacheowner(){
if grep 'Red Hat' /etc/issue > /dev/null; then
echo apache
readdefault $CONFFILEIN.new
fi
- if [ "$interact" == true ]
+ if [ "$interact" = true ]
then
echo "Enter values or type enter for defaults:"
# Here is the fun II
mv $CONFFILEIN.new $CONFFILEIN
# Fill in the blanks
- if [ "$dovhost" == true ]
+ EXCLUDEVHOST=''
+ if [ "$dovhost" = true ]
then
- VHOST=$ETCDIR/httpd.d/55vhost
+ EXCLUDEVHOST=".vhost\|"
fi
+ #
rm -f $ETCDIR/httpd.d/10cvs
rm -f $ETCDIR/httpd.d/10scmcvs
rm -f $ETCDIR/httpd.d/10scmcvsauth
rm -f $ETCDIR/httpd.d/11scmcvshttp
rm -f $ETCDIR/httpd.d/11scmsvnhttp
rm -f $ETCDIR/httpd.d/12scmcvshttp.ssl
- for i in $(ls -1 $ETCDIR/httpd.d/[0-4][0-9]* 2> /dev/null | grep -v dpkg) $VHOST $(ls -1 $ETCDIR/httpd.d/[6-9][0-9]* 2> /dev/null | grep -v dpkg) $ETCDIR/httpd.d/httpd.secrets
+ #rm -f $ETCDIR/httpd.d/20list
+ #
+
+ find $ETCTEMPLATEDIR/httpd.d -follow -type f -regex "$ETCTEMPLATEDIR/httpd.d/\([a-z0-9]+\|_?([a-z0-9_.]+-)+[a-z0-9]+\|[a-z0-9][a-z0-9-]*\)\(\|.ssl\|.secrets\|$EXCLUDEVHOST.vhost.ssl\)" | sort | while read i
do
+ if [ "$ETCTEMPLATEDIR" != "$ETCDIR" -a -f $ETCDIR/httpd.d/`basename $i` ]
+ then
+ if diff -q $i $ETCDIR/httpd.d/`basename $i`
+ then
+ rm -f $ETCDIR/httpd.d/`basename $i`
+ else
+ i=$ETCDIR/httpd.d/`basename $i`
+ fi
+ fi
$BINDIR/fill-in-the-blanks.pl $i $ETCDIR/`basename $i`.gforge-new $CONFFILEOUT
done
- if [ $listen80 == false ]
+ if [ $listen80 = false ]
then
rm -f $ETCDIR/00listen80.gforge-new
fi
+ if [ $usessl = false -o -z "$(findkey)" -o -z "$(findcrt)" ]
+ then
+ echo "SSL Disabled"
+ rm -f $ETCDIR/[0-9][0-9]*.ssl.gforge-new
+ else
+ echo "SSL Enabled"
+ fi
+
echo "Creating $HTTPDCONF"
ls $ETCDIR/[0-9][0-9]*.gforge-new | sort | xargs cat > $HTTPDCONF
rm $ETCDIR/[0-9][0-9]*.gforge-new
rm $ETCDIR/httpd.secrets.gforge-new
echo "Creating $LOCALINC"
- for i in $ETCDIR/local.d/0* $ETCDIR/local.d/10database.$database $ETCDIR/local.d/1[1-9]* $ETCDIR/local.d/[2-9]*
+ find $ETCTEMPLATEDIR/local.d -follow -type f -regex "$ETCTEMPLATEDIR/local.d/\([a-z0-9]+\|_?([a-z0-9_.]+-)+[a-z0-9]+\|[a-z0-9][a-z0-9-]*\)\(\|.$database\)" | sort | while read i
do
+ if [ "$ETCTEMPLATEDIR" != "$ETCDIR" -a -f $ETCDIR/local.d/`basename $i` ]
+ then
+ if diff -q $i $ETCDIR/local.d/`basename $i`
+ then
+ rm -f $ETCDIR/local.d/`basename $i`
+ else
+ i=$ETCDIR/local.d/`basename $i`
+ fi
+ fi
$BINDIR/fill-in-the-blanks.pl $i $CONFFILEOUTDIR/`basename $i` $CONFFILEOUT
done
- ls $CONFFILEOUTDIR/0* $CONFFILEOUTDIR/10database.$database $CONFFILEOUTDIR/1[1-9]* $CONFFILEOUTDIR/[2-9]* | grep -v dpkg | sort | xargs cat > $LOCALINC
- rm $CONFFILEOUTDIR/0* $CONFFILEOUTDIR/10database.$database $CONFFILEOUTDIR/1[1-9]* $CONFFILEOUTDIR/[2-9]*
+ (find $CONFFILEOUTDIR -follow -type f -regex "$CONFFILEOUTDIR/\([a-z0-9]+\|_?([a-z0-9_.]+-)+[a-z0-9]+\|[a-z0-9][a-z0-9-]*\)\(\|.$database\)" | sort | xargs cat ) > $LOCALINC
+ find $CONFFILEOUTDIR -follow -type f -regex "$CONFFILEOUTDIR/\([a-z0-9]+\|_?([a-z0-9_.]+-)+[a-z0-9]+\|[a-z0-9][a-z0-9-]*\)\(\|.$database\)" -print0 | xargs -0 rm
echo "Creating other includes"
#for i in $ETCDIR/templates/[a-z]*
- find $ETCDIR/templates -name '[a-z]*' -maxdepth 1 -type f | while read i
+ find $ETCTEMPLATEDIR/templates -follow -type f -regex "$ETCTEMPLATEDIR/templates/[a-z].*" | while read i
do
+ if [ "$ETCTEMPLATEDIR" != "$ETCDIR" -a -f $ETCDIR/templates/`basename $i` ]
+ then
+ if diff -q $i $ETCDIR/templates/`basename $i`
+ then
+ rm -f $ETCDIR/templates/`basename $i`
+ else
+ i=$ETCDIR/templates/`basename $i`
+ fi
+ fi
$BINDIR/fill-in-the-blanks.pl $i $CONFFILEOUTDIR/`basename $i` $CONFFILEOUT
done
chmod 600 $HTTPDSECRETS $CONFFILEIN $CONFFILEOUT
ETCDIR=`pwd`/etc
+ETCTEMPLATEDIR=`pwd`/etc
BINDIR=`pwd`/utils
CGIDIR=`pwd`/cgi-bin
GFGDIR=`pwd`
HOMEPATH=/home
GROUPPATH=/home/groups
CVSPATH=/cvsroot
+if [ ! -e /cvsroot ] && [ -e /var/lib/gforge/chroot/cvsroot ] ; then
+ CVSPATH=/var/lib/gforge/chroot/cvsroot
+fi
SVNPATH=/svnroot
+if [ ! -e /svnroot ] && [ -e /var/lib/gforge/chroot/svnroot ] ; then
+ SVNPATH=/var/lib/gforge/chroot/svnroot
+fi
SHAREDIR=`pwd`
LIBDIR=`pwd`
CONFFILEOUTDIR=$ETCDIR
HTTPDCONF=$ETCDIR/httpd.conf
HTTPDSECRETS=$ETCDIR/httpd.secrets
SYSTEM=pgsql
-export ETCDIR BINDIR GFGDIR CONFFILEOUTDIR CONFFILEIN CONFFILEOUT LOCALINC HTTPDCONF HTTPDSECRETS DOAPACHE SYSTEM
+export ETCDIR ETCTEMPLATEDIR BINDIR GFGDIR CONFFILEOUTDIR CONFFILEIN CONFFILEOUT LOCALINC HTTPDCONF HTTPDSECRETS DOAPACHE SYSTEM
interact=false
noapache=false
database=env
-dovhost=false
listen80=true
+usessl=true
+dovhost=true
+
while [ $# -ne 0 ]
do
-fhs )
shift
ETCDIR=/etc/gforge
- BINDIR=/usr/lib/gforge/bin
- CGIDIR=/usr/lib/gforge/cgi-bin
+ ETCTEMPLATEDIR=/usr/share/gforge/etc
+ BINDIR=/usr/share/gforge/bin
+ CGIDIR=/usr/share/gforge/cgi-bin
GFGDIR=''
HOMEPATH=/home/users
GROUPPATH=/home/groups
CHROOT=/var/lib/gforge/chroot
SHAREDIR=/usr/share/gforge
- LIBDIR=/usr/lib/gforge
+ LIBDIR=/usr/share/gforge
CONFFILEOUTDIR=/etc/gforge
CONFFILEIN=/etc/gforge/gforge.conf
CONFFILEOUT=/etc/gforge/gforge.conf
-noapache )
noapache=true
;;
+ -novhost )
+ dovhost=false
+ ;;
-dovhost )
dovhost=true
;;
-nolisten80 )
listen80=false
;;
+ -nossl )
+ usessl=false
+ ;;
-example )
shift
CONFFILEIN=$ETCDIR/gforge.conf.example