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
This commit is contained in:
Tzanetos Balitsaris 2014-05-24 18:25:10 +03:00
parent 0116fa6d7f
commit 8d651fdf94

View File

@ -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=<None>/a connection=sqlite:////${RALLY_DATABASE_DIR}/rally.sqlite" ${RALLY_CONFIGURATION_DIR}/rally.conf
local tmp=$(mktemp /tmp/rally.conf.XXXXX)
sed 's|#connection=<None>|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}