From 8d651fdf94984cbd8c382d489691e3d443eefff2 Mon Sep 17 00:00:00 2001 From: Tzanetos Balitsaris Date: Sat, 24 May 2014 18:25:10 +0300 Subject: [PATCH] Modify install_rally.sh to install under BSDs The sed command (line 138) responsible for setting the database connection string in the configuration file of Rally, is only GNU sed compatible. The BSD systems (ex. FreeBSD, OS X) use a different sed implementation. The in-place editing differs in these two versions. This commit modifies the sed command in a way to be compatible for both implementations. It creates a temporary file and sends the output of sed to that file, and then it replaces the original file with the temporary one. It is actually what the --in-place switch of GNU sed does in the background [1]. [1] http://www.gnu.org/software/sed/manual/sed.html Change-Id: Idef71121416c1c6c5d70ab6e041f89a7b441b1f9 --- install_rally.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/install_rally.sh b/install_rally.sh index 875c0d0aae..bc2433d0c6 100755 --- a/install_rally.sh +++ b/install_rally.sh @@ -135,7 +135,10 @@ install_rally() { configure_rally() { mkdir -p ${RALLY_DATABASE_DIR} ${RALLY_CONFIGURATION_DIR} cp ${TMP}/etc/rally/rally.conf.sample ${RALLY_CONFIGURATION_DIR}/rally.conf - sed -i "/#connection=/a connection=sqlite:////${RALLY_DATABASE_DIR}/rally.sqlite" ${RALLY_CONFIGURATION_DIR}/rally.conf + + local tmp=$(mktemp /tmp/rally.conf.XXXXX) + sed 's|#connection=|connection=sqlite:///'${RALLY_DATABASE_DIR}'/rally.sqlite|' ${RALLY_CONFIGURATION_DIR}/rally.conf > ${tmp} + mv ${tmp} ${RALLY_CONFIGURATION_DIR}/rally.conf rally-manage db recreate chmod -R go+w ${RALLY_DATABASE_DIR}