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

David C. Rankin drankinatty at suddenlinkmail.com
Sun Feb 20 16:32:14 EST 2011


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.

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


More information about the arch-general mailing list