Skip to content

Commit

Permalink
pkg/kamailio/deb: kamailio.init use $NAME as basename "$0" and chown …
Browse files Browse the repository at this point in the history
…HOMEDIR when created

(manual cherry picked from commit 7cf6368)
(manual cherry picked from commit 62c4a48)
  • Loading branch information
linuxmaniac committed Jul 14, 2015
1 parent 9c6eef9 commit 2acfc53
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 48 deletions.
17 changes: 9 additions & 8 deletions pkg/kamailio/deb/debian/kamailio.init
Expand Up @@ -16,12 +16,12 @@

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/kamailio
NAME=kamailio
NAME=`basename "$0"`
DESC="Kamailio SIP Server"
HOMEDIR=/var/run/kamailio
HOMEDIR=/var/run/$NAME
PIDFILE=$HOMEDIR/$NAME.pid
DEFAULTS=/etc/default/kamailio
CFGFILE=/etc/kamailio/kamailio.cfg
DEFAULTS=/etc/default/$NAME
CFGFILE=/etc/$NAME/kamailio.cfg
RUN_KAMAILIO=no
USER=kamailio
GROUP=kamailio
Expand Down Expand Up @@ -67,9 +67,9 @@ create_radius_seqfile ()
# write to the file. If the file exists before kamailio starts, it
# won't change it's ownership and will be writable for both root
# and kamailio, no matter what options are chosen at install time
RADIUS_SEQ_FILE=/var/run/kamailio/kamailio_radius.seq
if [ -d /var/run/kamailio ]; then
chown ${USER}:${GROUP} /var/run/kamailio
RADIUS_SEQ_FILE="$HOMEDIR/kamailio_radius.seq"
if [ -d $HOMEDIR ]; then
chown ${USER}:${GROUP} $HOMEDIR

if [ ! -f $RADIUS_SEQ_FILE ]; then
touch $RADIUS_SEQ_FILE
Expand All @@ -88,7 +88,7 @@ if [ -f $DEFAULTS ]; then
fi

if [ "$RUN_KAMAILIO" != "yes" ]; then
log_failure_msg "Kamailio not yet configured. Edit /etc/default/kamailio first."
log_failure_msg "Kamailio not yet configured. Edit /etc/default/$NAME first."
exit 0
fi

Expand All @@ -115,6 +115,7 @@ fi
# /var/run can be a tmpfs
if [ ! -d $HOMEDIR ]; then
mkdir -p $HOMEDIR
chown ${USER}:${GROUP} $HOMEDIR
fi

OPTIONS="-f $CFGFILE -P $PIDFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP"
Expand Down
17 changes: 9 additions & 8 deletions pkg/kamailio/deb/jessie/kamailio.init
Expand Up @@ -16,12 +16,12 @@

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/kamailio
NAME=kamailio
NAME=`basename "$0"`
DESC="Kamailio SIP Server"
HOMEDIR=/var/run/kamailio
HOMEDIR=/var/run/$NAME
PIDFILE=$HOMEDIR/$NAME.pid
DEFAULTS=/etc/default/kamailio
CFGFILE=/etc/kamailio/kamailio.cfg
DEFAULTS=/etc/default/$NAME
CFGFILE=/etc/$NAME/kamailio.cfg
RUN_KAMAILIO=no
USER=kamailio
GROUP=kamailio
Expand Down Expand Up @@ -67,9 +67,9 @@ create_radius_seqfile ()
# write to the file. If the file exists before kamailio starts, it
# won't change it's ownership and will be writable for both root
# and kamailio, no matter what options are chosen at install time
RADIUS_SEQ_FILE=/var/run/kamailio/kamailio_radius.seq
if [ -d /var/run/kamailio ]; then
chown ${USER}:${GROUP} /var/run/kamailio
RADIUS_SEQ_FILE="$HOMEDIR/kamailio_radius.seq"
if [ -d $HOMEDIR ]; then
chown ${USER}:${GROUP} $HOMEDIR

if [ ! -f $RADIUS_SEQ_FILE ]; then
touch $RADIUS_SEQ_FILE
Expand All @@ -88,7 +88,7 @@ if [ -f $DEFAULTS ]; then
fi

if [ "$RUN_KAMAILIO" != "yes" ]; then
log_failure_msg "Kamailio not yet configured. Edit /etc/default/kamailio first."
log_failure_msg "Kamailio not yet configured. Edit /etc/default/$NAME first."
exit 0
fi

