bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#24215: command=`rm`: how to script responses?


From: Phil Susi
Subject: bug#24215: command=`rm`: how to script responses?
Date: Wed, 31 Aug 2016 17:07:46 -0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

On 8/12/2016 7:21 PM, Tom Roche wrote:
> $ sudo parted ${DRIVE_DEV} --script -- rm 1
>> Warning: Partition /dev/sdb1 is being used. Are you sure you want to 
>> continue?
> 
> This seems wrong to me, in 2 ways:
> 
> 1. The manual[2] says quite clearly
>> ‘-s’
>> ‘--script’
>> never prompt the user

That is correct; it does not prompt the user.  You do still get the
warning that something is wrong though, and then parted exits with an error.

> So ISTM[3] either something is wrong with the code or with the manual. Am I 
> missing something? 
> 
> 2. I can't find a way to script a response to the prompt. I have tried 
> various permutations of
> 
>     echo 'yes' | sudo parted ${DRIVE_DEV} --script -- rm 1
>     yes | sudo parted ${DRIVE_DEV} --script -- rm 1
>     yes Y | sudo parted ${DRIVE_DEV} --script -- rm 1
>     sudo sh -c "yes yes | sudo parted ${DRIVE_DEV} --script -- rm 1"

Leave off the --script so that it prompts for a response, and then you
can give it the yes response on the command line, probably followed by
the ignore response to the error that is going to follow.

I've know about this class of problem for some time now but can't come
up with a satisfactory way to deal with it.  Something along the lines
of --yes-i-know-it-is-in-use to automatically answer that particular
response with a yes, if and only if it comes up would be ideal, but due
to the way the libparted api is designed, implementing such a thing is
difficult.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]