inst() {
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
#dinfo "$DRACUT_INSTALL -l $@"
- $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
+ $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
+ (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
}
inst_simple() {
inst_symlink() {
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
[[ -L $1 ]] || return 1
- $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
+ $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
+ (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
}
inst_multiple() {
local ret
#dinfo "initdir=$initdir $DRACUT_INSTALL -l $@"
- $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
+ $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
ret=$?
- (($ret != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
+ (($ret != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
return $ret
}
inst_library() {
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
[[ -e $1 ]] || return 1 # no source
- $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
+ $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
+ (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
}
inst_binary() {
- $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
+ $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
+ (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
}
inst_script() {
- $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@"
- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-H} "$@" || :
+ $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
+ (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
+}
+
+mark_hostonly() {
+ for i in "$@"; do
+ echo "$i" >> "$initdir/lib/dracut/hostonly-files"
+ done
}
# find symlinks linked to given library file
static bool arg_all = false;
static bool arg_resolvelazy = false;
static bool arg_resolvedeps = false;
+static bool arg_hostonly = false;
static char *destrootdir = NULL;
static Hashmap *items = NULL;
return 0;
}
+void mark_hostonly(const char *path)
+{
+ _cleanup_free_ char *fulldstpath = NULL;
+ _cleanup_fclose_ FILE *f = NULL;
+ int ret;
+
+ ret = asprintf(&fulldstpath, "%s/lib/dracut/hostonly-files", destrootdir);
+ if (ret < 0) {
+ log_error("Out of memory!");
+ exit(EXIT_FAILURE);
+ }
+
+ f = fopen(fulldstpath, "a");
+
+ if (f == NULL) {
+ log_error("Could not open '%s' for writing.", fulldstpath);
+ return;
+ }
+
+ fprintf(f, "%s\n", path);
+
+}
+
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst)
{
struct stat sb, db;
log_debug("dracut_install ret = %d", ret);
log_info("cp '%s' '%s'", src, fulldstpath);
+
+ if (arg_hostonly)
+ mark_hostonly(dst);
+
ret += cp(src, fulldstpath);
log_debug("dracut_install ret = %d", ret);
{"ldd", no_argument, NULL, 'l'},
{"resolvelazy", no_argument, NULL, 'R'},
{"optional", no_argument, NULL, 'o'},
+ {"hostonly", no_argument, NULL, 'H'},
{"all", no_argument, NULL, 'a'},
- {"fips", no_argument, NULL, 'H'},
+ {"fips", no_argument, NULL, 'f'},
{"destrootdir", required_argument, NULL, 'D'},
{NULL, 0, NULL, 0}
};
- while ((c = getopt_long(argc, argv, "adhloD:HR", options, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "adfhloD:HR", options, NULL)) != -1) {
switch (c) {
case ARG_VERSION:
puts(PROGRAM_VERSION_STRING);
case 'D':
destrootdir = strdup(optarg);
break;
- case 'H':
+ case 'f':
arg_hmac = true;
break;
+ case 'H':
+ arg_hostonly = true;
+ break;
case 'h':
usage(EXIT_SUCCESS);
break;