Expand All @@ -115,6 +115,7 @@ fi
# /var/run can be a tmpfs
if [ ! -d $HOMEDIR ]; then
mkdir -p $HOMEDIR
chown ${USER}:${GROUP} $HOMEDIR
fi

OPTIONS="-f $CFGFILE -P $PIDFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP"
Expand Down
17 changes: 9 additions & 8 deletions pkg/kamailio/deb/precise/kamailio.init
Expand Up @@ -16,12 +16,12 @@

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/kamailio
NAME=kamailio
NAME=`basename "$0"`
DESC="Kamailio SIP Server"
HOMEDIR=/var/run/kamailio
HOMEDIR=/var/run/$NAME
PIDFILE=$HOMEDIR/$NAME.pid
DEFAULTS=/etc/default/kamailio
CFGFILE=/etc/kamailio/kamailio.cfg
DEFAULTS=/etc/default/$NAME
CFGFILE=/etc/$NAME/kamailio.cfg
RUN_KAMAILIO=no
USER=kamailio
GROUP=kamailio
Expand Down Expand Up @@ -67,9 +67,9 @@ create_radius_seqfile ()
# write to the file. If the file exists before kamailio starts, it
# won't change it's ownership and will be writable for both root
# and kamailio, no matter what options are chosen at install time
RADIUS_SEQ_FILE=/var/run/kamailio/kamailio_radius.seq
if [ -d /var/run/kamailio ]; then
chown ${USER}:${GROUP} /var/run/kamailio
RADIUS_SEQ_FILE="$HOMEDIR/kamailio_radius.seq"
if [ -d $HOMEDIR ]; then
chown ${USER}:${GROUP} $HOMEDIR

if [ ! -f $RADIUS_SEQ_FILE ]; then
touch $RADIUS_SEQ_FILE
Expand All @@ -88,7 +88,7 @@ if [ -f $DEFAULTS ]; then
fi

if [ "$RUN_KAMAILIO" != "yes" ]; then
log_failure_msg "Kamailio not yet configured. Edit /etc/default/kamailio first."
log_failure_msg "Kamailio not yet configured. Edit /etc/default/$NAME first."
exit 0
fi

Expand All @@ -115,6 +115,7 @@ fi
# /var/run can be a tmpfs
if [ ! -d $HOMEDIR ]; then
mkdir -p $HOMEDIR
chown ${USER}:${GROUP} $HOMEDIR
fi

OPTIONS="-f $CFGFILE -P $PIDFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP"
Expand Down
17 changes: 9 additions & 8 deletions pkg/kamailio/deb/squeeze/kamailio.init
Expand Up @@ -16,12 +16,12 @@

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/kamailio
NAME=kamailio
NAME=`basename "$0"`
DESC="Kamailio SIP Server"
HOMEDIR=/var/run/kamailio
HOMEDIR=/var/run/$NAME
PIDFILE=$HOMEDIR/$NAME.pid
DEFAULTS=/etc/default/kamailio
CFGFILE=/etc/kamailio/kamailio.cfg
DEFAULTS=/etc/default/$NAME
CFGFILE=/etc/$NAME/kamailio.cfg
RUN_KAMAILIO=no
USER=kamailio
GROUP=kamailio
Expand Down Expand Up @@ -67,9 +67,9 @@ create_radius_seqfile ()
# write to the file. If the file exists before kamailio starts, it
# won't change it's ownership and will be writable for both root
# and kamailio, no matter what options are chosen at install time
RADIUS_SEQ_FILE=/var/run/kamailio/kamailio_radius.seq
if [ -d /var/run/kamailio ]; then
chown ${USER}:${GROUP} /var/run/kamailio
RADIUS_SEQ_FILE="$HOMEDIR/kamailio_radius.seq"
if [ -d $HOMEDIR ]; then
chown ${USER}:${GROUP} $HOMEDIR

if [ ! -f $RADIUS_SEQ_FILE ]; then
touch $RADIUS_SEQ_FILE
Expand All @@ -88,7 +88,7 @@ if [ -f $DEFAULTS ]; then
fi

if [ "$RUN_KAMAILIO" != "yes" ]; then
log_failure_msg "Kamailio not yet configured. Edit /etc/default/kamailio first."
log_failure_msg "Kamailio not yet configured. Edit /etc/default/$NAME first."
exit 0
fi

Expand All @@ -115,6 +115,7 @@ fi
# /var/run can be a tmpfs
if [ ! -d $HOMEDIR ]; then
mkdir -p $HOMEDIR
chown ${USER}:${GROUP} $HOMEDIR
fi

