Search
j0ke.net Open Build Service
>
Projects
>
internetx
:
kiwi
:
Appliance
>
dracut
> 0014-nbd-add-missing-generator.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File 0014-nbd-add-missing-generator.patch of Package dracut
From 9290769ec2e01f393cd7c6ad0cf9aa727de361f0 Mon Sep 17 00:00:00 2001 From: Harald Hoyer <harald@redhat.com> Date: Thu, 7 Jan 2016 09:56:36 +0100 Subject: [PATCH] nbd: add missing generator --- modules.d/95nbd/nbd-generator.sh | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 modules.d/95nbd/nbd-generator.sh diff --git a/modules.d/95nbd/nbd-generator.sh b/modules.d/95nbd/nbd-generator.sh new file mode 100755 index 00000000..de52d116 --- /dev/null +++ b/modules.d/95nbd/nbd-generator.sh @@ -0,0 +1,55 @@ +#!/bin/sh + +type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh + +[ -z "$root" ] && root=$(getarg root=) + +[ "${root%%:*}" = "nbd" ] || exit 0 + +GENERATOR_DIR="$2" +[ -z "$GENERATOR_DIR" ] && exit 1 + +[ -d "$GENERATOR_DIR" ] || mkdir "$GENERATOR_DIR" + +ROOTFLAGS="$(getarg rootflags)" + +nroot=${root#nbd:} +nbdserver=${nroot%%:*}; nroot=${nroot#*:} +nbdport=${nroot%%:*}; nroot=${nroot#*:} +nbdfstype=${nroot%%:*}; nroot=${nroot#*:} +nbdflags=${nroot%%:*} + +if [ "$nbdflags" = "$nbdfstype" ]; then + unset nbdflags +fi +if [ "$nbdfstype" = "$nbdport" ]; then + unset nbdfstype +fi + +[ -n "$nbdflags" ] && ROOTFLAGS="$nbdflags" + +if getarg "ro"; then + if [ -n "$ROOTFLAGS" ]; then + ROOTFLAGS="$ROOTFLAGS,ro" + else + ROOTFLAGS="ro" + fi +fi + +if [ -n "$nbdfstype" ]; then + ROOTFSTYPE="$nbdfstype" +else + ROOTFSTYPE=$(getarg rootfstype=) || unset ROOTFSTYPE +fi + +{ + echo "[Unit]" + echo "Before=initrd-root-fs.target" + echo "[Mount]" + echo "Where=/sysroot" + echo "What=/dev/root" + [ -n "$ROOTFSTYPE" ] && echo "Type=${ROOTFSTYPE}" + [ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}" +} > "$GENERATOR_DIR"/sysroot.mount + +exit 0