Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 68 lines (55 sloc) 1.8 KB
#!/bin/zsh
BRANCH=`git branch | grep '^*' | head -n1 | cut -c 3- | tr / -`
# install based on tag like rt-4.0.0
if [[ $BRANCH == "(no branch)" ]]
then BRANCH=`git describe --tags | perl -ple 's/^rt-//'`
fi
DBTYPE=${1:-sqlite}
RTNAME=${2:-$BRANCH}
DBNAME=`echo "rt_$RTNAME" | perl -ple 's/-/_/g; s/\.//g'`
DIRNAME="${RTNAME}_$DBTYPE"
FULLDIR=/opt/rt/$DIRNAME
./configure.ac
case "$DBTYPE" in
sqlite)
./configure --prefix=$FULLDIR --enable-graphviz --enable-gd --enable-gpg --with-my-user-group --with-devel-mode --with-db-database=$DBNAME --with-db-type=SQLite
;;
pg)
./configure --prefix=$FULLDIR --enable-graphviz --enable-gd --enable-gpg --with-my-user-group --with-devel-mode --with-db-database=$DBNAME --with-db-type=Pg --with-db-dba=sartak
;;
mysql)
./configure --prefix=$FULLDIR --enable-graphviz --enable-gd --enable-gpg --with-my-user-group --with-devel-mode --with-db-database=$DBNAME --with-db-type=mysql --with-db-dba=root
;;
esac
make install
rm -f /opt/rt3
ln -vis $FULLDIR /opt/rt3
rm -rf /opt/rt3/var/mason_data
# if the SiteConfig is what ships with RT, replace it with my own
if cmp /opt/rt3/etc/RT_SiteConfig.pm etc/RT_SiteConfig.pm &> /dev/null
then cp ~/devel/bindir/data/RT_SiteConfig.pm /opt/rt3/etc/RT_SiteConfig.pm
fi
# make initdb
MAKE_INITDB=1
case "$DBTYPE" in
sqlite)
if [[ -f /opt/rt3/var/$DBNAME ]]
then MAKE_INITDB=0
fi
;;
pg)
if echo '\l' | psql -d postgres | grep -q $DBNAME
then MAKE_INITDB=0
fi
;;
mysql)
if echo 'show databases;' | sudo mysql | grep -q $DBNAME
then MAKE_INITDB=0
fi
;;
esac
if [[ $MAKE_INITDB != 0 ]]
then yes | make initdb
fi
echo
echo "Installed \e[1;32m$RTNAME\e[m into $FULLDIR using $DBTYPE database $DBNAME"
Something went wrong with that request. Please try again.