Commit Graph

35 Commits (0a66b74b51f7d58916504e0e8bb01b6e981b489b)

Author SHA1 Message Date
xtraeme 6964169368 Portability fixes:
- Use uid_t not __uid_t.
- Define _GNU_SOURCE for cpu_set_t and others.
- Include string.h for strncmp().
- Detect musl's ldd error message.
2015-06-02 11:17:13 +02:00
Harald Hoyer 37383f7123 add "--loginstall <DIR>" and loginstall="<DIR>" options
loginstall specifies a directory, in which dracut-install records all
files, which were installed from the host system to the initramfs.

Use case is e.g. to create a list of packages to watch for updates, to
maybe trigger a recreation of the initramfs.
2014-09-11 16:42:36 +02:00
Harald Hoyer 967cc19ab1 remove all vim and emacs code format comments 2014-08-29 13:38:47 +02:00
Harald Hoyer 6770af96d4 add kate and emacs per directory config files 2014-08-29 13:38:47 +02:00
Harald Hoyer e7ba1392e1 install: add more error handling
also limit local variable scopes
and remove bogus checks to negativity of unsigned vars
2014-08-29 13:37:40 +02:00
Harald Hoyer 26cd262a6a install: add -H flag for install
inst* functions and dracut-install now accept the "-H" flag, which
logs all installed files to /lib/dracut/hostonly-files. This is used
to remove those files, if rd.hostonly is given on the kernel command line.
2014-06-25 11:42:53 +02:00
Harald Hoyer 93f44f28a2 dracut-install.c: "make indent" 2014-01-24 15:31:26 +01:00
Harald Hoyer 45404a2ad8 dracut-install,dracut: fix ldd output parsing
dracut-install could not handle output like:
	/lib/$LIB/liblsp.so => /lib/lib64/liblsp.so (0x00007faf00727000)

also unset LD_PRELOAD, so we get a clean environment
2014-01-17 14:52:01 +01:00
Harald Hoyer 2f461da2a0 install: install all PATH binaries found
This should fix the issues with symlinks in /bin pointing to /usr/bin on
some distributions.
2013-12-19 17:00:18 +01:00
Harald Hoyer 791532b0ce dracut-install: install libs also from one dir above
some HW has different flavors of basic libs

$ ldconfig -p|fgrep libc.so
libc.so.6 (libc6,64bit, hwcap: 0x0000001000000000, OS ABI: Linux 2.6.32) => /lib64/power6/libc.so.6
libc.so.6 (libc6,64bit, hwcap: 0x0000000000000200, OS ABI: Linux 2.6.32) => /lib64/power6x/libc.so.6
libc.so.6 (libc6,64bit, OS ABI: Linux 2.6.32) => /lib64/libc.so.6

because setting LD_HWCAP_MASK=0 does not work, we have to workaround
this.

$ LD_TRACE_LOADED_OBJECTS=1  LD_HWCAP_MASK=0 /lib64/ld64.so.1 /bin/sh | fgrep libc.so
libc.so.6 => /lib64/power6/libc.so.6 (0x000000804e260000)

Now we try to install the same library from one directory above the one
we installed also.
2013-06-06 11:06:55 +02:00
Kamil Rytarowski e0904b27ff Fix memory leak 2013-05-28 14:36:37 +02:00
Kamil Rytarowski d9eff33ce2 Always check the return number of asprintf
asprintf prints to an allocated string. When  successful,  the
functions return the number of bytes printed. If memory allocation
wasn't possible, or some other error occurs, the function will return
-1.

Don't check strp as a result of asprintf, it's content may be undefined.

man 3 asprintf
2013-05-28 14:35:54 +02:00
Kamil Rytarowski 8974102f6b Use consistiently termination code macros
Operate in install_all and install_one consequently on EXIT_SUCCESS
and EXIT_FAILURE termination code macros as they are meant to be
returned from these functions.
2013-05-28 14:34:44 +02:00
Kamil Rytarowski 599182b108 Introduce stricter type correctness 2013-05-28 14:34:29 +02:00
Kamil Rytarowski 6a736cc129 Fix parsing command line arguments
Adjust correctly the *optstring argument of getopt_long. Add support
for a missing option -v|--verbose and drop unknown options -D, -I and -L.
2013-05-28 14:33:02 +02:00
Harald Hoyer 3ed08d1e4d dracut-install: make use of _cleanup_* macros 2013-04-29 11:35:23 +02:00
Harald Hoyer 6f4c2dada4 fixed fips mode
- preserve timestamps
- copy /lib*/hmaccalc files
- run sha512hmac after kernel module loading
- add more fips kernel modules
2013-04-25 19:44:01 +02:00
Harald Hoyer b4dc22cab7 dracut-install: error out, if ldd reports no execution permission
This turns off lazy resolving on noexec mounted tmp directories.

https://bugzilla.redhat.com/show_bug.cgi?id=953426
2013-04-18 12:54:55 +02:00
Harald Hoyer 87dc81a1f6 dracut-install: handle more ldd errors 2013-03-14 18:30:35 +01:00
Harald Hoyer 43a050e542 install/dracut-install.c: do not ldd directories 2012-10-03 16:39:27 -04:00
Harald Hoyer 868eba13f2 install/dracut-install.c: support find_binary for <src> <dst>
also factor out find_binary()
2012-09-26 11:34:38 +02:00
Milan Broz cce471c9ce dracut-install: FIPS workaround for fipscheck dir
In recent Fedora distro are all hmac files located in /lib
(to avoid multiarch conflict).

When installing hmac file, also install files from these locations.

Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-08-24 09:26:59 +02:00
Harald Hoyer 353e7a7ec3 install/dracut-install.c: correct usage() for hmac 2012-08-23 15:02:37 +02:00
Colin Guthrie 68c49db952 install/dracut-install.c: No need to compare the NULL byte each time. 2012-08-21 18:46:20 +02:00
Colin Guthrie f9c7788ba5 install/dracut-install.c: Deal gracefully with paths containing double /'s
While such paths should not be included internally, we cannot
guarantee that external scripts with shebangs will not do this.

Some older versions of plymouth also resulted in double /'s
in some paths, so best deal with this gracefully.
2012-08-21 18:46:20 +02:00
Colin Guthrie 68318328f1 install/dracut-install.c: Ensure deps are resolved when handling scripts
If we are doing lazy dep solving and happen to process a script with a
shebang on e.g. /bin/bash before we encounter the actual binary itself
we effectively ignore the fact that we've been asked to resolve the deps
and put the item in the 'seen' hashmap. Thus when we later really do try
and resolve deps, we short circuit and don't do anything.

Example test case:

$ cd
$ mkdir -p foo/bin
$ cp /bin/bash foo/bin
$ echo '#!/bin/bash' >foo/bin/script
$ dracut-install -D $HOME/foo -R $HOME/foo/bin/script $HOME/foo/bin/bash
2012-08-21 18:46:20 +02:00
Harald Hoyer 78021eace1 install/dracut-install.c: convert destrootdir to realpath
otherwise we get strange errors if it ends with a slash and does not
exist.
2012-07-26 19:35:00 +02:00
Amadeusz Żołnowski 386579a45a Remove object file from repo: install/hashmap.o 2012-07-26 08:35:02 +02:00
Harald Hoyer f6c2faebfa install/dracut-install.c: check for empty or "/" destdir 2012-07-11 15:47:10 +02:00
Harald Hoyer a92311074b install/dracut-install.c: redirect stderr to stdout and skip loader
skip if ldd was run on the loader
2012-07-10 12:24:16 +02:00
Harald Hoyer e74944eee5 dracut-install.c: for lazy install shebangs, do not check for existence 2012-07-02 18:54:07 +02:00
Harald Hoyer 34e43ceb0d dracut-install.c: give info that SOURCE argument is missing 2012-07-02 18:52:49 +02:00
Harald Hoyer f4031e8a9a move dracut-install to dracutbasedir
We do not want to install dracut-install to /usr/bin until all
interfaces are set to stone and the manpage is written. Until then the
tool is dracut internal.
2012-07-02 18:52:49 +02:00
Harald Hoyer 85854b245e dracut-install.c: try clone ioctl for more speed 2012-06-30 12:50:43 +02:00
Harald Hoyer 026b81e980 install/*: add dracut-install tool 2012-06-29 12:54:38 +02:00