summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Pickford2016-02-18 01:44:53 -0800
committerPeter Pickford2016-02-18 05:30:13 -0800
commit90de26a6e4913fc7099717724e7348f90620e9a0 (patch)
tree166dd14f5a755ae18bbd7e48891cc0f0d20413e8
parent59662e16c4aafd1e71b1a632cfb9e96c0d08ffb1 (diff)
downloadaur-90de26a6e4913fc7099717724e7348f90620e9a0.tar.gz
build vgetty instead of mgetty
remove Makefile.patch - not used fix manpage and info files localtion, update info dir fix install-info stdin closed problem (use </dev/null) update md5sums correct .SRCINFO for mgetty-vgetty update maintainer and .SRCINFO
-rw-r--r--.SRCINFO24
-rw-r--r--Makefile.patch135
-rw-r--r--PKGBUILD60
-rw-r--r--config.patch40
-rw-r--r--faxrunqd@.service12
-rw-r--r--mgetty.install16
-rw-r--r--mgetty@.service13
-rw-r--r--mgetty_cid.patch224
-rw-r--r--vgetty@.service35
9 files changed, 369 insertions, 190 deletions
diff --git a/.SRCINFO b/.SRCINFO
index f16a7350c979..a59adf2f9d97 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,9 @@
-pkgbase = mgetty
- pkgdesc = Mgetty is a versatile program to handle all aspects of a modem under Unix.
+# Generated by makepkg 5.0.0
+# Thu Feb 18 12:08:19 UTC 2016
+pkgbase = mgetty-vgetty
+ pkgdesc = vgetty - voice extension to the mgetty+sendfax program.
pkgver = 1.1.37
- pkgrel = 5
+ pkgrel = 1
url = http://mgetty.greenie.net/
install = mgetty.install
arch = i686
@@ -13,17 +15,21 @@ pkgbase = mgetty
depends = udev
depends = netpbm
source = http://fossies.org/unix/misc/mgetty1.1.37-Jun05.tar.gz
- source = Makefile.patch
source = config.patch
source = policy.patch
+ source = mgetty_cid.patch
source = 90-mgetty.rules
- source = mgetty@.service
+ source = vgetty@.service
+ source = faxrunqd@.service
+ source = mgetty.install
md5sums = 4df2eb47bd6d5318d3d642572ab56e51
- md5sums = eaa2b17d77ca099ebb7e92cf2006f6c1
- md5sums = d40de3f241a2851f091e0046cb7f28c0
+ md5sums = fd02c6dd7374e78458840432660729f7
md5sums = 5556e5e88c784e75acb14ab998d7eb1a
+ md5sums = c160d250f98140ddc3818fef34e940b6
md5sums = 4b73a5654db86a34a8dccdf5f55c699c
- md5sums = cbc70329924235e8f2e6302c859d59a6
+ md5sums = 3c1b50a8bebf9a2d6e4252fce79f4c34
+ md5sums = 9aa2b3ff3ff4daa5ed018d4fac8d86b4
+ md5sums = 8cb2c82dba8e8439832b021b175c83f5
-pkgname = mgetty
+pkgname = mgetty-vgetty
diff --git a/Makefile.patch b/Makefile.patch
deleted file mode 100644
index b545b4d0ec1d..000000000000
--- a/Makefile.patch
+++ /dev/null
@@ -1,135 +0,0 @@
-172a173,176
-> # Installation prefix for Build
-> #
-> DESTDIR=""
-> #
-175c179
-< prefix=/usr/local
----
-> prefix=/usr
-183c187
-< SBINDIR=$(prefix)/sbin
----
-> SBINDIR=/usr/sbin
-195c199
-< CONFDIR=$(prefix)/etc/mgetty+sendfax
----
-> CONFDIR=/etc/mgetty+sendfax
-588,589c592,593
-< -test -d $(BINDIR) || ( ./mkidirs $(BINDIR) ; chmod 755 $(BINDIR) )
-< $(INSTALL) -m 755 newslock $(BINDIR)
----
-> -test -d $(DESTDIR)$(BINDIR) || ( ./mkidirs $(DESTDIR)$(BINDIR) ; chmod 755 $(DESTDIR)$(BINDIR) )
-> $(INSTALL) -m 755 newslock $(DESTDIR)$(BINDIR)
-591,595c595,599
-< -test -d $(SBINDIR) || ( ./mkidirs $(SBINDIR) ; chmod 755 $(SBINDIR) )
-< -mv -f $(SBINDIR)/mgetty $(SBINDIR)/mgetty.old
-< -mv -f $(SBINDIR)/sendfax $(SBINDIR)/sendfax.old
-< $(INSTALL) -s -m 700 mgetty $(SBINDIR)
-< $(INSTALL) -s -m 755 sendfax $(SBINDIR)
----
-> -test -d $(DESTDIR)$(SBINDIR) || ( ./mkidirs $(DESTDIR)$(SBINDIR) ; chmod 755 $(DESTDIR)$(SBINDIR) )
-> -mv -f $(DESTDIR)$(SBINDIR)/mgetty $(DESTDIR)$(SBINDIR)/mgetty.old
-> -mv -f $(DESTDIR)$(SBINDIR)/sendfax $(DESTDIR)$(SBINDIR)/sendfax.old
-> $(INSTALL) -s -m 700 mgetty $(DESTDIR)$(SBINDIR)
-> $(INSTALL) -s -m 755 sendfax $(DESTDIR)$(SBINDIR)
-599,612c603,616
-< test -d $(LIBDIR) || \
-< ( ./mkidirs $(LIBDIR) && chmod 755 $(LIBDIR) )
-< test -d $(CONFDIR) || \
-< ( ./mkidirs $(CONFDIR) && chmod 755 $(CONFDIR))
-< test -f $(CONFDIR)/login.config || \
-< $(INSTALL) -o root -m 600 login.config $(CONFDIR)/
-< test -f $(CONFDIR)/mgetty.config || \
-< $(INSTALL) -o root -m 600 mgetty.config $(CONFDIR)/
-< test -f $(CONFDIR)/sendfax.config || \
-< $(INSTALL) -o root -m 644 sendfax.config $(CONFDIR)/
-< test -f $(CONFDIR)/dialin.config || \
-< $(INSTALL) -o root -m 600 dialin.config $(CONFDIR)/
-< test -f $(CONFDIR)/faxrunq.config || \
-< $(INSTALL) -o root -m 644 faxrunq.config $(CONFDIR)/
----
-> test -d $(DESTDIR)$(LIBDIR) || \
-> ( ./mkidirs $(DESTDIR)$(LIBDIR) && chmod 755 $(DESTDIR)$(LIBDIR) )
-> test -d $(DESTDIR)$(CONFDIR) || \
-> ( ./mkidirs $(DESTDIR)$(CONFDIR) && chmod 755 $(DESTDIR)$(CONFDIR))
-> test -f $(DESTDIR)$(CONFDIR)/login.config || \
-> $(INSTALL) -o root -m 600 login.config $(DESTDIR)$(CONFDIR)/
-> test -f $(DESTDIR)$(CONFDIR)/mgetty.config || \
-> $(INSTALL) -o root -m 600 mgetty.config $(DESTDIR)$(CONFDIR)/
-> test -f $(DESTDIR)$(CONFDIR)/sendfax.config || \
-> $(INSTALL) -o root -m 644 sendfax.config $(DESTDIR)$(CONFDIR)/
-> test -f $(DESTDIR)$(CONFDIR)/dialin.config || \
-> $(INSTALL) -o root -m 600 dialin.config $(DESTDIR)$(CONFDIR)/
-> test -f $(DESTDIR)$(CONFDIR)/faxrunq.config || \
-> $(INSTALL) -o root -m 644 faxrunq.config $(DESTDIR)$(CONFDIR)/
-616c620
-< -@if test -f $(LIBDIR)/mgetty.login ; \
----
-> -@if test -f $(DESTDIR)$(LIBDIR)/mgetty.login ; \
-626,637c630,641
-< test -d $(spool) || \
-< ( mkdir $(spool) && chmod 755 $(spool) )
-< test -d $(FAX_SPOOL) || \
-< ( mkdir $(FAX_SPOOL) && \
-< chown $(FAX_OUT_USER) $(FAX_SPOOL) && \
-< chmod 755 $(FAX_SPOOL) )
-< test -d $(FAX_SPOOL_IN) || \
-< ( mkdir $(FAX_SPOOL_IN) && chmod 755 $(FAX_SPOOL_IN) )
-< test -d $(FAX_SPOOL_OUT) || \
-< mkdir $(FAX_SPOOL_OUT)
-< chown $(FAX_OUT_USER) $(FAX_SPOOL_OUT)
-< chmod 755 $(FAX_SPOOL_OUT)
----
-> test -d $(DESTDIR)$(spool) || \
-> ( mkdir $(DESTDIR)$(spool) && chmod 755 $(DESTDIR)$(spool) )
-> test -d $(DESTDIR)$(FAX_SPOOL) || \
-> ( mkdir $(DESTDIR)$(FAX_SPOOL) && \
-> chown $(FAX_OUT_USER) $(DESTDIR)$(FAX_SPOOL) && \
-> chmod 755 $(DESTDIR)$(FAX_SPOOL) )
-> test -d $(DESTDIR)$(FAX_SPOOL_IN) || \
-> ( mkdir $(DESTDIR)$(FAX_SPOOL_IN) && chmod 755 $(DESTDIR)$(FAX_SPOOL_IN) )
-> test -d $(DESTDIR)$(FAX_SPOOL_OUT) || \
-> mkdir $(DESTDIR)$(FAX_SPOOL_OUT)
-> chown $(FAX_OUT_USER) $(DESTDIR)$(FAX_SPOOL_OUT)
-> chmod 755 $(DESTDIR)$(FAX_SPOOL_OUT)
-642,643c646,647
-< BINDIR=$(BINDIR) \
-< LIBDIR=$(LIBDIR) CONFDIR=$(CONFDIR)
----
-> BINDIR=$(DESTDIR)$(BINDIR) \
-> LIBDIR=$(DESTDIR)$(LIBDIR) CONFDIR=$(DESTDIR)$(CONFDIR)
-649,650c653,654
-< BINDIR=$(BINDIR) SBINDIR=$(SBINDIR) \
-< LIBDIR=$(LIBDIR) CONFDIR=$(CONFDIR)
----
-> BINDIR=$(DESTDIR)$(BINDIR) SBINDIR=$(DESTDIR)$(SBINDIR) \
-> LIBDIR=$(DESTDIR)$(LIBDIR) CONFDIR=$(DESTDIR)$(CONFDIR)
-657c661
-< $(INSTALL) -s -m 755 mg.echo $(BINDIR) ; \
----
-> $(INSTALL) -s -m 755 mg.echo $(DESTDIR)$(BINDIR) ; \
-665,669c669,673
-< MAN1DIR=$(MAN1DIR) \
-< MAN4DIR=$(MAN4DIR) \
-< MAN5DIR=$(MAN5DIR) \
-< MAN8DIR=$(MAN8DIR) \
-< INFODIR=$(INFODIR)
----
-> MAN1DIR=$(DESTDIR)$(MAN1DIR) \
-> MAN4DIR=$(DESTDIR)$(MAN4DIR) \
-> MAN5DIR=$(DESTDIR)$(MAN5DIR) \
-> MAN8DIR=$(DESTDIR)$(MAN8DIR) \
-> INFODIR=$(DESTDIR)$(INFODIR)
-676,677c680,681
-< BINDIR=$(BINDIR) \
-< LIBDIR=$(LIBDIR) CONFDIR=$(CONFDIR)
----
-> BINDIR=$(DESTDIR)$(BINDIR) \
-> LIBDIR=$(DESTDIR)$(LIBDIR) CONFDIR=$(DESTDIR)$(CONFDIR)
-693,694c697,698
-< BINDIR="$(BINDIR)" SBINDIR="$(SBINDIR)" LIBDIR="$(LIBDIR)" \
-< CONFDIR="$(CONFDIR)" MAN1DIR="$(MAN1DIR)" MAN8DIR="$(MAN8DIR)" INSTALL="$(INSTALL)" \
----
-> BINDIR="$(DESTDIR)$(BINDIR)" SBINDIR="$(DESTDIR)$(SBINDIR)" LIBDIR="$(DESTDIR)$(LIBDIR)" \
-> CONFDIR="$(DESTDIR)$(CONFDIR)" MAN1DIR="$(DESTDIR)$(MAN1DIR)" MAN8DIR="$(DESTDIR)$(MAN8DIR)" INSTALL="$(INSTALL)" \
diff --git a/PKGBUILD b/PKGBUILD
index 262cd0d9bd85..b1658224b82e 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,41 +1,55 @@
-# Maintainer: Deon Spengler <deon.spengler@gmail.com>
-# Contributor: Dieter Rethmeyer <Dieter@rethmeyers.de>
-pkgname=mgetty
+# Maintainer: Peter Pickford <arch@netremedies.ca>
+# Contributor: Deon Spengler <deon.spengler@gmail.com> Dieter Rethmeyer <Dieter@rethmeyers.de>, Peter Pickford <arch@netremedies.ca>
+# derived from arch mgetty
+_origpkgname=mgetty
+pkgname=mgetty-vgetty
pkgver=1.1.37
-pkgrel=5
-pkgdesc="Mgetty is a versatile program to handle all aspects of a modem under Unix."
+pkgrel=1
+pkgdesc="vgetty - voice extension to the mgetty+sendfax program."
url="http://mgetty.greenie.net/"
license=('GPL')
arch=('i686' 'x86_64')
+install=mgetty.install
depends=('glibc' 'logrotate' 'udev' 'netpbm')
makedepends=('make')
-install=mgetty.install
-source=(http://fossies.org/unix/misc/$pkgname$pkgver-Jun05.tar.gz
- Makefile.patch
- config.patch
- policy.patch
- 90-mgetty.rules
- mgetty@.service)
+source=(http://fossies.org/unix/misc/$_origpkgname$pkgver-Jun05.tar.gz
+ config.patch
+ policy.patch
+ mgetty_cid.patch
+ 90-mgetty.rules
+ vgetty@.service
+ faxrunqd@.service
+ mgetty.install
+ )
md5sums=('4df2eb47bd6d5318d3d642572ab56e51'
- 'eaa2b17d77ca099ebb7e92cf2006f6c1'
- '2c26c665b94bffae2805e8e464cd1165'
+ 'fd02c6dd7374e78458840432660729f7'
'5556e5e88c784e75acb14ab998d7eb1a'
+ 'c160d250f98140ddc3818fef34e940b6'
'4b73a5654db86a34a8dccdf5f55c699c'
- 'cbc70329924235e8f2e6302c859d59a6')
+ '3c1b50a8bebf9a2d6e4252fce79f4c34'
+ '9aa2b3ff3ff4daa5ed018d4fac8d86b4'
+ '8cb2c82dba8e8439832b021b175c83f5')
build() {
- cd $srcdir/$pkgname-$pkgver
+ cd $srcdir/$_origpkgname-$pkgver
cp policy.h-dist policy.h
- patch -Np0 -i ../../config.patch
- patch -Np0 -i ../../policy.patch
- make
+ patch -Np0 -i ../../config.patch || return 1
+ patch -Np0 -i ../../policy.patch || return 1
+ patch -Np0 -i ../../mgetty_cid.patch || return 1
+ make clean
+ make || return 1
+ make testdisk
+ make test
}
package() {
- cd $srcdir/$pkgname-$pkgver
+ cd $srcdir/$_origpkgname-$pkgver
+ # add directories needed by install
mkdir -p $pkgdir/var/spool
- make prefix=$pkgdir/usr spool=$pkgdir/var/spool CONFDIR=$pkgdir/etc/mgetty+sendfax FAX_OUT_USER=0 install
- rm -f $pkgdir/usr/bin/g3topbm
+ mkdir -p $pkgdir/usr/share/man
+ make prefix=$pkgdir/usr spool=$pkgdir/var/spool CONFDIR=$pkgdir/etc/mgetty+sendfax FAX_OUT_USER=0 install install-vgetty|| return 1
install -D -m644 $srcdir/90-mgetty.rules $pkgdir/etc/udev/rules.d/90-mgetty.rules
- install -D -m644 $srcdir/mgetty@.service $pkgdir/usr/lib/systemd/system/mgetty@.service
+ install -D -m644 $srcdir/vgetty@.service $pkgdir/usr/lib/systemd/system/vgetty@.service
+ install -D -m644 $srcdir/faxrunqd@.service $pkgdir/usr/lib/systemd/system/faxrunqd@.service
+ rm -f $pkgdir/usr/bin/g3topbm
}
diff --git a/config.patch b/config.patch
index 49d0e74e1c6d..805a86293eb1 100644
--- a/config.patch
+++ b/config.patch
@@ -1,6 +1,6 @@
---- Makefile 2007-06-15 13:15:56.000000000 +0200
-+++ ../gepatcht/Makefile 2010-01-24 23:05:15.000000000 +0100
-@@ -102,7 +102,7 @@
+--- Makefile.orig 2010-06-05 02:48:22.000000000 -0700
++++ Makefile 2016-02-18 02:56:09.592419743 -0800
+@@ -109,7 +109,7 @@
# USTAT - ustat(), no statfs etc.
#
#CFLAGS=-Wall -O2 -pipe -DSECUREWARE -DUSE_POLL
@@ -9,7 +9,7 @@
#CFLAGS=-O -DSVR4
#CFLAGS=-O -DSVR4 -DSVR42
#CFLAGS=-O -DUSE_POLL
-@@ -164,7 +164,7 @@
+@@ -171,7 +171,7 @@
#
# if your systems doesn't have one, use the shell script that I provide
# in "inst.sh" (taken from X11R5). Needed on IRIX5.2
@@ -18,7 +18,7 @@
#INSTALL=install -c -o root -g wheel # NeXT/BSD
#INSTALL=/usr/ucb/install -c -o bin -g bin # AIX, Solaris 2.x
#INSTALL=installbsd -c -o bin -g bin # OSF/1, AIX 4.1, 4.2
-@@ -172,7 +172,7 @@
+@@ -179,7 +179,7 @@
#
# prefix, where most (all?) of the stuff lives, usually /usr/local or /usr
#
@@ -27,7 +27,7 @@
#
# prefix for all the spool directories (usually /usr/spool or /var/spool)
#
-@@ -192,7 +192,7 @@
+@@ -199,7 +199,7 @@
#
# where the configuration files (*.config, aliases, fax.allow/deny) go to
#
@@ -36,7 +36,33 @@
#CONFDIR=/etc/default/
#
#
-@@ -275,7 +275,7 @@
+@@ -227,20 +227,20 @@
+ #
+ #
+ # Where section 1 manual pages should be placed
+-MAN1DIR=$(prefix)/man/man1
++MAN1DIR=$(prefix)/share/man/man1
+ #
+ # Where section 4 manual pages (mgettydefs.4) should be placed
+-MAN4DIR=$(prefix)/man/man4
++MAN4DIR=$(prefix)/share/man/man4
+ #
+ # Section 5 man pages (faxqueue.5)
+-MAN5DIR=$(prefix)/man/man5
++MAN5DIR=$(prefix)/share/man/man5
+ #
+ # Section 8 man pages (sendfax.8)
+-MAN8DIR=$(prefix)/man/man8
++MAN8DIR=$(prefix)/share/man/man8
+ #
+ # Where the GNU Info-Files are located
+ #
+-INFODIR=$(prefix)/info
++INFODIR=$(prefix)/share/info
+ #
+ #
+ # A shell that understands bourne-shell syntax
+@@ -282,7 +282,7 @@
# please use the "mg.echo" program provided in the compat/ subdirectory.
# Set ECHO="mg.echo" and INSTALL_MECHO to mg.echo
#
diff --git a/faxrunqd@.service b/faxrunqd@.service
new file mode 100644
index 000000000000..199c849417ea
--- /dev/null
+++ b/faxrunqd@.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=faxrunqd - daemon to send fax jobs queued by faxspool(1) to %I
+After=dev-%i.device network.target nss-lookup.target
+
+[Service]
+Type=idle
+PrivateTmp=true
+ExecStart=/usr/sbin/faxrunqd -u fax -l %I
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
diff --git a/mgetty.install b/mgetty.install
index 6c9cd06237df..47faaf8f5900 100644
--- a/mgetty.install
+++ b/mgetty.install
@@ -1,16 +1,21 @@
+#!/usr/bin/bash
+
+infodir=/usr/share/info
+filelist=( mgetty.info.gz )
post_install() {
+ for file in ${filelist[@]}; do
+ install-info $infodir/$file $infodir/dir < /dev/null
+ done
/usr/bin/udevadm trigger
-
if [ -z "`grep '^fax:' /etc/passwd`" ]; then
useradd -u 51 -d /var/spool/fax -g root -s /usr/bin/nologin fax
fi
-
chown -R fax:root /var/spool/fax
touch /var/log/sendfax.log
chown fax.root /var/log/sendfax.log
echo --- Please read notes: ---
echo Please update files in /etc/mgetty+sendfax/ before starting daemon
- echo Daemon is faxrunqd, add to /etc/rc.conf daemon list if you want to
+ echo enable and start faxrunqd@.service vgetty@.service as needed
echo ---------------------------
}
@@ -18,3 +23,8 @@ post_remove() {
userdel fax &> /dev/null
/sbin/udevadm trigger
}
+
+post_upgrade() {
+ post_install $1
+}
+
diff --git a/mgetty@.service b/mgetty@.service
deleted file mode 100644
index 5386c9358529..000000000000
--- a/mgetty@.service
+++ /dev/null
@@ -1,13 +0,0 @@
-[Unit]
-Description=Smart Modem Getty(mgetty)
-Requires=systemd-udev-settle.service
-After=systemd-udev-settle.service
-
-[Service]
-Type=simple
-ExecStart=/usr/sbin/mgetty /dev/%i
-Restart=always
-PIDFile=/var/run/mgetty.%i
-
-[Install]
-WantedBy=multi-user.target
diff --git a/mgetty_cid.patch b/mgetty_cid.patch
new file mode 100644
index 000000000000..5330f2d4a3a5
--- /dev/null
+++ b/mgetty_cid.patch
@@ -0,0 +1,224 @@
+diff -rupN ./cnd.c ../../old/mgetty-1.1.37/cnd.c
+--- ./cnd.c 2005-04-17 04:55:43.000000000 -0700
++++ ../../old/mgetty-1.1.37/cnd.c 2013-01-14 21:32:01.000000000 -0800
+@@ -170,7 +170,7 @@ cndfind _P1((str), char *str)
+ p++;
+ }
+ }
+- lprintf(L_JUNK, "CND: found: %s", *(cp->variable));
++ lprintf(L_NOISE, "CND: found: %s", *(cp->variable));
+ return;
+ }
+ }
+@@ -221,7 +221,7 @@ void process_rockwell_mesg _P0 (void)
+ }
+ *p = 0;
+
+- lprintf(L_JUNK, "CND: caller ID: %s", CallerId);
++ lprintf(L_NOISE, "CND: caller ID: %s", CallerId);
+ }
+
+ /* lookup Caller ID in CNDFILE, decide upon answering or not */
+@@ -287,6 +287,7 @@ int cnd_call _P3((name, tty, dist_ring),
+ tty, CallerId, CallName, dist_ring, CalledNr, CONSOLE );
+ lprintf( L_NOISE, "CND: program \"%s\"", program );
+
++ setup_environment();
+ rc = system(program);
+
+ if ( rc < 0 )
+diff -rupN ./conf_mg.c ../../old/mgetty-1.1.37/conf_mg.c
+--- ./conf_mg.c 2009-03-19 08:13:53.000000000 -0700
++++ ../../old/mgetty-1.1.37/conf_mg.c 2013-01-14 21:32:01.000000000 -0800
+@@ -85,6 +85,7 @@ struct conf_data_mgetty c = {
+ { "rings", {1}, CT_INT, C_PRESET },
+ { "msn-list", {(p_int) NULL}, CT_CHAT, C_EMPTY },
+ { "get-cnd-chat", {0}, CT_CHAT, C_EMPTY },
++ { "cid-program", {(p_int) NULL}, CT_STRING, C_EMPTY },
+ { "cnd-program", {(p_int) NULL}, CT_STRING, C_EMPTY },
+ { "answer-chat", {0}, CT_CHAT, C_EMPTY },
+ { "answer-chat-timeout", {80}, CT_INT, C_PRESET },
+diff -rupN ./conf_mg.h ../../old/mgetty-1.1.37/conf_mg.h
+--- ./conf_mg.h 2005-11-24 08:57:58.000000000 -0800
++++ ../../old/mgetty-1.1.37/conf_mg.h 2013-01-14 21:32:01.000000000 -0800
+@@ -33,6 +33,7 @@ extern struct conf_data_mgetty {
+ rings_wanted, /* number of RINGs */
+ msn_list, /* ISDN MSNs (dist.ring) */
+ getcnd_chat, /* get caller ID (for ELINK)*/
++ cid_program, /* notify about caller ID */
+ cnd_program, /* accept caller? */
+ answer_chat, /* ATA...CONNECT...""...\n */
+ answer_chat_timeout, /* longer as S7! */
+diff -rupN ./doc/mgetty.texi-in ../../old/mgetty-1.1.37/doc/mgetty.texi-in
+--- ./doc/mgetty.texi-in 2008-01-31 08:30:12.000000000 -0800
++++ ../../old/mgetty-1.1.37/doc/mgetty.texi-in 2013-01-14 21:32:01.000000000 -0800
+@@ -638,12 +638,20 @@ Some telephone companies provide a servi
+ your phone is ringing. Not all providers support it, and you'll have to
+ ask for it.
+
+-If your modem is able to retrieve callerid information, and @code{mgetty}
++Right now, Caller ID in @code{mgetty} works for most modem variants out there,
++ZyXEL, Rockwell, ELSA and isdn4linux among them.
++
++If your modem is able to retrieve callerid information, @code{mgetty} can
++report that information by passing it as arguments to the @code{cid-program}
++statement in @file{mgetty.config}. You may point @code{cid-program} to a
++script that writes to a logfile, displays a popup on your terminal, etc.
++@code{cid-program} takes the same arguments as @code{cnd-program} (see below)
++but its exit code is ignored.
++
++In addition to the ability of reporting callerid information, if @code{mgetty}
+ is compiled with @code{CNDFILE} defined in @file{policy.h}, @code{mgetty}
+-can check the caller's number before answering the phone. (Right now, it
+-works for most variants out there, ZyXEL, Rockwell, ELSA and isdn4linux
+-among them). If @code{CNDFILE} is undefined, or if the
+-file specified does not exist, all calls will be allowed.
++can check the caller's number before answering the phone. If @code{CNDFILE} is
++undefined, or if the file specified does not exist, all calls will be allowed.
+
+ One important thing: for most analog modems, you @strong{must} set the
+ number of RINGs to wait for to two (2) or higher (set @samp{rings 2} in
+@@ -1042,6 +1050,13 @@ if the static Caller ID selection in CND
+ or if you want to use the Caller ID data for other purposes (displaying,
+ for example). @xref{Caller-ID}.
+
++@item @code{cid-program} @var{pathname}
++
++Specify a program to be run as soon as Caller ID information comes in
++(typically between 1st and 2nd ring). If Caller ID info is not available by
++the 3rd ring, still run the program (to report the time that the phone rang).
++This allows mgetty to behave like a caller-id box. @xref{Caller-ID}.
++
+ @item @code{answer-chat} @var{chat sequence}
+
+ This is the command sequence that is used to answer a phone call. Usually
+@@ -1489,11 +1504,11 @@ A sample command line might look like th
+ @BINDIR@/new_fax 0 "+49 89 3243328" 1 @FAX_SPOOL@/ff-01.a123
+ @end example
+
+-In addition, some environment variables are provide: @code{CALLER_ID},
++In addition, some environment variables are provided: @code{CALLER_ID},
+ @code{CALLER_NAME}, @code{CALLED_ID} (Caller ID and destination ISDN MSN,
+-if available and supported by your modem), and @code{DEVICE} (the full
+-name of the tty device, if you want to process faxes differently
+-depending on the line they came in).
++if available and supported by your modem), @code{CALL_DATE}, @code{CALL_TIME},
++and @code{DEVICE} (the full name of the tty device, if you want to process
++faxes differently depending on the line they came in).
+
+ Such a ``notify program'' could print out the fax, convert it into a MIME
+ metamail and send it away, display it in an X window (this a little bit
+diff -rupN ./login.c ../../old/mgetty-1.1.37/login.c
+--- ./login.c 2003-12-05 14:28:58.000000000 -0800
++++ ../../old/mgetty-1.1.37/login.c 2013-01-14 21:32:01.000000000 -0800
+@@ -373,6 +373,10 @@ void setup_environment _P0(void)
+ {
+ if ( *CallerId )
+ set_env_var( "CALLER_ID", CallerId );
++ if ( *CallDate )
++ set_env_var( "CALL_DATE", CallDate );
++ if ( *CallTime )
++ set_env_var( "CALL_TIME", CallTime );
+ if ( *CallName )
+ set_env_var( "CALLER_NAME", CallName );
+ if ( *CalledNr )
+diff -rupN ./mgetty.c ../../old/mgetty-1.1.37/mgetty.c
+--- ./mgetty.c 2009-03-19 08:14:28.000000000 -0700
++++ ../../old/mgetty-1.1.37/mgetty.c 2013-01-14 21:32:01.000000000 -0800
+@@ -279,6 +279,7 @@ int main _P2((argc, argv), int argc, cha
+ int rings_wanted;
+ int rings = 0;
+ int dist_ring = 0; /* type of RING detected */
++ boolean cid_program_ran = FALSE;/* Only run cid_program once per call */
+
+ #if defined(_3B1_) || defined(MEIBE) || defined(sysV68)
+ extern struct passwd *getpwuid(), *getpwnam();
+@@ -548,6 +549,7 @@ int main _P2((argc, argv), int argc, cha
+ */
+ CallTime = CallName = CalledNr = ""; /* dirty */
+ CallerId = "none";
++ cid_program_ran = FALSE;
+ clean_line( STDIN, 3); /* let line settle */
+ rmlocks();
+ mgetty_state = St_waiting;
+@@ -738,14 +740,26 @@ int main _P2((argc, argv), int argc, cha
+
+ while ( rings < rings_wanted )
+ {
+- if ( wait_for_ring( STDIN, c_chat(msn_list),
+- ( c_bool(ringback) && rings == 0 )
+- ? c_int(ringback_time) : ring_chat_timeout,
+- ring_chat_actions, &what_action,
+- &dist_ring ) == FAIL)
++ int w;
++
++ w = wait_for_ring( STDIN, c_chat(msn_list),
++ ( c_bool(ringback) && rings == 0 )
++ ? c_int(ringback_time) : ring_chat_timeout,
++ ring_chat_actions, &what_action,
++ &dist_ring );
++
++ /* Inform about Caller ID. If we haven't gotten the info by 3rd
++ * ring, it's hopeless; just report that the phone rang. */
++ if ( c_isset(cid_program) && !cid_program_ran
++ && (rings >= 2 || *CallName || strcmp(CallerId, "none")) )
+ {
+- break; /* ringing stopped, or "action" */
++ cnd_call( c_string(cid_program), Device, dist_ring );
++ cid_program_ran = TRUE;
+ }
++
++ if ( w == FAIL )
++ break; /* ringing stopped, or "action" */
++
+ rings++;
+ }
+
+diff -rupN ./mgetty.h ../../old/mgetty-1.1.37/mgetty.h
+--- ./mgetty.h 2006-01-01 09:13:18.000000000 -0800
++++ ../../old/mgetty-1.1.37/mgetty.h 2013-01-14 21:32:01.000000000 -0800
+@@ -296,6 +296,7 @@ void setup_environment _PROTO(( void ));
+
+ extern char *Connect;
+ extern char *CallerId;
++extern char *CallDate;
+ extern char *CallTime;
+ extern char *CallName;
+ extern char *CalledNr;
+diff -rupN ./ring.c ../../old/mgetty-1.1.37/ring.c
+--- ./ring.c 2009-03-19 08:13:43.000000000 -0700
++++ ../../old/mgetty-1.1.37/ring.c 2013-01-14 23:03:39.000000000 -0800
+@@ -329,8 +329,8 @@ boolean got_dle; /* for <DLE><char> eve
+ * we count it as "RING" to be able to pick up immediately
+ * instead of waiting for the next "real" RING
+ * (but don't do this for V253 DRON/DROF modems!)
+- */
+ if ( strncmp( buf, "NMBR", 4 ) == 0 && drox_count == 0 ) { break; }
++ */
+
+ /* V.253 ring cadences */
+ if ( strncmp( buf, "DRON", 4 ) == 0 ||
+diff -rupN ./t/t_ring.c ../../old/mgetty-1.1.37/t/t_ring.c
+--- ./t/t_ring.c 2005-03-23 01:56:21.000000000 -0800
++++ ../../old/mgetty-1.1.37/t/t_ring.c 2014-04-21 00:51:40.140413257 -0700
+@@ -40,7 +40,7 @@ struct t_ring_tests { char * input;
+ {"RING 2\n", 1, 2, "" },
+ {"RING A\nRING B\nRING C\nRING\n", 4, 3, "" },
+ {"RING\n FM:040404\n", 2, 0, "040404" }, /* ZyXEL + whitespc */
+- {"RING\nNMBR = 0555\nRING\n", 3, -1, "0555" }, /* Rockwell */
++ {"RING\nNMBR = 0555\nRING\n", 2, -1, "0555" }, /* Rockwell */
+ {"RING/0666\n", 1, 0, "" }, /* i4l - RING/to */
+ {"RING;707070\n", 1, 0, "707070" }, /* ELSA - RING;from */
+ {"RING;717171;999999\n", 1, 1, "717171" }, /* ELSA - RING;from;to */
+@@ -93,6 +93,11 @@ int mdm_read_byte( int fd, char * c )
+ return -1;
+ }
+
++/* fake setup_environment function */
++void setup_environment(void)
++{
++}
++
+ boolean virtual_ring = FALSE;
+
+ int main( int argc, char ** argv )
diff --git a/vgetty@.service b/vgetty@.service
new file mode 100644
index 000000000000..77cf5a3188a9
--- /dev/null
+++ b/vgetty@.service
@@ -0,0 +1,35 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Serial Vgetty on %I
+Documentation=man:vgetty(8) man:systemd-getty-generator(8)
+Documentation=http://0pointer.de/blog/projects/serial-console.html
+BindsTo=dev-%i.device
+After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
+
+# If additional gettys are spawned during boot then we should make
+# sure that this is synchronized before getty.target, even though
+# getty.target didn't actually pull it in.
+Before=getty.target
+IgnoreOnIsolate=yes
+
+[Service]
+ExecStart=-/sbin/vgetty %I
+Type=idle
+Restart=always
+RestartSec=0
+UtmpIdentifier=%I
+TTYPath=/dev/%I
+TTYReset=yes
+TTYVHangup=yes
+KillMode=process
+IgnoreSIGPIPE=no
+SendSIGHUP=yes
+
+[Install]
+WantedBy=getty.target