diff betw. rapid's and the svn. asterisk

Tzafrir Cohen tzafrir.cohen@xorcom.com
Tue, 15 Feb 2005 16:17:59 +0200


Hi

[Warning: long message]

I'm syncing our asterisk package with the svn. I'd like to note some =
of
the differences.

I'm going over a diff between my original package (-) and the svn cop=
y
(+):


diff -ur ../../asterisk-1.0.5/debian/asterisk-config.install debian/a=
sterisk-config.install
--- ../../asterisk-1.0.5/debian/asterisk-config.install=092005-02-08 =
19:53:38.000000000 +0200
+++ debian/asterisk-config.install=092005-02-08 11:08:55.000000000 +0=
200
@@ -1 +1 @@
-etc/asterisk
+etc

Hmmm... What exactly is the asterisk-config package? For me it
represents only the asterisk configuration. Thus should only include
/etc/asterisk.

diff -ur ../../asterisk-1.0.5/debian/asterisk.install debian/asterisk=
.install
--- ../../asterisk-1.0.5/debian/asterisk.install=092005-02-08 19:53:3=
8.000000000 +0200
+++ debian/asterisk.install=092005-02-08 11:08:55.000000000 +0200

This, again, is for moving unnecessary things out of asterisk-config

@@ -1,4 +1,3 @@
-/etc/default
 usr/lib/asterisk
 usr/sbin
 usr/share/asterisk/agi-bin
diff -ur ../../asterisk-1.0.5/debian/asterisk-config.default debian/a=
sterisk-config.default
--- ../../asterisk-1.0.5/debian/asterisk-config.default=092005-02-15 =
14:47:09.000000000 +0200
+++ debian/asterisk-config.default=092005-02-08 11:08:55.000000000 +0=
200
@@ -5,16 +5,14 @@
 #               real-time priority (pass '-p' to asterisk). un-rem t=
he=20
 #               following line to disable asterisk from running in r=
eal-time=20
 #               priority
-#AST_REALTIME=3Dno
+AST_REALTIME=3Dno

The default config file should have no unremmed values, IMHO. I don't
think we can assume certain values are available in the config file.

I also believe that there is no longer a need to disable real-time
priority to enable running as a separate user.

 #
 # PARAMS: exra parameters to pass to asterisk
 #         The example here may help you in debugging, but is not int=
ended for=20
 #         production use.
-#         When you give -G *only* that group will be used, else all =
groups=20
-#         of the asterisk user.
+#         When you give -G *only* that group will be used, else all =
groups of the asterisk user.
 #PARAMS=3D"-g -vvv"

80 columns, please. That's what there is in the console.=20

 #
 #
-# RUNASTSAFE: run safe_asterisk rather than asterisk (will auto-rest=
art=20
-#             upon crash)
-#RUNASTSAFE=3Dno
+# RUNASTSAFE: run safe_asterisk rather than asterisk (will auto-rest=
art upon crash)
+RUNASTSAFE=3Dno

The two commnents above.

diff -ur ../../asterisk-1.0.5/debian/asterisk.init debian/asterisk.in=
it
--- ../../asterisk-1.0.5/debian/asterisk.init=092005-02-15 14:42:14.0=
00000000 +0200
+++ debian/asterisk.init=092005-02-14 10:15:07.000000000 +0200

Many modifications here. It is more robust. It also allows the option
'debug' so someone trying to trace the case of failed asterisk startu=
p
wn't run asterisk -c as root by accident and step over files owned by
asterisk.

@@ -17,11 +17,9 @@
 #

 PATH=3D/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-DAEMON=3D/usr/sbin/asterisk
 NAME=3Dasterisk
 USER=3D$NAME
 DESC=3D"Asterisk PBX"
-PIDFILE=3D"/var/run/asterisk/asterisk.pid"
=20
 # by default: use real-time priority
 PARAMS=3D""
@@ -32,82 +30,45 @@
 then
   PARAMS=3D"$PARAMS -p"
 fi
-
-if [ "x$USER" !=3D x ] && [ "x$USER" !=3D xroot ]
-then
-  PARAMS=3D"$PARAMS -U $USER"
-fi
-
-if [ "x$AST_DEBUG_PARAMS" =3D x ]=20
+if [ "x$USER" =3D "xroot" ] || [ `id -u "$USER"` =3D 0 ]
 then
-  AST_DEBUG_PARAMS=3D-cvv
+  echo "Starting as root not supported."
+  exit 1
 fi
-if [ "$RUNASTSAFE" =3D "yes" ];then
-  # The value of WRAPPER_DAEMON in can be set in /etc/default/asteri=
sk
-  WRAPPER_DAEMON=3D${WRAPPER_DAEMON:-/usr/sbin/safe_asterisk}
-=09REALDAEMON=3D"$WRAPPER_DAEMON"
+PARAMS=3D"$PARAMS -U $USER"
+if [ "x$RUNASTSAFE" =3D "xyes" ];then
+=09DAEMON=3D/usr/sbin/safe_asterisk
+=09REALDAEMON=3D/usr/sbin/asterisk
 else
