Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /opt/cpanel/ea-redis62/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/cpanel/ea-redis62/ea-podman-local-dir-setup
#!/usr/local/cpanel/3rdparty/bin/perl
# cpanel - ea-podman-local-dir-setup                 Copyright 2022 cPanel, Inc.
#                                                           All rights Reserved.
# [email protected]                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

use strict;
use warnings;

package scripts::ea_podman_local_dir_setup;

use Path::Tiny 'path';
use Cwd ();

run(@ARGV) if !caller;

sub run {
    my ($host_path) = @_;

    return add($host_path);
}

################
#### commands ##
################

sub add {
    my ($host_path) = @_;

    my ( $user, $homedir ) = ( getpwuid($>) )[ 0, 7 ];

    print "Adding a ea-redis62 instance for “$user” …\n";

    my $curdir = Cwd::cwd();

    {
        my $orig_umask = umask(0027);

        mkdir $host_path;    # it may exist so don’t check it’s RV

        die "Could not create directory “$host_path”" if !-d $host_path;
        chdir $host_path or die "Could not change into “$host_path”: $!\n";

        path("/opt/cpanel/ea-redis62/podman_entrypoint.sh")->copy("podman_entrypoint.sh");
        path("podman_entrypoint.sh")->chmod(0750);

        path("/opt/cpanel/ea-redis62/redis.conf")->copy("redis.conf");
        path("redis.conf")->chmod(0640);

        umask($orig_umask);
    }

    chdir $curdir or warn "Could not chdir back to “$curdir”: $!\n";
    print " … done!\n";

    return;
}

###############
#### helpers ##
###############

sub _bail {
    my ($msg) = @_;

    chomp($msg);
    warn "$msg\n";

    exit(1);    # there is no return()ing from this lol
}

1;

Spamworldpro Mini