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

Sebastian Rust harlequix at googlemail.com
Sun Feb 20 16:36:11 EST 2011


-----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
> }
> <snip>
>
> 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-----



More information about the arch-general mailing list