diff options
author | Pascal Rigaux <pixel@mandriva.com> | 1999-07-01 17:10:27 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 1999-07-01 17:10:27 +0000 |
commit | 8acdea865038475cdb1884abe889a4175975aa2f (patch) | |
tree | 3afa347972cc6591a8da8eaa52ad0a87ffaf742a /perl-install/install_any.pm | |
parent | 3b8e5409e6265e10709f46ac179f3ea7d014fcac (diff) | |
download | drakx-8acdea865038475cdb1884abe889a4175975aa2f.tar drakx-8acdea865038475cdb1884abe889a4175975aa2f.tar.gz drakx-8acdea865038475cdb1884abe889a4175975aa2f.tar.bz2 drakx-8acdea865038475cdb1884abe889a4175975aa2f.tar.xz drakx-8acdea865038475cdb1884abe889a4175975aa2f.zip |
*** empty log message ***
Diffstat (limited to 'perl-install/install_any.pm')
-rw-r--r-- | perl-install/install_any.pm | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm new file mode 100644 index 000000000..514b940e7 --- /dev/null +++ b/perl-install/install_any.pm @@ -0,0 +1,161 @@ +package install_any; + +use diagnostics; +use strict; +use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK); + +@ISA = qw(Exporter); +%EXPORT_TAGS = ( + all => [ qw(versionString getNextStep doSuspend spawnSync spawnShell) ], +); +@EXPORT_OK = map { @$_ } values %EXPORT_TAGS; + +use common qw(:system); +use log; + +1; + +sub versionString { + my $kernel = $::o->{packages}->{kernel} or die "I couldn't find the kernel package!"; + + c::headerGetEntry($kernel->{header}, 'version') . "-" . + c::headerGetEntry($kernel->{header}, 'release'); +} + + +sub getNextStep { + my ($lastStep) = @_; + + $::o->{direction} = 1; + + return $::o->{lastChoice} = $::o->{steps}->{$lastStep}->{next}; +} + +sub doSuspend { + exit 1 if $::o->{localInstall} || $::testing; + + if (my $pid = fork) { + waitpid $pid, 0; + } else { + print "\n\nType <exit> to return to the install program.\n\n"; + exec {"/bin/sh"} "-/bin/sh"; + warn "error execing /bin/sh"; + sleep 5; + exit 1; + } +} + +sub spawnSync { + return if $::o->{localInstall} || $::testing; + + fork and return; + while (1) { sleep(30); sync(); } +} + +sub spawnShell { + return if $::o->{localInstall} || $::testing; + + -x "/bin/sh" or die "cannot open shell - /usr/bin/sh doesn't exist"; + + fork and return; + + local *F; + sysopen F, "/dev/tty2", 2 or die "cannot open /dev/tty2 -- no shell will be provided"; + + open STDIN, "<&F" or die; + open STDOUT, ">&F" or die; + open STDERR, ">&F" or die; + close F; + + c::setsid(); + + ioctl(STDIN, c::TIOCSCTTY(), 0) or warn "could not set new controlling tty: $!"; + + exec {"/bin/sh"} "-/bin/sh" or log::l("exec of /bin/sh failed: $!"); +} + + + +sub upgrFindInstall { +# int rc; +# +# if (!$::o->{table}.parts) { +# rc = findAllPartitions(NULL, &$::o->{table}); +# if (rc) return rc; +# } +# +# umountFilesystems(&$::o->{fstab}); +# +# # rootpath upgrade support +# if (strcmp($::o->{rootPath} ,"/mnt")) +# return INST_OKAY; +# +# # this also turns on swap for us +# rc = readMountTable($::o->{table}, &$::o->{fstab}); +# if (rc) return rc; +# +# if (!testing) { +# mountFilesystems(&$::o->{fstab}); +# +# if ($::o->{method}->prepareMedia) { +# rc = $::o->{method}->prepareMedia($::o->{method}, &$::o->{fstab}); +# if (rc) { +# umountFilesystems(&$::o->{fstab}); +# return rc; +# } +# } +# } +# +# return 0; +} + +sub upgrChoosePackages { +# static int firstTime = 1; +# char * rpmconvertbin; +# int rc; +# char * path; +# char * argv[] = { NULL, NULL }; +# char buf[128]; +# +# if (testing) +# path = "/"; +# else +# path = $::o->{rootPath}; +# +# if (firstTime) { +# snprintf(buf, sizeof(buf), "%s%s", $::o->{rootPath}, +# "/var/lib/rpm/packages.rpm"); +# if (access(buf, R_OK)) { +# snprintf(buf, sizeof(buf), "%s%s", $::o->{rootPath}, +# "/var/lib/rpm/packages"); +# if (access(buf, R_OK)) { +# errorWindow("No RPM database exists!"); +# return INST_ERROR; +# } +# +# if ($::o->{method}->getFile($::o->{method}, "rpmconvert", +# &rpmconvertbin)) { +# return INST_ERROR; +# } +# +# symlink("/mnt/var", "/var"); +# winStatus(35, 3, _("Upgrade"), _("Converting RPM database...")); +# chmod(rpmconvertbin, 0755); +# argv[0] = rpmconvertbin; +# rc = runProgram(RUN_LOG, rpmconvertbin, argv); +# if ($::o->{method}->rmFiles) +# unlink(rpmconvertbin); +# +# newtPopWindow(); +# if (rc) return INST_ERROR; +# } +# winStatus(35, 3, "Upgrade", _("Finding packages to upgrade...")); +# rc = ugFindUpgradePackages(&$::o->{packages}, path); +# newtPopWindow(); +# if (rc) return rc; +# firstTime = 0; +# psVerifyDependencies(&$::o->{packages}, 1); +# } +# +# return psSelectPackages(&$::o->{packages}, &$::o->{comps}, NULL, 0, 1); +} |