Last active
April 10, 2022 03:57
-
-
Save sgykfjsm/1dc5378d0258ae370fca to your computer and use it in GitHub Desktop.
install subversion-1.9.1+apache serf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eu | |
_OLDPWD=$(pwd) | |
test -d "${BASH_SOURCE[0]%/*}" && { cd "${BASH_SOURCE[0]%/*}" || exit 1; } | |
SCRIPT_DIR="$(pwd)" | |
SVN_URL=http://ftp.kddilabs.jp/infosystems/apache/subversion/subversion-1.9.1.tar.gz | |
SQLITE_URL=http://sqlite.org/sqlite-amalgamation-3071502.zip | |
SERF_URL=https://archive.apache.org/dist/serf/serf-1.3.8.tar.bz2 | |
SCONS_URL=http://prdownloads.sourceforge.net/scons/scons-2.3.6.tar.gz | |
REPOSITORY=/opt/svn/repository | |
rm -rf ${REPOSITORY} && mkdir -pv ${REPOSITORY} | |
deps() { | |
sudo yum install -y apr-util-devel sqlite-devel neon-devel openssl-devel mod_dav_svn httpd | |
sudo ln -sfv /usr/lib64/libapr-1.so /usr/lib64/libapr-1.a | |
} | |
download_source() { | |
if [ ! -f $(basename ${SVN_URL}) ]; then | |
wget --quiet ${SVN_URL} | |
fi | |
if [ ! -f $(basename ${SQLITE_URL}) ]; then | |
wget --quiet ${SQLITE_URL} | |
fi | |
if [ ! -f $(basename ${SERF_URL}) ]; then | |
wget --quiet ${SERF_URL} | |
fi | |
if [ ! -f $(basename ${SCONS_URL}) ]; then | |
wget --quiet ${SCONS_URL} | |
fi | |
rm -rf $(basename ${SVN_URL} .tar.gz) && tar zxf $(basename ${SVN_URL}) | |
rm -rf $(basename ${SQLITE_URL} .zip) && unzip $(basename ${SQLITE_URL}) | |
rm -rf $(basename ${SERF_URL} .tar.bz2) && tar jxf $(basename ${SERF_URL}) | |
rm -rf $(basename ${SCONS_URL} .tar.gz) && tar zxf $(basename ${SCONS_URL}) | |
SQLITE_DIR=$(basename ${SQLITE_URL} .tar.gz | awk -F'-' '{print $1"-"$2}') | |
mv -v $(basename ${SQLITE_URL} .zip) $(basename ${SVN_URL} .tar.gz)/${SQLITE_DIR} | |
} | |
install_scons(){ | |
cd $(basename ${SCONS_URL} .tar.gz) | |
python setup.py install --prefix=/home/vagrant/apps/scons | |
BASHRC=/home/vagrant/.bashrc | |
if ! grep -q scons ${BASHRC} ; then | |
echo "export PATH=/home/vagrant/apps/scons/bin:\${PATH}" >> ${BASHRC} | |
fi | |
chown -R vagrant:vagrant /home/vagrant/apps/scons | |
set +u | |
source ${BASHRC} | |
set -u | |
cd - > /dev/null | |
} | |
install_serf(){ | |
cd $(basename ${SERF_URL} .tar.bz2) | |
scons PREFIX=/home/vagrant/apps/serf | |
scons install | |
scons -c | |
cd - > /dev/null | |
} | |
install_subversion() { | |
prefix_dir=/home/vagrant/apps/subversion-1.9.1 | |
libexec_dir=${prefix_dir}/libexec | |
configure_opts="\ | |
--prefix=${prefix_dir} \ | |
--without-berkeley-db \ | |
--enable-all-static \ | |
--with-apache-libexecdir=${libexec_dir} \ | |
--disable-mod-activation \ | |
--without-apxs \ | |
--without-swig \ | |
--with-serf=/home/vagrant/apps/serf \ | |
" | |
mkdir -pv ${prefix_dir} ${libexec_dir} | |
cd ./subversion-1.9.1 | |
LDFLAGS="-Wl,-rpath,/home/vagrant/apps/serf/lib" ./configure ${configure_opts} | |
make && make install | |
cd - > /dev/null | |
BASHRC=/home/vagrant/.bashrc | |
if ! grep -q subversion ${BASHRC} ; then | |
echo "export PATH=${prefix_dir}/bin:\${PATH}" >> ${BASHRC} | |
fi | |
chown -R vagrant:vagrant ${prefix_dir} | |
set +u | |
source ${BASHRC} | |
set -u | |
} | |
svn_setup() { | |
svnadmin create ${REPOSITORY} | |
local revprop=${REPOSITORY}/hooks/pre-revprop-change | |
cat <<EOF > ${revprop} | |
#!/bin/sh | |
exit 0 | |
EOF | |
chmod +x ${revprop} | |
} | |
httpd_setup(){ | |
local httpd_svn_conf=/etc/httpd/conf.d/subversion.conf | |
if [ -f ${httpd_svn_conf} ]; then | |
cp -pv ${httpd_svn_conf} ${httpd_svn_conf}.$(date '+%Y%m%d%H%M%S.%Z') | |
fi | |
cat <<EOF > ${httpd_svn_conf} | |
LoadModule dav_svn_module modules/mod_dav_svn.so | |
LoadModule authz_svn_module modules/mod_authz_svn.so | |
<Location /svn> | |
DAV svn | |
SVNPath ${REPOSITORY} | |
</Location> | |
EOF | |
chown -R apache:apache $(dirname ${REPOSITORY}) | |
service iptables stop | |
service httpd start | |
chkconfig httpd on | |
} | |
main() { | |
deps | |
download_source | |
install_scons | |
install_serf | |
install_subversion | |
svn_setup | |
} | |
main $@ | |
[ -n "${_OLDPWD-}" ] && cd ${_OLDPWD} | |
exit | |
# EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment