Commit Graph

33 Commits

Author SHA1 Message Date
Karel Zak ef5fb28001 logger: add -DTEST_LOGGER
"make test_logger" now compiles logger(1) test program
to overwrite system datetime stuff, hostname and PID, for example:

   export TZ=GMT
   export LOGGER_TEST_TIMEOFDAY=1234567890.123456
   export LOGGER_TEST_HOSTNAME=foo
   export LOGGER_TEST_GETPID=123

   ./test_logger --rfc5424 --no-act --stderr -i --tag MyTag mesg
   <13>1 2009-02-13T23:31:30.123456+00:00 foo MyTag 123 - [timeQuality tzKnown="1" isSynced="0"] mesg

if the LOGGER_TEST_* variables are not specified then default to
standard logger(1) behavior.

Note that it would be possible to use for example "unshare --utc" to
make hostname stable and portable, but LOGGER_TEST_* variables allow
to keep the tests less complex.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-03-16 14:01:53 +01:00
Karel Zak 4310faf950 lib/colors: use libtinfo to check terminal capability
The current implementation assumes that all terminals supports colors
and users are forcet to use terminal-colors.d/ to disable colors for
some terminals.

This patch checks for maximal supported colors for the current
terminal and colors are automatically disabled for terminals like
vt100.

The patch moves lib/colors.c from libcommon.la to libtcolors.la to
avoid collisions with another utils.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-02-27 13:57:34 +01:00
Ruediger Meier cd744d00e6 logger: link libsystemd-daemon.so
Noticed on openSUSE 13.1:
util-linux-2.26/misc-utils/logger.c:735: undefined reference to `sd_booted'

Introduced in d77dc29e.

CC: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2015-02-24 16:26:00 +01:00
Karel Zak 3adaaa154e build-sys: add BUILD_GETOPT
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-21 13:26:56 +02:00
Karel Zak 15a2c74163 build-sys: add BUILD_{BLKID,FINDFS,WIPEFS,FINDMNT}
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-21 13:24:21 +02:00
Karel Zak 1b15cbd149 build-sys: add BUILD_{UUIDGEN,CAL,LOGGER,LOOP,MCOOKIE,NAMEI,WHEREIS}
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-21 13:14:48 +02:00
Karel Zak ebff016a19 build-sys: consolidate systemd support
* systemd (since v209) uses only one library (when compiled
   without --enable-compat-libs)

 * all systemd build-sys stuff is merged into HAVE_SYSTEMD
  (automake) and HAVE_LIBSYSTEMD (C macro) now

 * all is controlled by --with-systemd, default is to automatically
   check for systemd libs

 * no more --enable-socket-activation and --enable-journald

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-09 12:23:30 +02:00
Ondrej Oprala ba1bf7164f lslocks: use libsmartcols
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2014-04-03 12:29:19 +02:00
Ondrej Oprala 9bd4e5c0bd lsblk: use libsmartcols
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2014-04-03 12:29:18 +02:00
Ondrej Oprala 218a3a9463 findmnt: use libsmartcols
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2014-04-03 12:29:18 +02:00
Sami Kerola 0720d60cc1 mcookie: use lib/randutils
The mcookie should reuse existing code, and there is definitely no need
to prefer /dev/random for this utility.  See reference for explanation
about later statement.

References: http://www.2uo.de/myths-about-urandom/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-03-26 10:36:18 +01:00
Sami Kerola 4b670c01df logger: allow user to send structured journald messages
This feature is hopefully mostly used to give MESSAGE_ID labels for
messages coming from scripts, making search of messages easy.  The
logger(1) manual page update should give enough information how to use
--journald option.

[kzak@redhat.com: - add missing #ifdefs
                  - use xalloc.h]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-04 13:44:21 +01:00
Sami Kerola ea45d34c7c uuidd: use pkg-config to find systemd-deamon support
[kzak@redhat.com: - remove USE_SOCKET_ACTIVATION and use
                    HAVE_* as we use for another libs]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-07 12:17:37 +01:00
Karel Zak 88a3be2602 build-sys: move getopt examples to docdir
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-10-14 10:13:47 +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 03d00d495f build-sys: add CFLAGS and LDFLAGS for daemons and shared libs
This is necessary for paranoid security guys who believe that things
like "-Wl,-z,relro" or "-Wl,-z,bind_now" is a way how to make the
world a safer place...

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-27 11:49:01 +02:00
Sami Kerola 7b353df28d cal: support --color[={auto,always,never}]
Similar with dmesg commit 9bc2b51a06.

CC: Pádraig Brady <P@draigBrady.com>
Reviewed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-05-26 09:59:19 +01:00
Karel Zak bcb693de80 uuidd: clean up error messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-05-15 00:18:27 +02:00
Karel Zak f84559ee1c whereis: canonicalize directories paths
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-20 11:52:35 +01:00
Karel Zak 58a3cee647 chkdupexe: remove, deprecated for years
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-14 13:34:11 +01:00
Karel Zak f1e7f7d54e kill: use new API from lib/procutils.c
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-12 17:40:31 +01:00
Karel Zak e346233ea2 findmnt: allow to read (PART)UUID/LABEL from udev DB
Currently findmnt uses libmount to get filesystem properties (and
libmount uses libblkid). This works as expected, but root permissions
are required to read the tags from the devices.

It seems better to read the information from udev db and use libblkid
as fallback solution only.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-18 15:00:57 +01:00
Karel Zak 07c916cfdd lslocks: use libmount to parse mountinfo
old version:
	$ strace -e open lslocks 2>&1 | grep mountinfo | wc -l
	118

new version:
	strace -e open ./lslocks 2>&1 | grep mountinfo | wc -l
	1

Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-14 15:59:28 +01:00
Karel Zak 6f05970296 build-sys: use libcommon.a for lslocks
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-22 14:25:10 +01:00
Sami Kerola 4cf02b6510 ddate: remove from util-linux
See RedHat bug for reasons why the ddate is cleaned up.  The reference is
where to get the command in future.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=823156
References: https://github.com/bo0ts/ddate
Acked-by: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-15 16:41:49 +02:00
Karel Zak d4baf92e50 build-sys: expand paths at make time
autoconf docs about *dir variables (e.g bindir):

 ... A corollary is that you should not use these variables except in
 makefiles...

 ...you should not rely on AC_CONFIG_FILES to replace bindir and friends
 in your shell scripts and other files; instead, let make manage their
 replacement.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-08-15 02:06:53 +02:00
Sami Kerola 2cd5bc5a40 ddate: russian manual missing from package
This manpage causes more trouble than its worth.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-26 13:51:36 +02:00
Sami Kerola 11935cd3fc uuidd: use configured run state directory in manual etc
[kzak@redhat.com: - minor clean up in configure.in]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-10 13:04:02 +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 44e0b7d9ee build-sys: add sd-daemon.h to Makemodule.am
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-26 23:03:22 +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 f9a20f0b58 build-sys: move getopt to misc-utils/
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-26 20:48:23 +02:00
Karel Zak 37b88bfcd7 build-sys: convert misc-utils/ to module
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-26 20:48:23 +02:00