From: Chris Sharp Date: Tue, 12 Dec 2017 18:53:12 +0000 (-0500) Subject: updating to 3.0.0 and adding opensrf.service X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6e63e4407624f5ce0c0f23047305265b82c29e8f;p=contrib%2Fpines%2Fosrf-debian.git updating to 3.0.0 and adding opensrf.service --- diff --git a/build_opensrf_debs b/build_opensrf_debs index feb79e9..548afd5 100755 --- a/build_opensrf_debs +++ b/build_opensrf_debs @@ -56,7 +56,7 @@ do Standalone ) echo You selected $BUILDTYPE; echo; sleep 1; break ;; Cluster ) echo You selected $BUILDTYPE; echo; sleep 1; break ;; Clean ) echo You selected $BUILDTYPE; echo; sleep 1; break ;; - * ) echo; echo "You must select 1 or 2";; + * ) echo; echo "You must select 1, 2, or 3";; esac done @@ -73,6 +73,7 @@ then exit fi + echo Building $BUILDTYPE version..;echo STANDALONE=true @@ -173,7 +174,10 @@ fi #TODO: include this in the chunk above ## copy init script for opensrf. dpkg changes the init.d file to the name of the package, in this case opensrf. -cp -v ${BUILDFILESDIR}/eg_opensrf ${SOURCE_FOLDER}/debian/init.d +# cp -v ${BUILDFILESDIR}/eg_opensrf ${SOURCE_FOLDER}/debian/init.d + +## copy systemd unit file to debian source folder. +cp -v ${BUILDFILESDIR}/opensrf.service ${SOURCE_FOLDER}/debian ## set conf files #echo "$OPENSRF_CONF_DIR/opensrf.xml" > ${SOURCE_FOLDER}/debian/conffiles diff --git a/files_for_build/control b/files_for_build/control index 9039ebe..a452d86 100644 --- a/files_for_build/control +++ b/files_for_build/control @@ -2,7 +2,7 @@ Source: opensrf Section: net Priority: extra Maintainer: Pines Admins -Build-Depends: apache2, apache2-dev, autoconf, automake, autotools-dev, build-essential, check, debconf (>= 0.5), debhelper (>= 7.0.50~), libc6 (>= 2.3), libcache-memcached-perl, libclass-dbi-perl, libdatetime-format-iso8601-perl, libdatetime-perl, libexpat1-dev, libgcrypt11-dev, libgdbm-dev, libjson-xs-perl, libmemcached11, libmemcached-dev, libmodule-build-perl, libncurses5 (>= 5.7+20100313), libncurses5-dev, libnet-dns-perl, libnet-server-perl, libperl-dev, libreadline6 | libreadline5 (>= 5.2), libreadline-dev, libtool, libuniversal-require-perl, libunix-syslog-perl, libxml2 (>= 2.7.4), libxml2-dev, libxml-libxml-perl, libxslt1-dev, ncurses-dev, pkg-config, python-dev, zlib1g-dev +Build-Depends: apache2, apache2-dev, autoconf, automake, autotools-dev, build-essential, check, debconf (>= 0.5), debhelper (>= 7.0.50~), dh-systemd, libc6 (>= 2.3), libcache-memcached-perl, libclass-dbi-perl, libdatetime-format-iso8601-perl, libdatetime-perl, libexpat1-dev, libgcrypt11-dev, libgdbm-dev, libjson-xs-perl, libmemcached11, libmemcached-dev, libmodule-build-perl, libncurses5 (>= 5.7+20100313), libncurses5-dev, libnet-dns-perl, libnet-server-perl, libperl-dev, libreadline6 | libreadline5 (>= 5.2), libreadline-dev, libtool, libuniversal-require-perl, libunix-syslog-perl, libxml2 (>= 2.7.4), libxml2-dev, libxml-libxml-perl, libxslt1-dev, ncurses-dev, pkg-config, python-dev, zlib1g-dev Standards-Version: 3.8.4 Homepage: http://evergreen-ils.org diff --git a/files_for_build/eg_opensrf b/files_for_build/eg_opensrf deleted file mode 100755 index 2d6c111..0000000 --- a/files_for_build/eg_opensrf +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash -#TODO: properly attribute the original authors of this file -#TODO: add a 'status' command -#TODO: create an upstart job instead? - -### BEGIN INIT INFO -# Provides: opensrf -# Required-Start: $local_fs $remote_fs $network $syslog -# Required-Stop: $local_fs $remote_fs $network $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# X-Interactive: true -# Short-Description: Start/stop OpenSRF Services -### END INIT INFO -. /lib/lsb/init-functions - -OPENILS_BASE="/openils" -OPENILS_CORE="${OPENILS_BASE}/conf/opensrf_core.xml" -SRU_LOG="${OPENILS_BASE}/var/log/sru.log" - -PIDFILES="${OPENILS_BASE}/var/run" -SIP_CONF="${OPENILS_BASE}/conf/oils_sip.xml" - -REP_LOCK="${OPENILS_BASE}/var/lock/reporter-LOCK" -REP_NAME="Clark Kent, waiting for trouble" - -sru_name='simple2zoom' - -export PATH=$PATH:${OPENILS_BASE}/bin - -if [ $(whoami) != 'opensrf' ]; then - PERL5LIB='/openils/lib/perl5:$PERL5LIB'; -fi; - -start_opensrf() { - sleep 3 - log_daemon_msg "Starting Evergreen OpenSRF:" - su - opensrf -c /bin/bash -c "PERL5LIB=${PERL5LIB}:${OPENILS_BASE}/lib/perl5 PATH=${PATH}:${OPENILS_BASE}/bin osrf_control --start-all" - if [ ! -e ${OPENILS_BASE}/var/web/eg_cache_hash ] - then - if dpkg -l | grep "evergreen-ils" | grep "ii" - then - log_daemon_msg "Running Autogen...:" - su - opensrf /bin/bash -c "PERL5LIB=${PERL5LIB}:${OPENILS_BASE}/lib/perl5 PATH=${PATH}:${OPENILS_BASE}/bin autogen.sh -u" - fi - fi -} - -stop_opensrf() { - log_daemon_msg "Stopping Evergreen OpenSRF:" - su - opensrf -c /bin/bash -c "PERL5LIB=${PERL5LIB}:${OPENILS_BASE}/lib/perl5 PATH=${PATH}:${OPENILS_BASE}/bin osrf_control --stop-all" - sleep 3 - rm -f $PIDFILES/*.pid -} - -autogen() { - echo "Running Autogen Update" - su - opensrf /bin/bash -c "PERL5LIB=${PERL5LIB}:${OPENILS_BASE}/lib/perl5 PATH=${PATH}:${OPENILS_BASE}/bin autogen.sh -u" -} - - -case "$1" in - start) - start_opensrf -# /etc/init.d/apache2-websockets stop -# /etc/init.d/apache2 restart -# /etc/init.d/apache2-websockets start - ;; - stop) - stop_opensrf - ;; - restart) -# /etc/init.d/apache2-websockets stop -# /etc/init.d/apache2 stop - log_daemon_msg "Restarting Evergreen OpenSRF:" - stop_opensrf - sleep 2 - start_opensrf -# /etc/init.d/apache2-websockets start -# /etc/init.d/apache2 start - ;; - autogen) - autogen - ;; -*) - echo " * Usage: /etc/init.d/eg_opensrf {start|stop|restart|autogen}" - exit 1 - ;; -esac; diff --git a/files_for_build/postinst b/files_for_build/postinst index 086a259..73b1608 100755 --- a/files_for_build/postinst +++ b/files_for_build/postinst @@ -75,35 +75,35 @@ fi #EJABBERD SECTION reconfigure_ejabberd() { -#if grep -q "^{hosts, \[\"localhost\"]}" /etc/ejabberd/ejabberd.cfg -if ! grep -q "$HFQDN" /etc/ejabberd/ejabberd.yml +if ! grep -q "$HFQDN" /etc/ejabberd/ejabberd.yml then #TODO: make sure these values are current DEBUG echo "Stock ejabberd detecting. Stopping and modifying config!" EJABBERD_CONFIG_FILE="/etc/ejabberd/ejabberd.yml" /etc/init.d/ejabberd stop cp /etc/ejabberd/ejabberd.yml /etc/ejabberd/ejabberd.yml.orig + #hosts sed -i "/^ \- \"localhost\"/a \ \- \"private.$HFQDN\"" $EJABBERD_CONFIG_FILE - sed -i "/^ \- \"localhost\"/a \ \- \"public.$HFQDN\"" $EJABBERD_CONFIG_FILE + sed -i "/^ \- \"localhost\"/a \ \- \"public.$HFQDN\"" $EJABBERD_CONFIG_FILE - #max_user_sessions - sed -i 's/\/all: 10000/g' $EJABBERD_CONFIG_FILE + #max_user_sessions + sed -i 's/\/all: 10000/g' $EJABBERD_CONFIG_FILE - #max_stanza_size - sed -i 's/max_stanza_size: 65536/max_stanza_size: 2000000/g' $EJABBERD_CONFIG_FILE + #max_stanza_size + sed -i 's/max_stanza_size: 65536/max_stanza_size: 2000000/g' $EJABBERD_CONFIG_FILE - #shaper_normal - sed -i 's/normal: 1000/normal: 500000/g' $EJABBERD_CONFIG_FILE + #shaper_normal + sed -i 's/normal: 1000/normal: 500000/g' $EJABBERD_CONFIG_FILE - #shaper_fast - sed -i 's/fast: 50000/fast: 500000/g' $EJABBERD_CONFIG_FILE + #shaper_fast + sed -i 's/fast: 50000/fast: 500000/g' $EJABBERD_CONFIG_FILE - #mod_offline - sed -i 's/mod_offline:/#mod_offline:/g' $EJABBERD_CONFIG_FILE - sed -i 's/access_max_user_messages/#access_max_user_messages/g' $EJABBERD_CONFIG_FILE - - #auth_password_format - sed -i 's/auth_password_format: scram/auth_password_format: plain/g' $EJABBERD_CONFIG_FILE + #mod_offline + sed -i 's/mod_offline:/#mod_offline:/g' $EJABBERD_CONFIG_FILE + sed -i 's/access_max_user_messages/#access_max_user_messages/g' $EJABBERD_CONFIG_FILE + + #auth_password_format + sed -i 's/auth_password_format: scram/auth_password_format: plain/g' $EJABBERD_CONFIG_FILE #sed -i "s/^{hosts, \[\"localhost\"\]}/{hosts, [\"localhost\", \"private.$HFQDN\", \"public.$HFQDN\"]}/g" /etc/ejabberd/ejabberd.cfg #sed -i "s/max_user_sessions,\ \[{10,/max_user_sessions,\ \[{10000,/g" /etc/ejabberd/ejabberd.cfg #sed -i 's/{max_stanza_size, 65536}/{max_stanza_size, 2000000}/g' /etc/ejabberd/ejabberd.cfg @@ -262,11 +262,11 @@ configure_opensrf_xml osrf_control_symlink update_rcd -#ldconfig +ldconfig db_stop DEBUG echo "Installation of OpenSRF completed!" -#DEBUG echo "Starting OpenSRF:" +DEBUG echo "Starting OpenSRF:" echo "To start opensrf, run /etc/init.d/opensrf start" echo "Please make sure any pending network changes have taken place before attempting this" -#/etc/init.d/opensrf start +/etc/init.d/opensrf start exit 0 diff --git a/files_for_build/postinst.cluster-14.04 b/files_for_build/postinst.cluster-14.04 deleted file mode 100755 index fa6eae1..0000000 --- a/files_for_build/postinst.cluster-14.04 +++ /dev/null @@ -1,250 +0,0 @@ -#!/bin/bash -set -e -set +x -#TODO: insert license GPLv3 tag copyright gpls -STANDALONE=1 # -#Can this be fetched from dpkg? -OPENSRF_PREFIX="/openils" -. /usr/share/debconf/confmodule -HFQDN=$(perl -MNet::Domain -e 'print Net::Domain::hostfqdn() . "\n";') -DEBUG() -{ - if [ $_DEBUG > 0 ]; then $@;fi -} -modify_hosts_file() -{ -HOSTS_FILE_TAG="OPENSRF_DEB Addresses" -if ! grep -q "$HOSTS_FILE_TAG" /etc/hosts - then - cp -f /etc/hosts /etc/hosts.orig - DEBUG echo "Adding entries to /etc/hosts..." - sed -i "2i\#$HOSTS_FILE_TAG" /etc/hosts - sed -i "3i\127.0.1.2\tpublic.$HFQDN\tpublic #OPENSRF_DEB" /etc/hosts - sed -i "4i\127.0.1.3\tprivate.$HFQDN\tprivate #OPENSRF_DEB" /etc/hosts - sed -i '5i\ ' /etc/hosts - else - DEBUG echo "Hosts file has already been modified!" - -fi -} #modify_hosts_file() -add_opensrf_user() { -if ! grep -q "^opensrf:" /etc/passwd - then - DEBUG echo "Opensrf user does not exist! Creating..." - if ! grep -q "x:2000" /etc/passwd; then - useradd -m -s /bin/bash -u 2000 opensrf - else - useradd -m -s /bin/bash opensrf - fi - - db_get opensrf/user_password || true - PASS=$RET - tfile=`mktemp` - if [ ! -f "$tfile" ]; then - echo "ERROR Creating temp file!" - return 1 - fi - - DEBUG echo "creating tmp pw file as $tfile" -cat << EOF > $tfile -opensrf:$PASS -EOF -DEBUG echo "about to change" - cat $tfile | chpasswd -DEBUG echo "about to rm" - rm $tfile - DEBUG echo "Set user opensrf's password" - else - DEBUG echo "Opensrf user already exists, so not doing anything!" - - -fi - - - -if ! grep -q "$OPENSRF_PREFIX/bin" /home/opensrf/.bashrc - then - DEBUG echo "Adding path for opensrf user..." - sed -i "2i\export PATH=$OPENSRF_PREFIX/bin:\$PATH" /home/opensrf/.bashrc - sed -i '3i\export PERL5LIB=/openils/lib/perl5:$PERL5LIB' /home/opensrf/.bashrc - else - DEBUG echo "OpenSRF Path already added!" -fi -} #add_opensrf_user() - -#EJABBERD SECTION -reconfigure_ejabberd() -{ -if grep -q "^{hosts, \[\"localhost\"]}" /etc/ejabberd/ejabberd.cfg - then - #TODO: make sure these values are current - DEBUG echo "Stock ejabberd detecting. Stopping and modifying config!" - EJABBERD_CONFIG_FILE="/etc/ejabberd/ejabberd.yml" - /etc/init.d/ejabberd stop - cp /etc/ejabberd/ejabberd.cfg /etc/ejabberd/ejabberd.cfg.orig - sed -i "s/^{hosts, \[\"localhost\"\]}/{hosts, [\"localhost\", \"private.$HFQDN\", \"public.$HFQDN\"]}/g" /etc/ejabberd/ejabberd.cfg - sed -i "s/max_user_sessions,\ \[{10,/max_user_sessions,\ \[{10000,/g" /etc/ejabberd/ejabberd.cfg - sed -i 's/{max_stanza_size, 65536}/{max_stanza_size, 2000000}/g' /etc/ejabberd/ejabberd.cfg - sed -i 's/{max_stanza_size, 131072}/{max_stanza_size, 2000000}/g' /etc/ejabberd/ejabberd.cfg - sed -i 's/{shaper, normal, {maxrate, 1000}}/{shaper, normal, {maxrate, 500000}}/g' /etc/ejabberd/ejabberd.cfg - sed -i 's/{shaper, fast, {maxrate, 50000}}/{shaper, fast, {maxrate, 500000}}/g' /etc/ejabberd/ejabberd.cfg - sed -i 's/{mod_offline/%%{mod_offline/g' /etc/ejabberd/ejabberd.cfg - chown ejabberd.ejabberd /etc/ejabberd/ejabberd.cfg - /etc/init.d/ejabberd start - else - DEBUG echo "Ejabberd has already been modified (or atleast the hosts line has). No Changes made." -fi -} #reconfigure_ejabberd() -add_ejabber_user() -{ - USER=$1 - HOST=$2 - PASSWD=$3 - if ! status=$(ejabberdctl register "$USER" "$HOST" "$PASSWD") ; then - if echo $status | grep -q "already registered" ; then - DEBUG echo "User \"$USER@$HOST\" is already registered. Password IS NOT changed." - else - echo "Can't register user \"$USER@$HOST\"." - fi - else - DEBUG echo "User \"$USER@$HOST\" is registered successfully." - fi - - -} - -register_ejabberd_users() -{ -#TODO: check the ejabberd scripts to make sure none of this code was borrowed from it. may need to rewrite the block to make sure it's on the level. - db_get opensrf/ejabber_password - EJABBER_PASS=$RET - #if [ -n "$USER" -a -n "$PASSWD" ]; then - DEBUG echo -n "Waiting for ejabberd to register admin user" - - if ejabberdctl status >/dev/null || test $? = 1 ; then - # Ejabberd is starting ($? = 1) or running ($? = 0) already. - cnt=0 - flag=1 - while ! ejabberdctl status >/dev/null ; do - DEBUG echo -n "." - cnt=`expr $cnt + 1` - if [ $cnt -ge 60 ] ; then - echo - echo "Can't register Ejabberd users." - echo -n "Ejabberd is taking too long to start!" - flag=0 - break - fi - sleep 1 - done - - echo - if [ $flag -eq 1 ] ; then - add_ejabber_user router private.$HFQDN $EJABBER_PASS - add_ejabber_user opensrf private.$HFQDN $EJABBER_PASS - add_ejabber_user router public.$HFQDN $EJABBER_PASS - add_ejabber_user opensrf public.$HFQDN $EJABBER_PASS - - fi - else - echo - echo "Can't register Ejabberd users!" - echo "Ejabberd server is not started." - fi -} #register_ejabberd_users() - - -#END EJABBERD SECTION - -modify_apache() -{ -#TODO: check license on Makefile.install to make sure it's compatible with ours. -#CODE SOURCE: Makefile.install - -for m in ssl osrf_http_translator osrf_json_gateway; do a2enmod $m > /dev/null; done; -# adds a placeholder module so apxs will be happy -if [ ! "$(grep mod_placeholder /etc/apache2/httpd.conf)" ]; then - echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" >> /etc/apache2/httpd.conf - /etc/init.d/apache2 restart - fi - -} #modify_apache() - -configure_ld() -{ -LD_CONF_FILE="/etc/ld.so.conf.d/osrf.conf" -#TODO: decide if this should be opensrf.conf instead of an abbreviation. -if ! test -e $LD_CONF_FILE - then - DEBUG echo "Confgiuring library paths..." - echo "$OPENSRF_PREFIX/lib" > $LD_CONF_FILE - echo "/usr/local/lib" >> $LD_CONF_FILE - export LDCONFIG_NOTRIGGER=y - ldconfig - else - DEBUG echo "Library paths already configured!" -fi -} #configure_ld() - -fix_osrf_perms() -{ -DEBUG echo "Changing ownership of $OPENSRF_PREFIX (and everything in it) to opensrf..." -mkdir -p $OPENSRF_PREFIX/var/run -mkdir -p $OPENSRF_PREFIX/var/log -mkdir -p $OPENSRF_PREFIX/var/lock -chown -R opensrf:opensrf $OPENSRF_PREFIX -} -configure_opensrf_xml() -{ - db_get opensrf/ejabber_password - EJABBERPASS=$RET - cp -n $OPENSRF_PREFIX/conf/opensrf.xml.example $OPENSRF_PREFIX/conf/opensrf.xml - cp -n $OPENSRF_PREFIX/conf/opensrf_core.xml.example $OPENSRF_PREFIX/conf/opensrf_core.xml - cp -n $OPENSRF_PREFIX/conf/srfsh.xml.example $OPENSRF_PREFIX/conf/srfsh.xml - sed -i "s|d>password|d>$RET|g" $OPENSRF_PREFIX/conf/*.xml - cp -n $OPENSRF_PREFIX/conf/srfsh.xml /home/opensrf/.srfsh.xml && \ - chown opensrf /home/opensrf/.srfsh.xml && chmod 600 /home/opensrf/.srfsh.xml - HFQDN=$(perl -MNet::Domain -e 'print Net::Domain::hostfqdn() . "\n";') - sed -i "s//<$HFQDN>/g" $OPENSRF_PREFIX/conf/opensrf.xml - sed -i "s/<\/localhost>/<\/$HFQDN>/g" $OPENSRF_PREFIX/conf/opensrf.xml - sed -i "s/\.localhost /dev/null -} -osrf_control_symlink() -{ - if [ -e /openils/bin/osrf_control ] - then - rm /openils/bin/osrf_control - ln -s /openils/bin/opensrf-perl.pl /openils/bin/osrf_control - else - ln -s /openils/bin/opensrf-perl.pl /openils/bin/osrf_control - fi -} - -modify_hosts_file -add_opensrf_user -reconfigure_ejabberd -register_ejabberd_users -modify_apache -configure_ld -fix_osrf_perms -configure_opensrf_xml -osrf_control_symlink - -update_rcd -#ldconfig -db_stop -DEBUG echo "Installation of OpenSRF completed!" -#DEBUG echo "Starting OpenSRF:" -echo "To start opensrf, run /etc/init.d/opensrf start" -echo "Please make sure any pending network changes have taken place before attempting this" -#/etc/init.d/opensrf start -exit 0 diff --git a/files_for_build/postinst.cluster-16.04 b/files_for_build/postinst.cluster-16.04 deleted file mode 100755 index e96efca..0000000 --- a/files_for_build/postinst.cluster-16.04 +++ /dev/null @@ -1,272 +0,0 @@ -#!/bin/bash -set -e -set +x -#TODO: insert license GPLv3 tag copyright gpls -STANDALONE=1 # -#Can this be fetched from dpkg? -OPENSRF_PREFIX="/openils" -. /usr/share/debconf/confmodule -HFQDN=$(perl -MNet::Domain -e 'print Net::Domain::hostfqdn() . "\n";') -DEBUG() -{ - if [ $_DEBUG > 0 ]; then $@;fi -} -modify_hosts_file() -{ -HOSTS_FILE_TAG="OPENSRF_DEB Addresses" -if ! grep -q "$HOSTS_FILE_TAG" /etc/hosts - then - cp -f /etc/hosts /etc/hosts.orig - DEBUG echo "Adding entries to /etc/hosts..." - sed -i "2i\#$HOSTS_FILE_TAG" /etc/hosts - sed -i "3i\127.0.1.2\tpublic.$HFQDN\tpublic #OPENSRF_DEB" /etc/hosts - sed -i "4i\127.0.1.3\tprivate.$HFQDN\tprivate #OPENSRF_DEB" /etc/hosts - sed -i '5i\ ' /etc/hosts - else - DEBUG echo "Hosts file has already been modified!" - -fi -} #modify_hosts_file() -add_opensrf_user() { -if ! grep -q "^opensrf:" /etc/passwd - then - DEBUG echo "Opensrf user does not exist! Creating..." - if ! grep -q "x:2000" /etc/passwd; then - useradd -m -s /bin/bash -u 2000 opensrf - else - useradd -m -s /bin/bash opensrf - fi - - db_get opensrf/user_password || true - PASS=$RET - tfile=`mktemp` - if [ ! -f "$tfile" ]; then - echo "ERROR Creating temp file!" - return 1 - fi - - DEBUG echo "creating tmp pw file as $tfile" -cat << EOF > $tfile -opensrf:$PASS -EOF -DEBUG echo "about to change" - cat $tfile | chpasswd -DEBUG echo "about to rm" - rm $tfile - DEBUG echo "Set user opensrf's password" - else - DEBUG echo "Opensrf user already exists, so not doing anything!" - - -fi - - - -if ! grep -q "$OPENSRF_PREFIX/bin" /home/opensrf/.bashrc - then - DEBUG echo "Adding path for opensrf user..." - sed -i "2i\export PATH=$OPENSRF_PREFIX/bin:\$PATH" /home/opensrf/.bashrc - sed -i '3i\export PERL5LIB=/openils/lib/perl5:$PERL5LIB' /home/opensrf/.bashrc - else - DEBUG echo "OpenSRF Path already added!" -fi -} #add_opensrf_user() - -#EJABBERD SECTION -reconfigure_ejabberd() -{ -if grep -q "^{hosts, \[\"localhost\"]}" /etc/ejabberd/ejabberd.cfg - then - #TODO: make sure these values are current - DEBUG echo "Stock ejabberd detecting. Stopping and modifying config!" - EJABBERD_CONFIG_FILE="/etc/ejabberd/ejabberd.yml" - /etc/init.d/ejabberd stop - cp /etc/ejabberd/ejabberd.yml /etc/ejabberd/ejabberd.yml.orig - #hosts - sed -i "/^ \- \"localhost\"/a \ \- \"private.$HFQDN\"" $EJABBERD_CONFIG_FILE - sed -i "/^ \- \"localhost\"/a \ \- \"public.$HFQDN\"" $EJABBERD_CONFIG_FILE - - #max_user_sessions - sed -i 's/\/all: 10000/g' $EJABBERD_CONFIG_FILE - - #max_stanza_size - sed -i 's/max_stanza_size: 65536/max_stanza_size: 2000000/g' $EJABBERD_CONFIG_FILE - - #shaper_normal - sed -i 's/normal: 1000/normal: 500000/g' $EJABBERD_CONFIG_FILE - - #shaper_fast - sed -i 's/fast: 50000/fast: 500000/g' $EJABBERD_CONFIG_FILE - - #mod_offline - sed -i 's/mod_offline:/#mod_offline:/g' $EJABBERD_CONFIG_FILE - sed -i 's/access_max_user_messages/#access_max_user_messages/g' $EJABBERD_CONFIG_FILE - - #auth_password_format - sed -i 's/auth_password_format: scram/auth_password_format: plain/g' $EJABBERD_CONFIG_FILE - #sed -i "s/^{hosts, \[\"localhost\"\]}/{hosts, [\"localhost\", \"private.$HFQDN\", \"public.$HFQDN\"]}/g" /etc/ejabberd/ejabberd.cfg - #sed -i "s/max_user_sessions,\ \[{10,/max_user_sessions,\ \[{10000,/g" /etc/ejabberd/ejabberd.cfg - #sed -i 's/{max_stanza_size, 65536}/{max_stanza_size, 2000000}/g' /etc/ejabberd/ejabberd.cfg - #sed -i 's/{max_stanza_size, 131072}/{max_stanza_size, 2000000}/g' /etc/ejabberd/ejabberd.cfg - #sed -i 's/{shaper, normal, {maxrate, 1000}}/{shaper, normal, {maxrate, 500000}}/g' /etc/ejabberd/ejabberd.cfg - #sed -i 's/{shaper, fast, {maxrate, 50000}}/{shaper, fast, {maxrate, 500000}}/g' /etc/ejabberd/ejabberd.cfg - #sed -i 's/{mod_offline/%%{mod_offline/g' /etc/ejabberd/ejabberd.cfg - chown ejabberd.ejabberd /etc/ejabberd/ejabberd.cfg - /etc/init.d/ejabberd start - else - DEBUG echo "Ejabberd has already been modified (or atleast the hosts line has). No Changes made." -fi -} #reconfigure_ejabberd() -add_ejabber_user() -{ - USER=$1 - HOST=$2 - PASSWD=$3 - if ! status=$(ejabberdctl register "$USER" "$HOST" "$PASSWD") ; then - if echo $status | grep -q "already registered" ; then - DEBUG echo "User \"$USER@$HOST\" is already registered. Password IS NOT changed." - else - echo "Can't register user \"$USER@$HOST\"." - fi - else - DEBUG echo "User \"$USER@$HOST\" is registered successfully." - fi - - -} - -register_ejabberd_users() -{ -#TODO: check the ejabberd scripts to make sure none of this code was borrowed from it. may need to rewrite the block to make sure it's on the level. - db_get opensrf/ejabber_password - EJABBER_PASS=$RET - #if [ -n "$USER" -a -n "$PASSWD" ]; then - DEBUG echo -n "Waiting for ejabberd to register admin user" - - if ejabberdctl status >/dev/null || test $? = 1 ; then - # Ejabberd is starting ($? = 1) or running ($? = 0) already. - cnt=0 - flag=1 - while ! ejabberdctl status >/dev/null ; do - DEBUG echo -n "." - cnt=`expr $cnt + 1` - if [ $cnt -ge 60 ] ; then - echo - echo "Can't register Ejabberd users." - echo -n "Ejabberd is taking too long to start!" - flag=0 - break - fi - sleep 1 - done - - echo - if [ $flag -eq 1 ] ; then - add_ejabber_user router private.$HFQDN $EJABBER_PASS - add_ejabber_user opensrf private.$HFQDN $EJABBER_PASS - add_ejabber_user router public.$HFQDN $EJABBER_PASS - add_ejabber_user opensrf public.$HFQDN $EJABBER_PASS - - fi - else - echo - echo "Can't register Ejabberd users!" - echo "Ejabberd server is not started." - fi -} #register_ejabberd_users() - - -#END EJABBERD SECTION - -modify_apache() -{ -#TODO: check license on Makefile.install to make sure it's compatible with ours. -#CODE SOURCE: Makefile.install - -for m in ssl osrf_http_translator osrf_json_gateway; do a2enmod $m > /dev/null; done; -# adds a placeholder module so apxs will be happy -if [ ! "$(grep mod_placeholder /etc/apache2/httpd.conf)" ]; then - echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" >> /etc/apache2/httpd.conf - /etc/init.d/apache2 restart - fi - -} #modify_apache() - -configure_ld() -{ -LD_CONF_FILE="/etc/ld.so.conf.d/osrf.conf" -#TODO: decide if this should be opensrf.conf instead of an abbreviation. -if ! test -e $LD_CONF_FILE - then - DEBUG echo "Confgiuring library paths..." - echo "$OPENSRF_PREFIX/lib" > $LD_CONF_FILE - echo "/usr/local/lib" >> $LD_CONF_FILE - export LDCONFIG_NOTRIGGER=y - ldconfig - else - DEBUG echo "Library paths already configured!" -fi -} #configure_ld() - -fix_osrf_perms() -{ -DEBUG echo "Changing ownership of $OPENSRF_PREFIX (and everything in it) to opensrf..." -mkdir -p $OPENSRF_PREFIX/var/run -mkdir -p $OPENSRF_PREFIX/var/log -mkdir -p $OPENSRF_PREFIX/var/lock -chown -R opensrf:opensrf $OPENSRF_PREFIX -} -configure_opensrf_xml() -{ - db_get opensrf/ejabber_password - EJABBERPASS=$RET - cp -n $OPENSRF_PREFIX/conf/opensrf.xml.example $OPENSRF_PREFIX/conf/opensrf.xml - cp -n $OPENSRF_PREFIX/conf/opensrf_core.xml.example $OPENSRF_PREFIX/conf/opensrf_core.xml - cp -n $OPENSRF_PREFIX/conf/srfsh.xml.example $OPENSRF_PREFIX/conf/srfsh.xml - sed -i "s|d>password|d>$RET|g" $OPENSRF_PREFIX/conf/*.xml - cp -n $OPENSRF_PREFIX/conf/srfsh.xml /home/opensrf/.srfsh.xml && \ - chown opensrf /home/opensrf/.srfsh.xml && chmod 600 /home/opensrf/.srfsh.xml - HFQDN=$(perl -MNet::Domain -e 'print Net::Domain::hostfqdn() . "\n";') - sed -i "s//<$HFQDN>/g" $OPENSRF_PREFIX/conf/opensrf.xml - sed -i "s/<\/localhost>/<\/$HFQDN>/g" $OPENSRF_PREFIX/conf/opensrf.xml - sed -i "s/\.localhost /dev/null -} -osrf_control_symlink() -{ - if [ -e /openils/bin/osrf_control ] - then - rm /openils/bin/osrf_control - ln -s /openils/bin/opensrf-perl.pl /openils/bin/osrf_control - else - ln -s /openils/bin/opensrf-perl.pl /openils/bin/osrf_control - fi -} - -modify_hosts_file -add_opensrf_user -reconfigure_ejabberd -register_ejabberd_users -modify_apache -configure_ld -fix_osrf_perms -configure_opensrf_xml -osrf_control_symlink - -update_rcd -#ldconfig -db_stop -DEBUG echo "Installation of OpenSRF completed!" -#DEBUG echo "Starting OpenSRF:" -echo "To start opensrf, run /etc/init.d/opensrf start" -echo "Please make sure any pending network changes have taken place before attempting this" -#/etc/init.d/opensrf start -exit 0 diff --git a/files_for_build/rules b/files_for_build/rules index 258b604..b0a73b6 100755 --- a/files_for_build/rules +++ b/files_for_build/rules @@ -6,7 +6,7 @@ export DH_VERBOSE=1 export DEB_CFLAGS_MAINT_APPEND= -Wno-error=format-security %: - dh $@ + dh $@ --with systemd override_dh_auto_configure: autoreconf -ivf ./configure --prefix=/openils --sysconfdir=/openils/conf --with-websockets-port=443 @@ -17,6 +17,8 @@ override_dh_usrlocal: override_dh_prep: rm -f debian/opensrf.substvars rm -f debian/opensrf.*.debhelper +override_dh_installinit: + true override_dh_auto_install: dh_auto_install #mv ./debian/opensrf/usr/local/share/perl/5.10.1/lib/perl5/* ./debian/opensrf/usr/local/share/perl/5.10.1/