[Gta04-owner] [PATCH] makesd: device safety check
Adrien Dorsaz
adrien at adorsaz.ch
Sat Mar 3 09:08:30 CET 2018
Thanks, that make sense :)
As DEV is already read as an environment variable, I think we even
don't need the "~/.makesd.conf" file as the user will just need to use
command like "export DEV=/dev/sdx" to set a default value for all calls
to makesd.
Regards,
Adrien
Le jeu 1 mar 2018 à 18:22, Andreas Kemnade <andreas at kemnade.info> a
écrit :
> do not automatically use /dev/sdc if no device is specified
> instead print usage and an error message.
>
> Signed-off-by: Andreas Kemnade <andreas at kemnade.info>
> ---
> makesd | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/makesd b/makesd
> index 16767c8..4b0e6c4 100755
> --- a/makesd
> +++ b/makesd
> @@ -15,7 +15,6 @@ CMDLINE="$0 $@" # save how makesd was called
> [ "$VARIANT" ] || VARIANT=latest
> [ "$ARCHITECTURE" ] || ARCHITECTURE=-armhf
> [ "$DEV" ] || DEV="$(cat ~/.makesd.conf 2>/dev/null)"
> -[ "$DEV" ] || DEV=/dev/sdc
>
> function macros()
> {
> @@ -483,6 +482,12 @@ echo sfdisk version: $SFVER $(version $SFVER) >&2
> }
>
> ### here starts real processing ###
> +if [ ! "$DEV" ]
> +then
> + useage
> + echo "Error: No device specified, cannot continue"
> + exit 1
> +fi
>
> for TOOL in sfdisk fdisk partprobe dd mkfs.vfat mke2fs fsck.vfat
> fsck.ext3 fsck
> do
> --
> 2.11.0
>
> _______________________________________________
> Gta04-owner mailing list
> Gta04-owner at goldelico.com
> http://lists.goldelico.com/mailman/listinfo.cgi/gta04-owner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.goldelico.com/pipermail/gta04-owner/attachments/20180303/ed96ac1a/attachment.html>
More information about the Gta04-owner
mailing list