Re: [arch-general] Howto - tell pacman -S (-U) to overwrite existing file in filesystem?

2011-02-21 Thread Ng Oon-Ee
On Mon, 2011-02-21 at 21:45 +0100, Sebastian Rust wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> On 21.02.2011 00:28, David C. Rankin wrote:
> >>> The question is "Can I do something in the PKGBUILD to tell pacman
> >>> - if the file is already there -> overwrite it?"
> Ah ok, now I understand your problem. What you could do, is putting
> the check into the PKGBUILD itself, as an bash command which is
> performed when you call it, like rm /etc/X11/sessions/trinity.desktop
> (in your case good), rm -rf * (bad), rm -rf / (fun :))
> As you can see, this is potentially dangerous and this is why you
> always should check your PKGBUILDs before. But in a nutshell, a
> PKGBUILD is little more than a shellscript and you can do basically
> everything you can perform with a shell.

That wouldn't work with installing binaries though, since the check is
done before the PKGBUILD is ever sourced.



Re: [arch-general] Howto - tell pacman -S (-U) to overwrite existing file in filesystem?

2011-02-21 Thread Sebastian Rust

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 21.02.2011 00:28, David C. Rankin wrote:
> On 02/20/2011 04:15 PM, Gaetan Bisson wrote:
>> [2011-02-20 15:32:14 -0600] David C. Rankin:
>>> The question is "Can I do something in the PKGBUILD to tell pacman
>>> - if the file is already there -> overwrite it?"
>>
>> Please. This mailing list is not for people to read you man pages.
>>
>> Next time, could you first spend five minutes to try and answer your
>> questions on your own? Here, it was as simple as searching for "pacman
>> overwrite" in Google, or looking for "overwrite" in pacman's man page.
>>
>> I am sure you understand this would benefit to everyone.
>>
>> For a more lengthy essay on the topic, see:
>>
>> http://www.catb.org/~esr/faqs/smart-questions.html#before
>>
>
> Thank you Gaetan and Sebastian,
>
> From your answers, I don't think you read my question before giving the the
> RTFM dismissal.
>
> I know how pacman -f works. I stated that in my original email. I'm not
asking
> how to make pacman do it. I'm asking:
>
> 
> The question is "Can I do something in the PKGBUILD to tell pacman
> - if the file is already there -> overwrite it?"
> 
>
> The only information I found in man PKGBUILD on force was option(force)
which
> relates to triggering an update even though the version number would not
> normally do so.
>
> I apologize if I missed it in the man page, but that is why I asked.
>
Ah ok, now I understand your problem. What you could do, is putting
the check into the PKGBUILD itself, as an bash command which is
performed when you call it, like rm /etc/X11/sessions/trinity.desktop
(in your case good), rm -rf * (bad), rm -rf / (fun :))
As you can see, this is potentially dangerous and this is why you
always should check your PKGBUILDs before. But in a nutshell, a
PKGBUILD is little more than a shellscript and you can do basically
everything you can perform with a shell.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1izv4ACgkQcFyEi9ZCdkBDdQCgoTopXVd62NRKJxOYSKVoDuv6
sukAnRPPwC6G8Bvu6So7UYtihQMBoXcz
=fIj2
-END PGP SIGNATURE-



Re: [arch-general] Howto - tell pacman -S (-U) to overwrite existing file in filesystem?

2011-02-20 Thread Gaetan Bisson
[2011-02-21 07:35:21 +] Magnus Therning:
> I'm just curious, which part of the install script is run *before*
> pacman checks for conflicting files?

None.

-- 
Gaetan


pgpaUtq29wEzD.pgp
Description: PGP signature


Re: [arch-general] Howto - tell pacman -S (-U) to overwrite existing file in filesystem?

2011-02-20 Thread Magnus Therning
On Mon, Feb 21, 2011 at 12:49:06AM +0100, Gaetan Bisson wrote:
> [2011-02-20 17:28:17 -0600] David C. Rankin:
> >   From your answers, I don't think you read my question before giving the 
> > the
> > RTFM dismissal.
> 
> I read (and answered) the question that is the subject of this thread.
> 
> The lengthy details of how you got to ask yourself this question don't
> interest me much, so I admit I just skimmed through your message. That
> is also why I replied off-list: to avoid polluting the list; replying to
> my reply on the list defeats the purpose.
> 
> > The question is "Can I do something in the PKGBUILD to tell pacman
> > - if the file is already there -> overwrite it?"
> 
> To the best of my knowledge, there is no way of doing that, except of
> course overwriting the file via the install script.

I'm just curious, which part of the install script is run *before*
pacman checks for conflicting files?

/M

-- 
Magnus Therning  OpenPGP: 0xAB4DFBA4 
email: mag...@therning.org   jabber: mag...@therning.org
twitter: magthe   http://therning.org/magnus

Most software today is very much like an Egyptian pyramid with
millions of bricks piled on top of each other, with no structural
integrity, but just done by brute force and thousands of slaves.
 -- Alan Kay


pgpxvsm7GMwoE.pgp
Description: PGP signature


Re: [arch-general] Howto - tell pacman -S (-U) to overwrite existing file in filesystem?

2011-02-20 Thread Gaetan Bisson
[2011-02-20 17:28:17 -0600] David C. Rankin:
>   From your answers, I don't think you read my question before giving the the
> RTFM dismissal.

