summaryrefslogtreecommitdiffstats
path: root/perl-install/unused
ModeNameSize
-rw-r--r--.cvsignore2logstatsplain
-rw-r--r--cdrom.pm710logstatsplain
-rw-r--r--christmas-karaoke.patch3716logstatsplain
-rw-r--r--demo-frozen-bubble.patch13985logstatsplain
-rw-r--r--dns.pm1538logstatsplain
-rw-r--r--otherinsmod.pm488logstatsplain
-rw-r--r--scsi.pm3231logstatsplain
id='n144' href='#n144'>144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320
package standalone; # $Id$

use c;
use strict;
use common;
use Config;

#- for sanity (if a use standalone is made during install, MANY problems will happen)
if ($::isInstall) {
    require 'log.pm';
    log::l('ERROR: use standalone made during install :-(');
    require common;
    log::l('backtrace: ' . common::backtrace());
}
$::isStandalone = 1;

$ENV{SHARE_PATH} ||= "/usr/share";

c::setlocale();
c::bindtextdomain('libDrakX', "/usr/share/locale");

$::license = N("This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
");

my $progname = basename $0;
print "Running $progname\n";

my %usages = (
	      'draksec' => N(" [OPTIONS]...
	      --debug         print debugging information"),
	      'drakxtv' => "[--no-guess]",
	      'drakupdate_fstab' => " [--add | --del] <device>\n",
	      'keyboardrake' => N("[keyboard]"),
	      'printerdrake' => N(" [--skiptest] [--cups] [--lprng] [--lpd] [--pdq]"),
	      'rpmdrake' => N("[OPTION]...
  --no-confirmation      don't ask first confirmation question in MandrakeUpdate mode
  --no-verify-rpm        don't verify packages signatures
  --changelog-first      display changelog before filelist in the description window
  --merge-all-rpmnew     propose to merge all .rpmnew/.rpmsave files found"),
	      'XFdrake' => N(" [everything]
       XFdrake [--noauto] monitor
       XFdrake resolution"),
	      );

$usages{$_} = $usages{rpmdrake} foreach (qw(rpmdrake-remove MandrakeUpdate));
$usages{Xdrakres} = $usages{XFdrake};


my ($i, @new_ARGV);
foreach my $opt (@ARGV) {
    $i++;
    if ($opt eq '--help' || $opt eq '-h') {
	version();
	print STDERR N("\nUsage: %s  [--auto] [--beginner] [--expert] [-h|--help] [--noauto] [--testing] [-v|--version] ", $progname),  if_($usages{$progname}, $usages{$progname}), "\n";
#    print N("\nUsage: "), $::usage, "\n" if $::usage;
	exit(0);
    } elsif ($opt eq '--version' || $opt eq '-v') {
	version();
	exit(0);
    } elsif ($opt eq '--embedded') {
	(undef, $::XID, $::CCPID) = splice @ARGV, ($i-1), 3;
	$::isEmbedded = 1;
    } elsif ($opt eq '--expert') {
	$::expert = 1;
    } elsif ($opt eq '--noauto') {
	$::noauto = /-noauto/;
    } elsif ($opt eq '--auto') {
	$::auto = 1;
    } elsif ($opt eq '--testing') {
	$::testing = 1;
    } elsif ($opt eq '--beginner') {
	$::expert = 0;
    } else {
	push @new_ARGV, $opt;
    }
}

@ARGV = @new_ARGV;


sub version {
    print STDERR "Drakxtools version 9.1.0
Copyright (C) 1999-2002 MandrakeSoft by <install\@mandrakesoft.com>
",  $::license, "\n";
}

################################################################################
package pkgs_interactive;

use run_program;
use common;


sub interactive::do_pkgs {
    my ($in) = @_;
    bless { in => $in }, 'pkgs_interactive';
}

sub install {
    my ($o, @l) = @_;

    return 1 if is_installed($o, @l);

    my $wait;
    if ($o->{in}->isa('interactive::newt')) {
	$o->{in}->suspend;
    } else {
	$wait = $o->{in}->wait_message('', N("Installing packages..."));
    }
    standalone::explanations("installed packages @l");
    my $ret = system('urpmi', '--allow-medium-change', '--auto', '--best-output', @l) == 0;

    if ($o->{in}->isa('interactive::newt')) {
	$o->{in}->resume;
    } else {
	undef $wait;
    }
    $ret;
}

sub ensure_is_installed {
    my ($o, $pkg, $file, $auto) = @_;

    if (! -e $file) {
	$o->{in}->ask_okcancel('', N("The package %s needs to be installed. Do you want to install it?", $pkg), 1) 
	  or return if !$auto;
	$o->{in}->do_pkgs->install($pkg);
    }
    if (! -e $file) {
	$o->{in}->ask_warn('', N("Mandatory package %s is missing", $pkg));
	return;
    }
    1;
}

sub what_provides {
    my ($o, $name) = @_;
    my ($what) = split '\n', `urpmq '$name' 2>/dev/null`;
    split '\|', $what;
}

sub is_installed {
    my ($o, @l) = @_;