OPTIONS="-f $CFGFILE -P $PIDFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP"
Expand Down
17 changes: 9 additions & 8 deletions pkg/kamailio/deb/trusty/kamailio.init
Expand Up @@ -16,12 +16,12 @@

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/kamailio
NAME=kamailio
NAME=`basename "$0"`
DESC="Kamailio SIP Server"
HOMEDIR=/var/run/kamailio
HOMEDIR=/var/run/$NAME
PIDFILE=$HOMEDIR/$NAME.pid
DEFAULTS=/etc/default/kamailio
CFGFILE=/etc/kamailio/kamailio.cfg
DEFAULTS=/etc/default/$NAME
CFGFILE=/etc/$NAME/kamailio.cfg
RUN_KAMAILIO=no
USER=kamailio
GROUP=kamailio
Expand Down Expand Up @@ -67,9 +67,9 @@ create_radius_seqfile ()
# write to the file. If the file exists before kamailio starts, it
# won't change it's ownership and will be writable for both root
# and kamailio, no matter what options are chosen at install time
RADIUS_SEQ_FILE=/var/run/kamailio/kamailio_radius.seq
if [ -d /var/run/kamailio ]; then
chown ${USER}:${GROUP} /var/run/kamailio
RADIUS_SEQ_FILE="$HOMEDIR/kamailio_radius.seq"
if [ -d $HOMEDIR ]; then
chown ${USER}:${GROUP} $HOMEDIR

if [ ! -f $RADIUS_SEQ_FILE ]; then
touch $RADIUS_SEQ_FILE
Expand All @@ -88,7 +88,7 @@ if [ -f $DEFAULTS ]; then
fi

if [ "$RUN_KAMAILIO" != "yes" ]; then
log_failure_msg "Kamailio not yet configured. Edit /etc/default/kamailio first."
log_failure_msg "Kamailio not yet configured. Edit /etc/default/$NAME first."
exit 0
fi

Expand All @@ -115,6 +115,7 @@ fi
# /var/run can be a tmpfs
if [ ! -d $HOMEDIR ]; then
mkdir -p $HOMEDIR
chown ${USER}:${GROUP} $HOMEDIR
fi

OPTIONS="-f $CFGFILE -P $PIDFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP"
Expand Down
17 changes: 9 additions & 8 deletions pkg/kamailio/deb/wheezy/kamailio.init
Expand Up @@ -16,12 +16,12 @@

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/kamailio
NAME=kamailio
NAME=`basename "$0"`
DESC="Kamailio SIP Server"
HOMEDIR=/var/run/kamailio
HOMEDIR=/var/run/$NAME
PIDFILE=$HOMEDIR/$NAME.pid
DEFAULTS=/etc/default/kamailio
CFGFILE=/etc/kamailio/kamailio.cfg
DEFAULTS=/etc/default/$NAME
CFGFILE=/etc/$NAME/kamailio.cfg
RUN_KAMAILIO=no
USER=kamailio
GROUP=kamailio
Expand Down Expand Up @@ -67,9 +67,9 @@ create_radius_seqfile ()
# write to the file. If the file exists before kamailio starts, it
# won't change it's ownership and will be writable for both root
# and kamailio, no matter what options are chosen at install time
RADIUS_SEQ_FILE=/var/run/kamailio/kamailio_radius.seq
if [ -d /var/run/kamailio ]; then
chown ${USER}:${GROUP} /var/run/kamailio
RADIUS_SEQ_FILE="$HOMEDIR/kamailio_radius.seq"
if [ -d $HOMEDIR ]; then
chown ${USER}:${GROUP} $HOMEDIR

if [ ! -f $RADIUS_SEQ_FILE ]; then
touch $RADIUS_SEQ_FILE
Expand All @@ -88,7 +88,7 @@ if [ -f $DEFAULTS ]; then
fi

if [ "$RUN_KAMAILIO" != "yes" ]; then
log_failure_msg "Kamailio not yet configured. Edit /etc/default/kamailio first."
log_failure_msg "Kamailio not yet configured. Edit /etc/default/$NAME first."
exit 0
fi

Expand All @@ -115,6 +115,7 @@ fi
# /var/run can be a tmpfs
if [ ! -d $HOMEDIR ]; then
mkdir -p $HOMEDIR
chown ${USER}:${GROUP} $HOMEDIR
fi

OPTIONS="-f $CFGFILE -P $PIDFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP"
Expand Down

0 comments on commit 2acfc53

Please sign in to comment.