From ff2d8bdfb3a56d97bcac9750ff16c3437a96cbe7 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Mon, 17 Aug 2020 15:46:17 +0200 Subject: [PATCH] dracut.sh: Add --version --- dracut.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dracut.sh b/dracut.sh index 4d83d3ab..2f2fadd1 100755 --- a/dracut.sh +++ b/dracut.sh @@ -242,6 +242,7 @@ Creates initial ramdisk images for preloading modules --kernel-image [FILE] location of the kernel image --regenerate-all Regenerate all initramfs images at the default location for the kernel versions found on the system + --version Display version If [LIST] has multiple arguments, then you have to put these in quotes. @@ -252,6 +253,14 @@ For example: EOF } +long_version() { + [[ $dracutbasedir ]] || dracutbasedir=$dracutsysrootdir/usr/lib/dracut + if [[ -f $dracutbasedir/dracut-version.sh ]]; then + . $dracutbasedir/dracut-version.sh + fi + echo "dracut $DRACUT_VERSION" +} + # Fills up host_devs stack variable and makes sure there are no duplicates push_host_devs() { local _dev @@ -416,6 +425,7 @@ rearrange_params() --long no-hostonly-i18n \ --long hostonly-i18n \ --long no-machineid \ + --long version \ -- "$@") if (( $? != 0 )); then @@ -616,6 +626,7 @@ while :; do kernel_image_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;; --no-machineid) machine_id_l="no";; + --version) long_version; exit 1 ;; --) shift; break;; *) # should not even reach this point