/usr/lib/emacsen-common/emacs-package-install is in emacsen-common 2.0.5.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | #!/usr/bin/perl -w
use strict;
use feature 'switch';
my $lib_dir = "/usr/lib/emacsen-common";
my $invoked_by_old_pkg;
my $context;
my $pkg;
require $lib_dir . "/lib.pl";
umask 0022 or die "emacs-package-install: can't set umask, aborting.";
sub usage
{
my($file_handle) = @_;
if($invoked_by_old_pkg)
{
print $file_handle "Usage: emacs-package-install FLAVOR\n";
}
else
{
print $file_handle
"Usage: emacs-package-install (--preinst|--postinst) FLAVOR\n";
}
}
sub is_new_pkg
{
my($pkg) = @_;
return (-e "$lib_dir/packages/compat/$pkg");
}
if(scalar(@ARGV) == 1)
{
$invoked_by_old_pkg = 1;
$pkg = $ARGV[0];
$context = 'postinst';
}
elsif (scalar(@ARGV) == 2)
{
given($ARGV[0])
{
when('--preinst') { $context = 'preinst'; }
when('--postinst') { $context = 'postinst'; }
default
{
usage(*STDERR{IO});
exit(1);
}
}
$pkg = $ARGV[1];
}
else
{
usage(*STDERR{IO});
exit(1);
}
if($context eq 'preinst')
{
unlink("$::installed_package_state_dir/$pkg");
exit(0);
}
# Must be --postinst.
# Get all the packages $pkg depends on, dependency sorted.
my @pkgs_to_handle = generate_add_on_install_list([$pkg]);
my @installed_flavors = get_installed_flavors();
foreach my $pkg (@pkgs_to_handle)
{
my $script = $lib_dir . "/packages/install/$pkg";
if(is_new_pkg($pkg))
{
foreach my $flavor (@installed_flavors)
{
print "Install $pkg for $flavor\n";
if(-e $script && (system($script, $flavor) != 0))
{
print STDERR "ERROR: install script from $pkg package failed\n";
exit(1);
}
}
}
else # old pkg
{
print "Install $pkg for emacs\n";
ex($script, 'emacs', @installed_flavors) if -e $script;
foreach my $flavor (@installed_flavors)
{
print "Install $pkg for $flavor\n";
if(-e $script && (system($script, $flavor, @installed_flavors) != 0))
{
print STDERR "ERROR: install script from $pkg package failed\n";
exit(1);
}
}
}
}
ex('touch', "$::installed_package_state_dir/$pkg");
|