[PATCHv2,1/4] initscripts: Add generic function to get the filesystem type of a volume

Message ID 20240327193920.14311-1-stefan.schantl@ipfire.org
State Staged
Commit ed91103e229b128288a9799a9bbbbe6cd1d7f32d
Headers
Series [PATCHv2,1/4] initscripts: Add generic function to get the filesystem type of a volume |

Commit Message

Stefan Schantl March 27, 2024, 7:39 p.m. UTC
  Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
---
 src/initscripts/system/functions | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Michael Tremer March 28, 2024, 10:31 a.m. UTC | #1
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>

> On 27 Mar 2024, at 19:39, Stefan Schantl <stefan.schantl@ipfire.org> wrote:
> 
> Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
> ---
> src/initscripts/system/functions | 8 ++++++++
> 1 file changed, 8 insertions(+)
> 
> diff --git a/src/initscripts/system/functions b/src/initscripts/system/functions
> index 5a26aef45..b610143ab 100644
> --- a/src/initscripts/system/functions
> +++ b/src/initscripts/system/functions
> @@ -883,3 +883,11 @@ running_on_oci() {
> # We are not running on OCI
> return 1
> }
> +
> +volume_fs_type() {
> + if [ ! -d "${1}" ]; then
> + return
> + fi
> +
> + stat -f --format="%T" ${1}
> +}
> -- 
> 2.39.2
>
  

Patch

diff --git a/src/initscripts/system/functions b/src/initscripts/system/functions
index 5a26aef45..b610143ab 100644
--- a/src/initscripts/system/functions
+++ b/src/initscripts/system/functions
@@ -883,3 +883,11 @@  running_on_oci() {
 	# We are not running on OCI
 	return 1
 }
+
+volume_fs_type() {
+	if [ ! -d "${1}" ]; then
+		return
+	fi
+
+	stat -f --format="%T" ${1}
+}