Commit Graph

28 Commits

Author SHA1 Message Date
Pino Toscano 5547316c85 build-sys: do not build plymouth-ctrl.c w/ disabled plymouth
Do not build plymouth-ctrl.c in agetty and sulogin in case the plymouth
support is disabled.

Signed-off-by: Pino Toscano <toscano.pino@tiscali.it>
2020-11-17 11:27:48 +01:00
Karel Zak eee886ba1d build-sys: exclude GPL from libcommon
The library is not distributed and almost all code in this ar(1)
archive is Public Domain or LGPL ... but let's avoid any doubts and do
not mix non-GPL and GPL code there.

Addresses: https://github.com/karelzak/util-linux/issues/1157
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-10-06 13:26:36 +02:00
Karel Zak 4c791d127f build-sys: fix typo
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-09 10:02:10 +02:00
Karel Zak ec10634e7e script: use lib/pty-session
This patch consolidate pseudo-terminal stuff in util-linux. From now
there is only one implementation used in su(1) --pty, scriptlive(1)
and script(1).

The new stuff is based on the original script(1) -- it means poll()
and signalfd() based.

Note that script(1) code does not provide fallback for systems/libc
where is no openpty().

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:54 +02:00
Karel Zak 63869b842f build-sys: fix build with pty
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:54 +02:00
Karel Zak 37a11e1a3d scriptlive: run shell in PTY
After this change shell executed by scriptlive(1) is going to behave
like shell in script(1). It means that the shell stdin is a
pseudo-terminal rather than pipe. This allows live replay of
interactive applications, ssh sessions, etc.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:54 +02:00
Karel Zak 33869e5ac0 scriptlive: add new command to re-execute script(1) typescript
The old good scriptreplay(1) just display your recorded session, the
scriptlive(1) uses stdin typescript (from new script(1)) to execute
your commands again.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:54 +02:00
Karel Zak 12352c967c scriptreplay: move all utils to script-playutils.{c,h}
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 2c864ba8fc mesg: avoid 'ttyname failed: Success' message
The ttyname(3) can fail to access /dev/ path, and that will cause function
to fail without setting errno value with result of rather confusing error
message.  Lets start setting stdin permission via /proc when this happens as
a go-around, with hope kernel following symlink does not fail.  Ok, noted,
that hopes of symlink follow working are pretty slim.

Based on patch from Sami Kerola <kerolasa@iki.fi>.

Reference: https://github.com/lxc/lxd/issues/1724
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-05-27 13:07:12 +02:00
Sami Kerola 8e58889065
reset: remove script from the package
This script requires ncurses to work, and the ncurses provides reset so
there should not be need to keep this script hanging around.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-07-15 22:02:53 +01:00
Karel Zak feda4342df build-sys: use -lm for scriptreplay if necessary
Reported-by: Bert van Hall <bert.vanhall@avionic-design.de>
Addresses: https://github.com/karelzak/util-linux/pull/397
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-01-18 13:17:21 +01:00
Sami Kerola a58b90255c
write: stop removing and adding /dev/ in front of tty string
Add both path and tty name representations of tty's to control structure,
that point to same string beginning from different depths.  This way there
is no need to removing and adding /dev/ in front of tty string all the time.

Secondly this change makes it possible to use of get_terminal_name() from
ttyutils.c.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-07-03 23:35:10 +01:00
Sami Kerola f0b3b904c7 scriptreplay: avoid re-implementing strtod_or_err()
And use isnan() to detect NaN.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-05-05 11:46:54 +02:00
Sami Kerola 14867b0f72 reset: deprecate the script, and remove reset.033c
Most distributions probably ship reset from ncurses, which means
util-linux reset(1) is unlikely to be in use anywhere.  Assuming the
previous being true it is almost unimaginable anyone one would be using
the alternative script, so remove it and mark the script deprecated.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-06-29 12:06:22 +02:00
Karel Zak a3b69ccb1c build-sys: use REALTIME_LIBS for script
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-29 10:55:37 +02:00
Sami Kerola 04639805e1 script: use gettime_monotonic() to get timing file timestamps
This moves the previous time to script control structure, and does
timeval calculation with timersub() that is more appropriate than
making a timeval to a double.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-06-08 21:53:36 +01:00
Sami Kerola 8353549e02 script: replace strftime() workaround with CFLAGS = -Wno-format-y2k
Nowadays, gcc(1) provides the -Wno-format-y2k option to prevent the
warning, so that the above workaround is no longer required.

Reference: http://man7.org/linux/man-pages/man3/strftime.3.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-06-08 21:53:36 +01:00
Sami Kerola 6a40c65f81 tests: check script options work as expected
Options --flush and --timing remain unchecked, as I do not have an idea
how to check them reliably.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-06-06 14:36:38 +01:00
Karel Zak 8026fa9bc7 build-sys: use -lutil for BSD only
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-09-17 10:56:46 +02:00
Christoph Egger c32270d41f agetty: fixing FTBFS on !linux (Debian util-linux 2.20.1-1.2)
Handle vc flags missing on FreeBSD
Fix tty creation on kFreeBSD taking patch from 2.19

Addresses-Debian-Bug: #650185
2014-09-17 10:14:50 +02:00
Karel Zak 3f91b9902b build-sys: add BUILD_{SCRIPT,SCRIPTREPLAY}
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-21 13:58:03 +02:00
Sami Kerola 35b578a02a setterm: use string utils to numeric parsing
Check the input numbers are numbers, which makes also the code shorter,
and user experience better as half invalid imputs will error.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-19 22:45:36 +01:00
Karel Zak ccf92e6db7 build-sys: use tinfo *or* ncurses for more(1), ul(1) and setterm(1)
* it seems that we don't have to link the utils with ncurses, tinfo is enough.
   This change saves one unnecessary dependence.

 * libtinfo is also distributed with pkg-config files, so we can use
   PKG_CHECK_MODULES() as a primary source for LIBS and CFLAGS.

 * add TINFO_CFLAGS (although it's probably always empty)

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-10-04 13:28:37 +02:00
Mike Frysinger 2b8f22bd90 clean up term lib handling
The ncurses package has been providing pkg-config files for a while now.
So let's start using them to get the proper linker & compiler flags.  It
can make a difference when ncurses is configured in a way that requires
extra link time flags but util-linux doesn't provide them, or when the
headers live in a weird place and util-linux can't find them.

Since the NCURSES_LIBS is always defined for the Makefile, there's no need
to gate on the HAVE_NCURSES conditional.  When it's disabled, the var will
simply be empty.

With a minor tweak to how tinfo is handled, we can do the same thing -- we
just always use TINFO_LIBS in the Makefile's.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-09-30 13:41:07 +02:00
Karel Zak d78d040933 build-sys: add --disable-setterm
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-26 13:47:54 +02:00
Karel Zak dcdb349be7 build-sys: always use default $(LDADD)
The global variable $(LDADD) is always used if program_LDADD is
not specified. Let's use $LDADD everywhere to avoid exceptions for
people who need to specify global $LDADD.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-09 16:23:51 +02:00
Karel Zak d77ab74af7 build-sys: convert lib/ to libcommon.la
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-26 20:50:53 +02:00
Karel Zak 22d2322eb1 build-sys: convert term-utils/ to module
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-26 17:53:09 +02:00