-=09REALDAEMON=3D"$DAEMON"
+=09DAEMON=3D/usr/sbin/asterisk
 fi
=20
 test -x $DAEMON || exit 0
=20
 set -e
=20
-status() {
-=09plist=3D`ps auxw | grep "$DAEMON" | grep -v grep | awk '{print $2=
}' | tr '\012' ' '`
-=09if [ "$plist" =3D "" ]; then
-=09=09echo "$DESC is stopped"
-=09=09return 1
-=09else
-=09=09echo "$DESC is running: $plist"
-=09=09return 0
-=09fi
-}
-
 case "$1" in
-  debug)
-=09# we add too many special parameters that I don't want to skip
-=09# accidentally. I'm afraid that skipping -U once may cause
-=09# confusing results. I also want to maintain the user's choice
-=09# of -p
-=09echo "Debugging $DESC: "
-=09$DAEMON $PARAMS $AST_DEBUG_PARAMS
-=09exit 0
-=09;;
   start)
-=09if status > /dev/null; then
-=09=09echo "$DESC is already running. Use restart."
-=09=09exit 1
-=09fi
-=09echo -n "Starting $DESC: "
-=09if [ "$RUNASTSAFE" !=3D "yes" ];then
-=09=09if status > /dev/null; then
-=09=09=09echo "$DESC is already running. Use restart."
-=09=09=09exit 1
-=09=09fi
-=09fi
 =09echo -n "Starting $DESC: "
-=09start-stop-daemon --start --pidfile "$PIDFILE" --exec $REALDAEMON=
 -- $PARAMS
+=09start-stop-daemon --start --exec $DAEMON -- $PARAMS
 =09echo "$NAME."
 =09;;
   stop)
 =09echo -n "Stopping $DESC: "
-=09if [ "$RUNASTSAFE" =3D "yes" ];then
-=09=09# hopefully this will work. Untested
+=09if [ "x$RUNASTSAFE" =3D "xyes" ];then
 =09=09$REALDAEMON -rx 'stop now' > /dev/null  || true
 =09else
-=09=09# Try gracefully
-=09=09( $DAEMON -rx 'stop now' > /dev/null 2>&1 & ) &
+=09=09$DAEMON -rx 'stop now' > /dev/null  || true
 =09fi
-=09if [ "$RUNASTSAFE" =3D "yes" ];then
-=09=09start-stop-daemon --quiet --oknodo --stop --exec $WRAPPER_DAEM=
ON=20
-=09fi
-=09# Signal dance
-=09# KILL is necessary for the silly case of an asterisk -r in the b=
ackground
-=09start-stop-daemon --stop --quiet --oknodo --retry=3D0/2/TERM/2/KI=
LL/5 --exec $DAEMON
+=09echo -n "$NAME"
+=09# just making sure it's really, really dead.=20
+=09sleep 2
+=09if [ "x$RUNASTSAFE" =3D "xyes" ];then
+=09=09start-stop-daemon --quiet --oknodo --stop --exec $REALDAEMON=
=20
+=09else
+=09=09start-stop-daemon --quiet --oknodo --stop --exec $DAEMON=20
 =09fi
-=09echo "$NAME."
+=09echo "."
 =09exit 0
 =09;;
   reload)
@@ -125,14 +86,10 @@
 =09$0 stop
 =09$0 start
 =09;;
-  status)
-=09status
-=09exit $?
-=09;;
   *)
 =09N=3D/etc/init.d/$NAME
 =09# echo "Usage: $N {start|stop|restart|reload|logger-reload|extens=
ions-reload|force-reload}" >&2
-=09echo "Usage: $N {start|stop|status|restart|force-reload}" >&2
+=09echo "Usage: $N {start|stop|restart|force-reload}" >&2
 =09exit 1
 =09;;
 esac
diff -ur ../../asterisk-1.0.5/debian/patches/00list debian/patches/00=
list
--- ../../asterisk-1.0.5/debian/patches/00list=092005-02-14 16:30:36.=
000000000 +0200
+++ debian/patches/00list=092005-02-14 10:15:07.000000000 +0200

A number of our patches. spandsp will eventually be removed once I me=
rge
the separate package from Debian. And I'll force i586 rather than 386
for the moment.

@@ -5,13 +5,10 @@
 20_Makefile.dpatch
 25_subdirs_Makefiles.dpatch
 30_ast-data-dir.dpatch
