summaryrefslogtreecommitdiffstats
path: root/perl-install/live_install2
blob: b5a2ea877ea390f2533e0a5e5da283836c7c9b04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/perl

my $dir = `pwd`;
chomp $dir;
$dir .= "/../../..";

#- allow devfsd to enable a faster upgrade.
system "modprobe loop";
my $devfsd_pid = `/sbin/pidof devfsd`;
$devfsd_pid > 0 and kill 15, $devfsd_pid;

#- perl version of the install, we use directly the version we found,
#- this means there SHOULD BE no module compiled for an older version of perl
#- which will be used by DrakX.
my ($version, $arch) = (glob "$dir/usr/lib/perl5/*/*/CORE/libperl.so")[0] =~ m|$dir/usr/lib/perl5/([^/]*)/([^/]*)/CORE/libperl.so|;

#- keep it mind the ELF loader to use.
$ENV{LD_LOADER} = "$dir/lib/ld-linux.so.2";

$ENV{LOCPATH}="$dir/usr/share/locale";
$ENV{GCONV_PATH}="$dir/usr/lib/gconv";
$ENV{PERL5LIB} = join ":", map { "$dir/usr/lib/perl5/$_" } ("$version/$arch",
							    "$version",
							    "site_perl/$version/$arch",
							    "site_perl/$version",
							    "site_perl",
							    "vendor_perl/$version/$arch",
							    "vendor_perl/$version",
							    "vendor_perl",
							   );
$ENV{LD_LIBRARY_PATH} = "$dir/usr/bin:$dir/bin:$dir/sbin:$dir/usr/sbin:$dir/usr/X11R6/bin:$dir/lib:$dir/usr/lib:$dir/usr/lib/perl5/$version/$arch/CORE";
$ENV{PATH} = join(":", map { "$dir/$_" } split ":", "/usr/bin:/bin:/sbin:/usr/sbin:/usr/X11R6/bin") . ":$ENV{PATH}";
$ENV{SHARE_PATH} = "$dir/usr/share";
$ENV{RPMRC_FILE} = "$dir/usr/lib/rpm/rpmrc";
$ENV{GTK_DATA_PREFIX} = "$dir/usr";
$ENV{GTK_EXE_PREFIX} = "$dir/usr";
$ENV{GDK_IMLIB_PATH} = "$dir/usr/lib";

system $ENV{LD_LOADER}, "../perl", "-i", "-pe", "s,^(.*macrofiles[^/]*)(.*),\$1$dir/usr/lib/rpm/macros:\$2,", $ENV{RPMRC_FILE};
system $ENV{LD_LOADER}, "../perl", "./install2", "--live", @ARGV;

#- at this point, unwind above else they will not run correctly (wrong ld-linux.so.2)
delete $ENV{GTK_EXE_PREFIX};
delete $ENV{RPMRC_FILE};
delete $ENV{LOCPATH};
delete $ENV{SHARE_PATH};
delete $ENV{PATH};
delete $ENV{LD_LIBRARY_PATH};
delete $ENV{PERL5LIB};
delete $ENV{LD_LOADER};

$ENV{DISPLAY} and system "xset", "-fp", "/tmp/drakx/mdkinst/usr/X11R6/lib/X11/fonts/";
foreach (qw(misc PEX Speedo Type1 mdk 75dpi 100dpi cyrillic)) {
    -d "/usr/X11R6/lib/X11/fonts/$_" or next;
    -e "/usr/X11R6/lib/X11/fonts/$_/fonts.dir" and next;
    chdir "/usr/X11R6/lib/X11/fonts/$_";
    system "mkfontdir";
}
$ENV{DISPLAY} and system "xset", "fp", "rehash";

system "/bin/rm", "-rf", "/tmp/drakx";
system "/bin/rm", "-rf", "/tmp/rhimage";

#- restore devfsd if it was running.
$devfsd_pid > 0 and system "/sbin/devfsd /dev";

exec "/bin/sync";
9 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
package standalone; # $Id$

use c;
use strict;
use common qw(N N_ if_);
use Config;

#- for sanity (if a use standalone is made during install, MANY problems will happen)
require 'log.pm'; #- "require log" causes some pb, perl thinking that "log" is the log() function
if ($::isInstall) {
    log::l('ERROR: use standalone made during install :-(');
    log::l('backtrace: ' . 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 = common::basename($0);

my %usages = (
           'diskdrake' => "[--{" . join(",", qw(hd nfs smb dav removable fileshare)) . "}]",
           'drakbackup' => N_("[--config-info] [--daemon] [--debug] [--default] [--show-conf]
Backup and Restore application

--default             : save default directories.
--debug               : show all debug messages.
--show-conf           : list of files or directories to backup.
--config-info         : explain configuration file options (for non-X users).
--daemon              : use daemon configuration. 
--help                : show this message.
--version             : show version number.
"),

           'drakboot' => N_("[--boot] [--splash]
OPTIONS:
  --boot            - enable to configure boot loader
  --splash          - enable to configure boot theme
default mode: offer to configure autologin feature"),
           'drakbug' => N_("[OPTIONS] [PROGRAM_NAME]

OPTIONS:
  --help            - print this help message.
  --report          - program should be one of mandrakelinux tools
  --incident        - program should be one of mandrakelinux tools"),
           'drakconnect' => N_("[--add]
  --add             - \"add a network interface\" wizard
  --del             - \"delete a network interface\" wizard
  --skip-wizard     - manage connections
  --internet        - configure internet
  --wizard          - like --add"),
           'drakfont' => N_("
Font Importation and monitoring application

OPTIONS:
--windows_import : import from all available windows partitions.
--xls_fonts      : show all fonts that already exist from xls
--install        : accept any font file and any directry.
--uninstall      : uninstall any font or any directory of font.
--replace        : replace all font if already exist
--application    : 0 none application.
                 : 1 all application available supported.
                 : name_of_application like  so for staroffice 
                 : and gs for ghostscript for only this one."),
           'draksec' => "[--debug]
--debug: print debugging information",
           'drakTermServ' => N_("[OPTIONS]...
Mandrakelinux Terminal Server Configurator
--enable         : enable MTS
--disable        : disable MTS
--start          : start MTS
--stop           : stop MTS
--adduser        : add an existing system user to MTS (requires username)
--deluser        : delete an existing system user from MTS (requires username)
--addclient      : add a client machine to MTS (requires MAC address, IP, nbi image name)