[systemd-devel] [PATCH 12/12] Add mock fsck process

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Wed Jan 28 07:08:26 PST 2015


On Wed, Jan 28, 2015 at 02:25:17PM +0100, Didier Roche wrote:
> 

> From aefe0667ed62d5d7e17193c0f5ae302ed57e4727 Mon Sep 17 00:00:00 2001
> From: Didier Roche <didrocks at ubuntu.com>
> Date: Mon, 26 Jan 2015 17:46:36 +0100
> Subject: [PATCH 12/12] Add mock fsck process
> 
> ---
>  test/mocks/fsck | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
>  create mode 100755 test/mocks/fsck
> 
> diff --git a/test/mocks/fsck b/test/mocks/fsck
> new file mode 100755
> index 0000000..77b50d7
> --- /dev/null
> +++ b/test/mocks/fsck
> @@ -0,0 +1,27 @@
> +#!/bin/bash
I think you can change this to /bin/sh, I don't see any bashisms.

> +fd=0
> +
> +OPTIND=1
> +while getopts "C:aTlM" opt; do
> +    case "$opt" in
> +        C)
> +            fd=$OPTARG
> +            ;;
> +        \?);;
> +    esac
> +done
> +
> +shift "$((OPTIND-1))"
> +device=$1
> +
> +echo "Running fake fsck on $device"
> +
> +declare -a maxpass=(30 5 2 30 60)
> +
> +for pass in {1..5}; do
> +    maxprogress=${maxpass[$((pass-1))]}
> +    for (( current=0; current<=${maxprogress}; current++)); do
> +        echo "$pass $current $maxprogress $device">&$fd
> +        sleep 0.1
> +    done
> +done
> -- 
> 2.1.4
> 

> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel



More information about the systemd-devel mailing list