-35_rapid-force-i586.dpatch
 40_initgroups.dpatch
 50_debian-libgsm.dpatch
 60_debian-libopenh323.dpatch
 70_debian-libpe-fe.dpatch
-75_debian-spandsp.dpatch
-80_rapid-globinclude.dpatch
 90_dot-nonfree.dpatch
 95_conf_sample.dpatch
 98_fpm-sounds.dpatch
35_rapid-force-i586.dpatch is only at ../../asterisk-1.0.5/debian/pat=
ches
75_debian-spandsp.dpatch is only at ../../asterisk-1.0.5/debian/patch=
es
80_rapid-globinclude.dpatc is only at ../../asterisk-1.0.5/debian/pat=
chesh
diff -ur ../../asterisk-1.0.5/debian/postinst debian/postinst
--- ../../asterisk-1.0.5/debian/postinst=092005-02-14 14:11:59.000000=
000 +0200
+++ debian/postinst=092005-02-08 11:08:55.000000000 +0200

This one should be replaced, when I figure a better option.
It is needed on udev-less systems (basically: 2.4).

Any idea for a more appropriate to do that on install/start-up time
would be wellcome.

@@ -27,11 +27,6 @@
 =09chown -R asterisk.asterisk /var/log/asterisk /var/run/asterisk \
 =09=09/var/spool/asterisk /var/lib/asterisk /etc/asterisk=20
 =09chmod o-rwx /etc/asterisk/*
-=09if [ -d /dev/zap ] && [ -e /dev/zap/ctl ]
-=09then
-=09=09chown asterisk.asterisk /dev/zap/*
-=09=09chmod o-rwx /dev/zap/*
-=09fi
=20
     ;;
=20
=2E./../asterisk-1.0.5/debian/-=D7=91 =D7=A7=D7=A8 =D7=90=D7=A6=D7=
=9E=D7=A0 rapid_conf
=2E./../asterisk-1.0.5/debian/-=D7=91 =D7=A7=D7=A8 =D7=90=D7=A6=D7=
=9E=D7=A0 README.Debian
diff -ur ../../asterisk-1.0.5/debian/rules debian/rules
--- ../../asterisk-1.0.5/debian/rules=092005-02-15 15:29:07.000000000=
 +0200
+++ debian/rules=092005-02-15 15:27:07.000000000 +0200

The rapid_conf stuff is basically rapid-specific, as it relies on the
globinclude patch. But feel free to take whatever you like from that
directory.

But I don't see any need for addmailbox on /usr/sbin . Asterisk creat=
es
mailboxes fine on its own. And if someone really needs that script, i=
t
is still avilable in the contrib dir.

@@ -96,7 +96,8 @@
 =09$(MAKE) INSTALL_PREFIX=3D$(CURDIR)/debian/tmp install samples
 =09cp debian/asterisk.conf $(CURDIR)/debian/tmp/etc/asterisk/asteris=
k.conf
 =09cp channels/h323/h323.conf.sample $(CURDIR)/debian/tmp/etc/asteri=
sk/h323.conf
-=09cp -a debian/rapid_conf/*  $(CURDIR)/debian/tmp/etc/asterisk/
+=09cp contrib/scripts/addmailbox $(CURDIR)/debian/tmp/usr/sbin/
+=09chmod +x $(CURDIR)/debian/tmp/usr/sbin/addmailbox
 =09mkdir -p $(CURDIR)/debian/tmp/etc/default/
 =09cp debian/asterisk-config.default $(CURDIR)/debian/tmp/etc/defaul=
t/asterisk
 =09mkdir -p $(CURDIR)/debian/tmp/usr/lib/cgi-bin/asterisk/
diff -ur ../../asterisk-1.0.5/debian/control debian/control
--- ../../asterisk-1.0.5/debian/control=092005-02-15 14:55:47.0000000=
00 +0200
+++ debian/control=092005-02-14 10:15:07.000000000 +0200

Description: I'd like more verbose descriptions for packages. But
then-again, I figure you're more experinced than me.=20

@@ -40,17 +40,11 @@
 Replaces: asterisk (<=3D 1:1.0.2-2)
 Section: comm
 Depends: ${shlibs:Depends}
-Description: h323 support for the Asterisk PBX
- Asterisk is an Open Source PBX and telephony toolkit.  It is, in a
- sense, middleware between Internet and telephony channels on the bo=
ttom,
- and Internet and telephony applications at the top.
- .
- Asterisk can be used with Voice over IP (SIP, H.323, IAX) standards=
, or the=20
- Public Switched Telephone Network (PSTN) through Supported Hardware=
.
- .
- This package provides a h323 support for the Asterisk system.
- It was separated out into its own package because of openh323's man=
y=20
- dependencies
+Description: asterisk H.323 VoIP channel
+ This package provides a h323 support for the Asterisk Open Source P=
BX system.
+ .
+ It was separated out into its own package to avoid having the main =
package
+ depend on the many openh323 dependencies
=20
 Package: asterisk-gtk-console
 Architecture: any
@@ -58,14 +52,7 @@
 Replaces: asterisk (<=3D 1.0.2-1)
 Section: comm
 Depends: ${shlibs:Depends}
-Description: gtk based console for the asterisk PBX
- Asterisk is an Open Source PBX and telephony toolkit.  It is, in a
- sense, middleware between Internet and telephony channels on the bo=
ttom,
- and Internet and telephony applications at the top.
- .
- Asterisk can be used with Voice over IP (SIP, H.323, IAX) standards=
, or the=20
- Public Switched Telephone Network (PSTN) through Supported Hardware=
.
- .
+Description: gtk based console for asterisk
  This package provides a limited GTK based console for the Asterisk =
Open Source
  PBX system.
  .
@@ -78,13 +65,8 @@
 Replaces: asterisk (<=3D0.1.12-3)
 Section: doc
 Architecture: all
-Description: documentation for the asterisk PBX
- Asterisk is an Open Source PBX and telephony toolkit.  It is, in a
- sense, middleware between Internet and telephony channels on the bo=
ttom,
- and Internet and telephony applications at the top.
- .
- Asterisk can be used with Voice over IP (SIP, H.323, IAX) standards=
, or the=20
- Public Switched Telephone Network (PSTN) through Supported Hardware=
.
+Description: documentation for asterisk
+ Asterisk is an Open Source PBX and telephony toolkit.
  .
  This package contains the source documentation needed if you wish t=
o
  extend the asterisk package.
@@ -95,13 +77,8 @@
 Conflicts: asterisk (<=3D0.1.12-3)
 Replaces: asterisk (<=3D0.1.12-3)
 Section: devel
-Description: development files for the asterisk PBX
- Asterisk is an Open Source PBX and telephony toolkit.  It is, in a
- sense, middleware between Internet and telephony channels on the bo=
ttom,
- and Internet and telephony applications at the top.
- .
- Asterisk can be used with Voice over IP (SIP, H.323, IAX) standards=
, or the=20
- Public Switched Telephone Network (PSTN) through Supported Hardware=
.
+Description: development files for asterisk
+ Asterisk is an Open Source PBX and telephony toolkit.
  .
  This package contains the include files used if you wish to compile=
 a
  package which requires asterisk source file headers.
@@ -112,13 +89,8 @@
 Conflicts: asterisk (<=3D0.1.12-3), asterisk-sounds (<=3D 1:1.0.2-1)
 Replaces: asterisk (<=3D0.4.0-5), asterisk-sounds (<=3D 1:1.0.2-1)
 Section: comm
-Description: sound files for the asterisk PBX
- Asterisk is an Open Source PBX and telephony toolkit.  It is, in a
- sense, middleware between Internet and telephony channels on the bo=
ttom,
- and Internet and telephony applications at the top.
- .
- Asterisk can be used with Voice over IP (SIP, H.323, IAX) standards=
, or the=20
- Public Switched Telephone Network (PSTN) through Supported Hardware=
.
+Description: sound files for asterisk
+ Asterisk is an Open Source PBX and telephony toolkit.
  .
  This package contains the default sound files for operation of aste=
risk
=20
@@ -128,12 +100,7 @@
 Depends: httpd-cgi
 Section: comm
 Description: web based (GCI) voice mail interface for asterisk
- Asterisk is an Open Source PBX and telephony toolkit.  It is, in a
- sense, middleware between Internet and telephony channels on the bo=
ttom,
- and Internet and telephony applications at the top.
- .
- Asterisk can be used with Voice over IP (SIP, H.323, IAX) standards=
, or the=20
- Public Switched Telephone Network (PSTN) through Supported Hardware=
.
+ Asterisk is an Open Source PBX and telephony toolkit.
  .
  This package contains a web-based interface for the voice-mail syst=
em
=20
@@ -142,12 +109,7 @@
 Replaces: asterisk (<=3D 1:1.0.2-2)
 Architecture: all
 Section: comm
-Description: configuration files for the asterisk PBX
- Asterisk is an Open Source PBX and telephony toolkit.  It is, in a
- sense, middleware between Internet and telephony channels on the bo=
ttom,
- and Internet and telephony applications at the top.
- .
- Asterisk can be used with Voice over IP (SIP, H.323, IAX) standards=
, or the=20
- Public Switched Telephone Network (PSTN) through Supported Hardware=
.
+Description: config files for asterisk
+ Asterisk is an Open Source PBX and telephony toolkit.
  .
  This package contains the configuration files of Asterisk

--=20
Tzafrir Cohen   icq#16849755  +972-50-7952406
tzafrir.cohen@xorcom.com    http://xorcom.com