Deal with systems where modules are preloaded from /etc/modules

Explicitely require /bin/bash as shell, echo -e does not work in sh.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5071 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2012-05-23 13:29:18 +00:00
parent 06cf56e116
commit cd38769d33
1 changed files with 12 additions and 3 deletions

View File

@ -1,16 +1,25 @@
#! /bin/sh
#! /bin/bash
# This script configures Linux SCTP parameters for use with SIGTRAN
if [ ! -f /etc/sysctl.conf -o ! -f /etc/modprobe.conf -o ! -d /proc/sys/net ]; then
if [ ! -f /etc/sysctl.conf -o ! -d /proc/sys/net ]; then
echo "Your system does not look like Linux!" >&2
exit 1
fi
modfile="/etc/modprobe.preload"
if [ ! -f /etc/modprobe.conf ]; then
modfile="/etc/modules"
if [ ! -f "$modfile" ]; then
echo "Cannot identify modules preload file!" >&2
exit 1
fi
fi
if [ x`id -u` != x0 ]; then
echo "You must run this command as root!" >&2
exit 1
fi
grep -q sctp /etc/modprobe.preload || echo -e '\n# SCTP must be loaded early for sysctl\nsctp' >> /etc/modprobe.preload
grep -q sctp "$modfile" || echo -e '\n# SCTP must be loaded early for sysctl\nsctp' >> "$modfile"
grep -q 'SCTP tweaking' /etc/sysctl.conf || echo -e '\n# SCTP tweaking for SIGTRAN\nnet.sctp.rto_min=200\nnet.sctp.rto_initial=400\nnet.sctp.rto_max=800\nnet.sctp.hb_interval=5000' >> /etc/sysctl.conf