From 1c1fa3f1ee83a971132dcc433db1bcde24e596a2 Mon Sep 17 00:00:00 2001 From: Chris Sharp Date: Mon, 21 Nov 2022 07:51:14 -0500 Subject: [PATCH] updating to latest --- build_opensrf_debs | 2 +- files_for_build/CONTROL | 4 +- files_for_build/CONTROL.cluster | 4 +- files_for_build/control.cluster | 3 +- files_for_build/postinst | 237 +++++++++++++++++++------------------- files_for_build/postinst.cluster | 238 ++++++++++++++++++++------------------- 6 files changed, 252 insertions(+), 236 deletions(-) diff --git a/build_opensrf_debs b/build_opensrf_debs index 32f0f9e..43c9e5d 100755 --- a/build_opensrf_debs +++ b/build_opensrf_debs @@ -18,7 +18,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -VERSION_="3.1.0" +VERSION_="3.2.2" ## Set work directory to current directory WORKDIR="$(dirname $(readlink -f $0))" diff --git a/files_for_build/CONTROL b/files_for_build/CONTROL index a59259e..002e4d5 100644 --- a/files_for_build/CONTROL +++ b/files_for_build/CONTROL @@ -1,13 +1,13 @@ Package: opensrf Source: opensrf -Version: 3.1.0 +Version: 3.2.2 Section: devel Priority: extra Architecture: amd64 Maintainer: Pines Admins Homepage: http://evergreen-ils.org Architecture: amd64 -Depends: ${shlibs:Depends}, ${misc:Depends},apache2, check, ejabberd, less, libapache2-mod-perl2, libcache-memcached-perl, libclass-dbi-abstractsearch-perl, libclass-dbi-sqlite-perl, libdatetime-format-builder-perl, libdatetime-format-iso8601-perl, libdatetime-format-mail-perl, libdatetime-perl, libdatetime-timezone-perl, liberror-perl, libexpat1-dev, libfile-find-rule-perl, libgcrypt11-dev, libgdbm-dev, libjson-xs-perl, liblog-log4perl-perl, libmemcached-dev, libmemcached-tools, libmodule-build-perl, libnet-dns-perl, libnet-server-perl, libreadline-dev, libtemplate-perl, libtest-pod-perl, libtie-ixhash-perl, libtool, libuniversal-require-perl, libunix-syslog-perl, libwww-perl, libxml-libxml-perl, libxml-libxslt-perl, libxml-simple-perl, memcached, ntpdate, pkg-config, psmisc, python-coverage, python-libxml2, python-memcache, python-nose, python-pyxmpp, python-setuptools, python-simplejson, tar +Depends: ${shlibs:Depends}, ${misc:Depends},apache2, check, ejabberd, less, libapache2-mod-perl2, libcache-memcached-perl, libclass-dbi-abstractsearch-perl, libclass-dbi-sqlite-perl, libdatetime-format-builder-perl, libdatetime-format-iso8601-perl, libdatetime-format-mail-perl, libdatetime-perl, libdatetime-timezone-perl, liberror-perl, libexpat1-dev, libfile-find-rule-perl, libgcrypt20-dev, libgdbm-dev, libjson-xs-perl, liblog-log4perl-perl, libmemcached-dev, libmemcached-tools, libmodule-build-perl, libnet-dns-perl, libnet-server-perl, libreadline-dev, libtemplate-perl, libtest-pod-perl, libtie-ixhash-perl, libtool, libuniversal-require-perl, libunix-syslog-perl, libwww-perl, libxml-libxml-perl, libxml-libxslt-perl, libxml-simple-perl, memcached, ntpdate, pkg-config, psmisc, python-coverage, python-libxml2, python-memcache, python-nose, python-pyxmpp, python-setuptools, python-simplejson, tar Description: OpenSRF Message Routing Framework (standalone) Open Service Request Framework (OpenSRF, pronounced "open surf") diff --git a/files_for_build/CONTROL.cluster b/files_for_build/CONTROL.cluster index 03ff1c6..9e31a14 100644 --- a/files_for_build/CONTROL.cluster +++ b/files_for_build/CONTROL.cluster @@ -1,13 +1,13 @@ Package: opensrf Source: opensrf -Version: 3.1.0 +Version: 3.2.2 Section: devel Priority: extra Architecture: amd64 Maintainer: Joshua Lamos Homepage: http://open-ils.org Architecture: amd64 -Depends: ${shlibs:Depends}, ${misc:Depends}, apache2, check, ejabberd, less, libapache2-mod-perl2, libcache-memcached-perl, libclass-dbi-abstractsearch-perl, libclass-dbi-sqlite-perl, libdatetime-format-builder-perl, libdatetime-format-iso8601-perl, libdatetime-format-mail-perl, libdatetime-perl, libdatetime-timezone-perl, liberror-perl, libexpat1-dev, libfile-find-rule-perl, libgcrypt11-dev, libgdbm-dev, libjson-xs-perl, liblog-log4perl-perl, libmemcached-dev, libmemcached-tools, libmodule-build-perl, libnet-dns-perl, libnet-server-perl, libreadline-dev, libtemplate-perl, libtest-pod-perl, libtie-ixhash-perl, libtool, libuniversal-require-perl, libunix-syslog-perl, libwww-perl, libxml-libxml-perl, libxml-libxslt-perl, libxml-simple-perl, memcached, ntpdate, pkg-config, psmisc, python-coverage, python-libxml2, python-memcache, python-nose, python-pyxmpp, python-setuptools, python-simplejson, tar, unzip, zip +Depends: ${shlibs:Depends}, ${misc:Depends}, apache2, check, ejabberd, less, libapache2-mod-perl2, libcache-memcached-perl, libclass-dbi-abstractsearch-perl, libclass-dbi-sqlite-perl, libdatetime-format-builder-perl, libdatetime-format-iso8601-perl, libdatetime-format-mail-perl, libdatetime-perl, libdatetime-timezone-perl, liberror-perl, libexpat1-dev, libfile-find-rule-perl, libgcrypt20-dev, libgdbm-dev, libjson-xs-perl, liblog-log4perl-perl, libmemcached-dev, libmemcached-tools, libmodule-build-perl, libnet-dns-perl, libnet-server-perl, libreadline-dev, libtemplate-perl, libtest-pod-perl, libtie-ixhash-perl, libtool, libuniversal-require-perl, libunix-syslog-perl, libwww-perl, libxml-libxml-perl, libxml-libxslt-perl, libxml-simple-perl, memcached, ntpdate, pkg-config, psmisc, python-coverage, python-libxml2, python-memcache, python-nose, python-pyxmpp, python-setuptools, python-simplejson, tar, unzip, zip Description: OpenSRF Message Routing Framework (clustered) Open Service Request Framework (OpenSRF, pronounced "open surf") diff --git a/files_for_build/control.cluster b/files_for_build/control.cluster index 6619baf..6ee5d73 100644 --- a/files_for_build/control.cluster +++ b/files_for_build/control.cluster @@ -8,9 +8,10 @@ Homepage: http://evergreen-ils.org Package: opensrf Architecture: amd64 -Depends: ${shlibs:Depends}, ${misc:Depends}, apache2, check, ejabberd, less, libapache2-mod-perl2, libcache-memcached-perl, libclass-dbi-abstractsearch-perl, libclass-dbi-sqlite-perl, libdatetime-format-builder-perl, libdatetime-format-iso8601-perl, libdatetime-format-mail-perl, libdatetime-perl, libdatetime-timezone-perl, liberror-perl, libexpat1-dev, libfile-find-rule-perl, libgcrypt11-dev, libgdbm-dev, libjson-xs-perl, liblog-log4perl-perl, libmemcached-dev, libmemcached-tools, libmodule-build-perl, libnet-dns-perl, libnet-server-perl, libreadline-dev, libtemplate-perl, libtest-pod-perl, libtie-ixhash-perl, libtool, libuniversal-require-perl, libunix-syslog-perl, libwww-perl, libxml-libxml-perl, libxml-libxslt-perl, libxml-simple-perl, memcached, ntpdate, pkg-config, psmisc, python-coverage, python-libxml2, python-memcache, python-nose, python-pyxmpp, python-setuptools, python-simplejson, tar, unzip, zip +Depends: ${shlibs:Depends}, ${misc:Depends}, apache2, check, ejabberd, less, libapache2-mod-perl2, libcache-memcached-perl, libclass-dbi-abstractsearch-perl, libclass-dbi-sqlite-perl, libdatetime-format-builder-perl, libdatetime-format-iso8601-perl, libdatetime-format-mail-perl, libdatetime-perl, libdatetime-timezone-perl, liberror-perl, libexpat1-dev, libfile-find-rule-perl, libgcrypt20-dev, libgdbm-dev, libjson-xs-perl, liblog-log4perl-perl, libmemcached-dev, libmemcached-tools, libmodule-build-perl, libnet-dns-perl, libnet-server-perl, libreadline-dev, libtemplate-perl, libtest-pod-perl, libtie-ixhash-perl, libtool, libuniversal-require-perl, libunix-syslog-perl, libwww-perl, libxml-libxml-perl, libxml-libxslt-perl, libxml-simple-perl, memcached, ntpdate, pkg-config, psmisc, python-coverage, python-libxml2, python-memcache, python-nose, python-pyxmpp, python-setuptools, python-simplejson, tar, unzip, zip Description: OpenSRF Message Routing Network (clustered) Open Service Request Framework (OpenSRF, pronounced "open surf") OpenSRF is a message routing network that offers scalability and failover support for individual services and entire servers with minimal development and deployment overhead. + diff --git a/files_for_build/postinst b/files_for_build/postinst index 45d3746..081c390 100755 --- a/files_for_build/postinst +++ b/files_for_build/postinst @@ -9,66 +9,66 @@ OPENSRF_PREFIX="/openils" HFQDN=$(perl -MNet::Domain -e 'print Net::Domain::hostfqdn() . "\n";') DEBUG() { - if [ $_DEBUG > 0 ]; then $@;fi + 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!" - +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 +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" + 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!" - + 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!" + 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() @@ -76,52 +76,59 @@ fi reconfigure_ejabberd() { 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 - - #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.yml - /etc/init.d/ejabberd start - else - DEBUG echo "Ejabberd has already been modified (or atleast the hosts line has). No Changes made." +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 ### Pre 18.04 + sed -i 's/\max_user_sessions: 10\>/max_user_sessions: 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 + #starttls_reqired + sed -i 's/starttls_required: true/starttls_required: false/g' $EJABBERD_CONFIG_FILE + + #mod_legacy_auth + sed -i 's/## mod_legacy_auth: {}/mod_legacy_auth: {}/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.yml + /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 + 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." @@ -162,7 +169,7 @@ register_ejabberd_users() echo if [ $flag -eq 1 ] ; then - add_ejabber_user router private.$HFQDN $EJABBER_PASS + 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 @@ -187,7 +194,7 @@ for m in ssl osrf_http_translator osrf_json_gateway; do a2enmod $m > /dev/null; # 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 + /etc/init.d/apache2 restart fi } #modify_apache() @@ -197,14 +204,14 @@ 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!" + 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() @@ -218,43 +225,43 @@ 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 + 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/<$HFQDN>/g" $OPENSRF_PREFIX/conf/opensrf.xml + sed -i "s/<\/localhost>/<\/$HFQDN>/g" $OPENSRF_PREFIX/conf/opensrf.xml + sed -i "s/\.localhost /dev/null + update-rc.d opensrf defaults > /dev/null } enable_opensrf_service() { - systemctl enable opensrf.service + systemctl enable opensrf.service } 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 + 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 diff --git a/files_for_build/postinst.cluster b/files_for_build/postinst.cluster index 038c19d..352dd94 100755 --- a/files_for_build/postinst.cluster +++ b/files_for_build/postinst.cluster @@ -9,66 +9,66 @@ OPENSRF_PREFIX="/openils" HFQDN=$(perl -MNet::Domain -e 'print Net::Domain::hostfqdn() . "\n";') DEBUG() { - if [ $_DEBUG > 0 ]; then $@;fi + 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!" - +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 +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" + 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!" - + 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!" +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() @@ -76,52 +76,60 @@ fi reconfigure_ejabberd() { 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 - - #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.yml - /etc/init.d/ejabberd start - else - DEBUG echo "Ejabberd has already been modified (or atleast the hosts line has). No Changes made." +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 ### pre 18.04 + sed -i 's/\max_user_sessions: 10\>/max_user_sessions: 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 + + #starttls_reqired + sed -i 's/starttls_required: true/starttls_required: false/g' $EJABBERD_CONFIG_FILE + + #mod_legacy_auth + sed -i 's/## mod_legacy_auth: {}/mod_legacy_auth: {}/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.yml + /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 + 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." @@ -162,7 +170,7 @@ register_ejabberd_users() echo if [ $flag -eq 1 ] ; then - add_ejabber_user router private.$HFQDN $EJABBER_PASS + 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 @@ -187,7 +195,7 @@ for m in ssl osrf_http_translator osrf_json_gateway; do a2enmod $m > /dev/null; # 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 + /etc/init.d/apache2 restart fi } #modify_apache() @@ -197,14 +205,14 @@ 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!" +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() @@ -218,41 +226,41 @@ 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 + 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/<$HFQDN>/g" $OPENSRF_PREFIX/conf/opensrf.xml + sed -i "s/<\/localhost>/<\/$HFQDN>/g" $OPENSRF_PREFIX/conf/opensrf.xml + sed -i "s/\.localhost /dev/null + update-rc.d opensrf defaults > /dev/null } enable_opensrf_service() { - systemctl enable opensrf.service + systemctl enable opensrf.service } 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 + 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 -- 2.11.0