commit 2c91f793bde657bb0bbd57b14a49cc5e1728dd19 Author: Leonid Krivoshein Date: Thu Apr 1 02:45:23 2021 +0300 pipeline/mountfs: add MOUNTFSOPTS= and MOUNTFSTYPE= parameters diff --git a/features/pipeline/README.md b/features/pipeline/README.md index c573163..fa3f9e3 100644 --- a/features/pipeline/README.md +++ b/features/pipeline/README.md @@ -16,11 +16,16 @@ the previous elements. - `pipeline=name[,name1][,name2]` - the main parameter that determines the order in which pipe elements are called. - `getimage` specifies an URL to fetch and mount. -- `mountfs` specifies a file to mount. -- `overlayfs` defines a list of elements to be combined. - `waitdev` describes the local device to wait. The format of this parameter is the same as `root=`. +## Optional additional parameters + +- `mountfs` specifies a file to mount. +- `mountfstype` specifies a filesystem type. +- `mountfsopts` specifies a mount options. +- `overlayfs` defines a list of elements to be combined. + The separator between the elements is a comma (`,`). The parameters can be specified more than once depending on how many times diff --git a/features/pipeline/data/etc/initrd/cmdline.d/pipeline b/features/pipeline/data/etc/initrd/cmdline.d/pipeline index 4200d57..eb4854e 100644 --- a/features/pipeline/data/etc/initrd/cmdline.d/pipeline +++ b/features/pipeline/data/etc/initrd/cmdline.d/pipeline @@ -3,3 +3,5 @@ register_array string GETIMAGE register_array string MOUNTFS register_array string OVERLAYFS register_array string WAITDEV +register_array string MOUNTFSOPTS +register_array string MOUNTFSTYPE diff --git a/features/pipeline/data/lib/pipeline/mountfs b/features/pipeline/data/lib/pipeline/mountfs index 138afa5..6833455 100755 --- a/features/pipeline/data/lib/pipeline/mountfs +++ b/features/pipeline/data/lib/pipeline/mountfs @@ -9,8 +9,10 @@ target="$(resolve_target "$param")" [ -n "$target" ] || fatal "unable to resolve: $param" -opts= -[ ! -c "$target" ] && [ ! -b "$target" ] || +fstype="$(get_parameter MOUNTFSTYPE)" + +opts="$(get_parameter MOUNTFSOPTS)" +[ ! -c "$target" ] && [ ! -b "$target" ] || [ -n "$opts" ] || opts='ro,loop' -run mount ${opts:+-o $opts} "$target" "$destdir" +run mount ${fstype:+-t $fstype} ${opts:+-o $opts} -- "$target" "$destdir"