Package: dpkg
Version: 1.13.24
Severity: wishlist

In case the information in /etc/alternatives/ is somehow deleted, it
causes severe trouble to system maintenance.

Please add option --restorea-all option which would:

  - Rebuild/recreate all missing links

There should also be option --clean

  - To delete dangling symlinks

This feature request was discussed mentioned in posts:

   [1] http://lists.debian.org/debian-devel/2006/10/msg01162.html
   [1] http://lists.debian.org/debian-devel/2006/10/msg01169.html

Where the suggested methods were are listed below.

Jari

- - -

[1] By Tyler MacDonald 

I found a way to do it, but I think the solution was less than ideal:
Install "Debarnacle" from CPAN (isn't even in debian...)  Run this
command:

perl -MDebian::Debarnacle::Alternatives -e 'my $i = 
Debian::Debarnacle::Alternatives->get_list; while(my($l,$r) = splice(@$i,0,2)) 
{ symlink($l,$r); print "$l $r\n"; }'

Now I have all my symlinks back...


[2] By Jean-Christophe Dubacq 

Supposing /etc/alternatives is correct:

    for i in /var/lib/dpkg/alternatives/*; do
      j=$(basename $i)
      STATE=0
      while read a && [ -n "$a" ]; do
        case $STATE in
          0) STATE=1
              ;;
          1) STATE=2
             mkdir -p $(dirname "$a")
             if [ -e $a -o -L $a ]; then rm -rf $a; fi
             ln -s /etc/alternatives/${j} ${a}
              ;;
          *) STATE=1
             j="$a"
        esac
      done < $i
    done
  for i in /var/lib/dpkg/alternatives/*; do
    j=$(basename $i)
    STATE=0
    while read a && [ -n "$a" ]; do
      case $STATE in
     0) STATE=1
        ;;
     1) STATE=2
        b=$(ls -lL "$a" 2>&1 >/dev/null|wc -l)
        if [ "$b" -gt 0 ]; then
          rm -f "$a"; rm -f "/etc/alternatives/${j}"
        fi
        ;;
     *) STATE=1
        j="$a"
      esac
    done < $i
  done

The second loop just removes dangling alternatives. I don't like them.


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.18-1-686
Locale: LANG=C, LC_CTYPE=C (charmap=ISO-8859-1) (ignored: LC_ALL set to en_US)

Versions of packages dpkg depends on:
ii  coreutils                    5.97-5.1    The GNU core utilities
ii  libc6                        2.3.6.ds1-7 GNU C Library: Shared libraries

dpkg recommends no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to