I read (and answered) the question that is the subject of this thread.

The lengthy details of how you got to ask yourself this question don't
interest me much, so I admit I just skimmed through your message. That
is also why I replied off-list: to avoid polluting the list; replying to
my reply on the list defeats the purpose.

> The question is "Can I do something in the PKGBUILD to tell pacman
> - if the file is already there -> overwrite it?"

To the best of my knowledge, there is no way of doing that, except of
course overwriting the file via the install script.

-- 
Gaetan


Re: [arch-general] Howto - tell pacman -S (-U) to overwrite existing file in filesystem?

2011-02-20 Thread Isaac Dupree

On 02/20/11 18:28, David C. Rankin wrote:

The question is "Can I do something in the PKGBUILD to tell pacman
- if the file is already there ->  overwrite it?"


Please don't.  Put it in your release notes instead.  Don't silently 
overwrite user-written files!


You might look into configuration management too (the thing that 
generates *.pacnew files among other things) -- I'm not sure if it'd be 
useful, but that research might tell you what's been done/discussed 
before when making /etc files be newly pacman-managed.


-Isaac


Re: [arch-general] Howto - tell pacman -S (-U) to overwrite existing file in filesystem?

2011-02-20 Thread Allan McRae

On 21/02/11 07:32, David C. Rankin wrote:

   I get that. The question is "Can I do something in the PKGBUILD to tell 
pacman
- if the file is already there ->  overwrite it?" The purpose for the question 
is
make sure nobody else gets a conflict if they have followed a prior manual
Trinity kdm install proceedure.



I haven't tested this so I could be entirely wrong...   but have you 
tried adding that file to the backup array in the PKGBUILD?   From 
memory that will move the original file to *.orig and install the new one.


Allan



Re: [arch-general] Howto - tell pacman -S (-U) to overwrite existing file in filesystem?

2011-02-20 Thread David C. Rankin
On 02/20/2011 04:15 PM, Gaetan Bisson wrote:
> [2011-02-20 15:32:14 -0600] David C. Rankin:
>> The question is "Can I do something in the PKGBUILD to tell pacman
>> - if the file is already there -> overwrite it?"
> 
> Please. This mailing list is not for people to read you man pages.
> 
> Next time, could you first spend five minutes to try and answer your
> questions on your own? Here, it was as simple as searching for "pacman
> overwrite" in Google, or looking for "overwrite" in pacman's man page.
> 
> I am sure you understand this would benefit to everyone.
> 
> For a more lengthy essay on the topic, see:
> 
>   http://www.catb.org/~esr/faqs/smart-questions.html#before
> 

Thank you Gaetan and Sebastian,

  From your answers, I don't think you read my question before giving the the
RTFM dismissal.

  I know how pacman -f works. I stated that in my original email. I'm not asking
how to make pacman do it. I'm asking:


The question is "Can I do something in the PKGBUILD to tell pacman
- if the file is already there -> overwrite it?"


  The only information I found in man PKGBUILD on force was option(force) which
relates to triggering an update even though the version number would not
normally do so.

  I apologize if I missed it in the man page, but that is why I asked.

-- 
David C. Rankin, J.D.,P.E.


Re: [arch-general] Howto - tell pacman -S (-U) to overwrite existing file in filesystem?

2011-02-20 Thread Sebastian Rust

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 20.02.2011 22:32, David C. Rankin wrote:
>
> Guys,
>
> This is a curiosity really. I updated kdebase to create a
trinity.desktop file
> in /etc/X11/sessions in the PKGBUILD package() function:
>
> # install desktop and update kdmrc and Xsession
> [[ -f trinity.desktop ]] && {
> mkdir -p ${pkgdir}/etc/X11/sessions
> cp trinity.desktop ${pkgdir}/etc/X11/sessions
> }
> 
>
> Since I had already created trinity.desktop on my box (before it was
part of
> the package), I get (correctly):
>
> Targets (1): trinity-kdebase-1221588-1
>
> Total Download Size: 0.00 MB
> Total Installed Size: 86.71 MB
>
> Proceed with installation? [Y/n]
> checking package integrity...
> checking for file conflicts...
> trinity-kdebase: /etc/X11/sessions/trinity.desktop exists in filesystem
>
> IIRC this is exactly the way pacman is supposed to work because it has no
> knowledge of a prior trinity.desktop in the filesystem and won't
overwrite it.
> The short answer is "dummy -- remove the file or use --force."
>
> I get that. The question is "Can I do something in the PKGBUILD to tell
pacman
> - if the file is already there -> overwrite it?" The purpose for the
question is
> make sure nobody else gets a conflict if they have followed a prior manual
> Trinity kdm install proceedure.
>
pacman -S (-U) -f

from man pacman:
   -f, --force
   Bypass file conflict checks and overwrite conflicting
files. If the package that is about to be installed
   contains files that are already installed, this option will
cause all those files to be overwritten. This
   option should be used with care, ideally not at all.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1hiUsACgkQcFyEi9ZCdkA8GQCdGKg5WUbP+0kiP4a4IgvGXj2A
tvgAmgJHNi1JMfk77ohI3yi/y3U6Uqu7
=uCVp
-END PGP SIGNATURE-