[pacman-dev] [PATCH] makepkg: also clean cache if no character was entered at the prompt
Cedric Staniewski
cedric at gmx.ca
Wed Oct 21 17:22:25 EDT 2009
Eric Bélanger wrote:
> On Wed, Oct 21, 2009 at 1:13 PM, Cedric Staniewski <cedric at gmx.ca> wrote:
>> Allan McRae wrote:
>>> Allan McRae wrote:
>>>> Cedric Staniewski wrote:
>>>>> If no character was entered, the preselected option (= the capital)
>>>>> should be assumed; just as pacman it does.
>>>>>
>>>>> Signed-off-by: Cedric Staniewski <cedric at gmx.ca>
>>>>> ---
>>>>> scripts/makepkg.sh.in | 2 +-
>>>>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>>>>
>>>>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>>>>> index 40367ae..3b29b31 100644
>>>>> --- a/scripts/makepkg.sh.in
>>>>> +++ b/scripts/makepkg.sh.in
>>>>> @@ -1600,7 +1600,7 @@ if [ "$CLEANCACHE" -eq 1 ]; then
>>>>> echo -n "$(gettext "[Y/n]")"
>>>>> read answer
>>>>> answer="${answer^^}"
>>>>> - if [ "$answer" = "$(gettext "YES")" -o "$answer" =
>>>>> "$(gettext "Y")" ]; then
>>>>> + if [ -z "$answer" -o "$answer" = "$(gettext "YES")" -o
>>>>> "$answer" = "$(gettext "Y")" ]; then
>>>>> rm "$SRCDEST"/*
>>>>> if [ $? -ne 0 ]; then
>>>>> error "$(gettext "Problem removing files; you may
>>>>> not have correct permissions in %s")" "$SRCDEST"
>>>>>
>>>> This is a fairly bad option to default to yes... I would prefer just
>>>> changing the query to [n/Y] and keep the test as it is.
>>> Ugh... late at night. I meant [y/N].
>>>
>>> Allan
>>>
>> Also thought about that, but came to the conclusion an extra flag and a prompt are safe enough.
>> Anyway, here you go.
>>
>>
>> >From 2f5d122c7684233377817b9d62f3dd68cdfe2e44 Mon Sep 17 00:00:00 2001
>> -- 8< --
>> From: Cedric Staniewski <cedric at gmx.ca>
>> Date: Wed, 21 Oct 2009 19:08:41 +0200
>> Subject: [PATCH] makepkg: change preselected option for cleaning the cache from Y to N
>>
>> Signed-off-by: Cedric Staniewski <cedric at gmx.ca>
>> ---
>> scripts/makepkg.sh.in | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>> index 40367ae..088edca 100644
>> --- a/scripts/makepkg.sh.in
>> +++ b/scripts/makepkg.sh.in
>> @@ -1597,7 +1597,7 @@ if [ "$CLEANCACHE" -eq 1 ]; then
>> if [ -n "$SRCDEST" -a "$SRCDEST" != "$startdir" ]; then
>> msg "$(gettext "Cleaning up ALL files from %s.")" "$SRCDEST"
>> echo -n "$(gettext " Are you sure you wish to do this? ")"
>> - echo -n "$(gettext "[Y/n]")"
>> + echo -n "$(gettext "[N/y]")"
>
> Shouldn't the last line be:
>
> + echo -n "$(gettext "[y/N]")"
>
> i.e. put the y first?
Haha, that's Allan's karma. At least, I capitalized the right character. :)
Sorry for that and thanks Eric.
>From c3b242554ef7958257743a975e3928dcb8903d69 Mon Sep 17 00:00:00 2001
From: Cedric Staniewski <cedric at gmx.ca>
Date: Wed, 21 Oct 2009 19:08:41 +0200
-- 8< --
Subject: [PATCH] makepkg: change preselected option for cleaning the cache from Y to N
Signed-off-by: Cedric Staniewski <cedric at gmx.ca>
---
scripts/makepkg.sh.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 40367ae..47f9873 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1597,7 +1597,7 @@ if [ "$CLEANCACHE" -eq 1 ]; then
if [ -n "$SRCDEST" -a "$SRCDEST" != "$startdir" ]; then
msg "$(gettext "Cleaning up ALL files from %s.")" "$SRCDEST"
echo -n "$(gettext " Are you sure you wish to do this? ")"
- echo -n "$(gettext "[Y/n]")"
+ echo -n "$(gettext "[y/N]")"
read answer
answer="${answer^^}"
if [ "$answer" = "$(gettext "YES")" -o "$answer" = "$(gettext "Y")" ]; then
--
1.6.5.1
More information about the pacman-dev
mailing list