0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.142.130.127


Current Path : /proc/self/root/usr/share/dh-exec/
Upload File :
Current File : //proc/self/root/usr/share/dh-exec/dh-exec-install-rename

#! /usr/bin/perl -wnp
##
## This script looks for SOURCE => DEST lines in its input, and copies
## SOURCE to a temporary directory under debian/tmp, with the desired
## DEST name. It will create directories appropriately.
##
## It is done this way, so that we leave the boring work to
## dh_install, and all of its options will continue to work. And we
## put this under debian/tmp, because that gets cleaned up by dh_prep.
BEGIN {
        use File::Spec;
        use File::Basename qw/basename/;
        use File::Temp qw/tempdir/;
        use File::Copy qw/cp move/;
        use File::Path qw/make_path/;

        make_path("debian/tmp");
        our $tempdir = tempdir ("debian/tmp/dh-exec.XXXXXXXX");
        our $append_destpath = TRUE;
        if ($ENV{DH_EXEC_SOURCE} =~ /manpages$/) {
                $append_destpath = FALSE;
        }

        our $noop = 1;
}

if (defined ($ENV{"DH_CONFIG_ACT_ON_PACKAGES"}) &&
    defined ($ENV{"DH_EXEC_SOURCE"})) {
    my @packages = split(/,/, $ENV{"DH_CONFIG_ACT_ON_PACKAGES"});
    my (undef, undef, $currpkg) = File::Spec->splitpath ($ENV{"DH_EXEC_SOURCE"});
    $currpkg = basename ($currpkg, (".install", ".manpages"));

    $noop = 0 if ($currpkg eq "install" || $currpkg eq "manpages");

    foreach my $pkg (@packages) {
        $noop = 0 if ($pkg eq $currpkg);
    }
} else {
    $noop = 0;
}

if (/([^\s]*)\s+=>\s+([^\s]*)/) {
        my ($src, $dst) = ($1, $2);
        my (undef, $srcpath, undef) = File::Spec->splitpath ($src);
        my (undef, $dstpath, $dstfile) = File::Spec->splitpath ($dst);
        my $debpath = File::Spec->catdir ($tempdir, $dstpath);

        unless ($noop) {
            make_path($debpath);

            cp ($src, File::Spec->catfile ($debpath, $dstfile)) or
                move (File::Spec->catfile ("debian/tmp", $src),
                      File::Spec->catfile ($debpath, $dstfile)) or
                      die "Failed to copy '$src': $!";
        }

        $_ = File::Spec->catfile ($debpath, $dstfile);
        $_ .= " " . $dstpath if ($append_destpath eq TRUE);
        $_ .= "\n";
}