#!/usr/bin/perl -- use strict; use warnings; my $admindir = "/var/lib/dpkg"; # This line modified by Makefile my $dpkglibdir = "../utils"; # This line modified by Makefile my $version = '0.93.80'; # This line modified by Makefile push (@INC, $dpkglibdir); require 'dpkg-gettext.pl'; textdomain("dpkg"); ($0) = $0 =~ m:.*/(.+):; # Global variables: my $altdir = '/etc/alternatives'; # FIXME: this should not override the previous assignment. $admindir = $admindir . '/alternatives'; my $testmode = 0; my $verbosemode = 0; my $mode = ''; # Action to perform (display / install / remove / display / auto / config) my $manual = 'auto'; # Update mode for alternative (manual / auto) my $state; # State of alternative: # expected: alternative with highest priority is the active alternative # expected-inprogress: busy selecting alternative with highest priority # unexpected: alternative another alternative is active / error during readlink # nonexistent: alternative-symlink does not exist my %versionnum; # Map from currently available versions into @versions and @priorities my @versions; # List of available versions for alternative my @priorities; # Map from @version-index to priority my $best; my $bestpri; my $bestnum; my $link; # Link we are working with my $linkname; my $alink; # Alternative we are managing (ie the symlink we're making/removing) (install only) my $name; # Name of the alternative (the symlink) we are processing my $apath; # Path of alternative we are offering my $apriority; # Priority of link (only when we are installing an alternative) my %aslavelink; my %aslavepath; my %aslavelinkcount; my $slink; my $sname; my $spath; my @slavenames; # List with names of slavelinks my %slavenum; # Map from name of slavelink to slave-index (into @slavelinks) my @slavelinks; # List of slavelinks (indexed by slave-index) my %slavepath; # Map from (@version-index,slavename) to slave-path my %slavelinkcount; my $enoent = `$dpkglibdir/enoent` || die sprintf(_g("Cannot get ENOENT value from %s: %s"), "$dpkglibdir/enoent", $!); sub ENOENT { $enoent; } sub version { printf _g("Debian %s version %s.\n"), $0, $version; printf _g(" Copyright (C) 1995 Ian Jackson. Copyright (C) 2000-2002 Wichert Akkerman."); printf _g(" This is free software; see the GNU General Public Licence version 2 or later for copying conditions. There is NO warranty. "); } sub usage { printf _g( "Usage: %s [