# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-VERSION_="3.1.0"
+VERSION_="3.2.2"
## Set work directory to current directory
WORKDIR="$(dirname $(readlink -f $0))"
Package: opensrf
Source: opensrf
-Version: 3.1.0
+Version: 3.2.2
Section: devel
Priority: extra
Architecture: amd64
Maintainer: Pines Admins <pines-admins@georgialibraries.org>
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")
Package: opensrf
Source: opensrf
-Version: 3.1.0
+Version: 3.2.2
Section: devel
Priority: extra
Architecture: amd64
Maintainer: Joshua Lamos <jlamos@georgialibraries.org>
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")
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.
+
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()
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: 10\>/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: 10\>/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."
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
# 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()
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()
}
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/<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_core.xml
- sed -i "s/\.localhost</\.$HFQDN</g" $OPENSRF_PREFIX/conf/opensrf.xml
- sed -i "s/\.localhost</\.$HFQDN</g" /home/opensrf/.srfsh.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_core.xml
+ sed -i "s/\.localhost</\.$HFQDN</g" $OPENSRF_PREFIX/conf/opensrf.xml
+ sed -i "s/\.localhost</\.$HFQDN</g" /home/opensrf/.srfsh.xml
}
update_rcd()
{
- update-rc.d opensrf defaults > /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
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()
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: 10\>/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: 10\>/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."
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
# 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()
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()
}
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/<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_core.xml
- sed -i "s/\.localhost</\.$HFQDN</g" $OPENSRF_PREFIX/conf/opensrf.xml
- sed -i "s/\.localhost</\.$HFQDN</g" /home/opensrf/.srfsh.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_core.xml
+ sed -i "s/\.localhost</\.$HFQDN</g" $OPENSRF_PREFIX/conf/opensrf.xml
+ sed -i "s/\.localhost</\.$HFQDN</g" /home/opensrf/.srfsh.xml
}
update_rcd()
{
- update-rc.d opensrf defaults > /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