[Fusionforge-commits] r12355 - trunk/src

Christian Bayle cbayle at fusionforge.org
Thu Feb 24 21:34:42 CET 2011


Author: cbayle
Date: 2011-02-24 21:34:41 +0100 (Thu, 24 Feb 2011)
New Revision: 12355

Modified:
   trunk/src/fusionforge.spec
Log:
Let's try to fix rpm by initialising some ini files


Modified: trunk/src/fusionforge.spec
===================================================================
--- trunk/src/fusionforge.spec	2011-02-24 18:05:37 UTC (rev 12354)
+++ trunk/src/fusionforge.spec	2011-02-24 20:34:41 UTC (rev 12355)
@@ -577,6 +577,44 @@
 	#%{__sed} -i -e "s!gforge.company.com!$HOSTNAME!g" %{FORGE_CONF_DIR}/local.inc
 	#%{__sed} -i -e "s!gforge.company.com!$HOSTNAME!g" /etc/httpd/conf.d/gforge.conf
 
+; ====================
+	# Installation from scratch, let's generate initial config files
+	if [ ! -e %{FORGE_CONF_DIR}/config.ini.d/rpm-install.ini ] ; then
+		cat > %{FORGE_CONF_DIR}/config.ini.d/rpm-install.ini <<EOF
+; This file was generated by the RPM installation system.
+; You can edit the values here or move them to other files.
+
+[core]
+forge_name=FusionForge
+web_host=$HOSTNAME
+EOF
+	fi
+	if [ ! -e %{FORGE_CONF_DIR}/config.ini.d/rpm-install-secrets.ini ] ; then
+		t=$(mktemp %{FORGE_CONF_DIR}/config.ini.d/rpm-install-secrets.ini.XXXXXX)
+		if [ "$pw" = "" ] ; then
+		    if [ -c /dev/urandom ]; then  # ...using /dev/urandom when possible
+			pw=$(dd if=/dev/urandom count=1 bs=16 2> /dev/null | md5sum | cut -c-32)
+		    else		# ...or something else if need be.
+			pw=$(date +"%s:%N" | md5sum | cut -c-32)
+		    fi
+	fi
+
+	cat > $t <<EOF
+; This file was generated by the RPM installation system.
+; You can edit the values here or move them to other files.
+; These values should not go into world-readable files!
+
+[core]
+database_host=""
+database_name=%{dbname}
+database_user=%{dbuser}
+database_port=5432
+#database_password=$pw
+EOF
+		mv $t %{FORGE_CONF_DIR}/config.ini.d/rpm-install-secrets.ini
+	fi
+; ====================
+
 	/usr/bin/php %{FORGE_DIR}/fusionforge-install-4-config.php >>/var/log/%{name}-install.log 2>&1
 
 	/etc/init.d/httpd restart >/dev/null 2>&1




More information about the Fusionforge-commits mailing list