Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 1 of 1
  1. #1
    Member
    Join Date
    Jul 2003
    Posts
    33

    Default hint] How to add new scripts...

    1) install any scripts in WHM

    2) open /usr/local/cpanel/addon/

    3) pico install

    #!/usr/bin/perl

    BEGIN {
    push(@INC,"/usr/local/cpanel");
    }

    use SafeFile;

    #VARIBLES
    # <----Don't need modify ----
    my $domain = '%domain%';
    my $installpath = '%installpath%';
    my $modulename = '%modulename%';
    my $modulepath = '%modulepath%';
    my $homedir = '%homedir%';
    my $user = '%user%';
    my $installdir = '%installdir%';
    my $publichtml = '%public_html%';
    my $sqldb = '%sqldb%';
    my $sqluser = '%sqluser%';
    my $sqlpass = '%sqlpass%';
    my $sqlserver = '%sqlhost%';


    print "install at $installdir.\n";
    #----->

    system("mysql -u${sqluser} -p${sqlpass} ${sqldb} < $installdir/morning.sql");
    #<----- your scripts sql

    system("mv $installdir/pkg/* $installdir/");


    # regsrep("file to edit","old","new"); fuction can change your config file
    regsrep("$installdir/config_db.php","con_db_host","con_db_host=\"$sqlserver\";");
    # pls change config_db.php your config file
    #when row is the same "old", replace to "new"

    regsrep("$installdir/config_db.php","con_db_id","con_db_id=\"$sqluser\";");
    regsrep("$installdir/config_db.php","con_db_pass","con_db_pass=\"$sqlpass\";");
    regsrep("$installdir/config_db.php","con_db_name","con_db_name=\"$sqldb\";");
    #like this you can replace your files.


    unlink("$installdir/config_db.php.tmpeditlib");


    #do we need this?
    #regsrepunlink("$installdir/config.tmpeditlib");

    #chmod(707,"$installdir/session");
    #chmod(707,"$installdir/session/*");
    #chmod(707,"$installdir/board_data/*.php");

    #system("rm","-rf","$installdir/install");

    print "<br><br><b>Complete! </b><br>\n";

    #print "<br>You can access the admin interface at: <a href=\"http://$domain/$installpath/admin/\">http://${domain}${installpath}/admin/admin_setup.php</a> with the username: ${username}, and the password:
    #${password}.<br>\n";
    print "<br>access : <a href=\"http://${domain}${installpath}/admin.php\" target=_blank>http://${domain}${installpath}/admin.php</a><br><br>\n";

    # <----Don't modify ----
    sub regsrep {
    my($file,$old,$new) = @_;
    $filelock = SafeFile::safeopen(\*FH,"$file");
    $fileeditlock = SafeFile::safeopen(\*FHT,">$file.tmpeditlib");
    while(<FH>) {
    if ($_ =~ /^$/ || $_ eq "\n" || $_ eq "\r\n") {
    print FHT "$_";
    } elsif($_ =~ /$old/) {
    $result = $1;
    my $mnew = $new;
    $mnew =~ s/\$1/$result/g;
    print FHT "$mnew\n";
    } else {
    print FHT $_;
    }
    }
    SafeFile::safeclose(\*FH,$filelock);
    SafeFile::safeclose(\*FHT,$fileeditlock);
    $fileeditlock = SafeFile::safeopen(\*FHT,"$file.tmpeditlib");
    $filelock = SafeFile::safeopen(\*FH,">$file");
    while(<FHT>) { print FH $_ };
    SafeFile::safeclose(\*FH,$filelock);
    SafeFile::safeclose(\*FHT,$fileeditlock);
    }

    #--->

    4) pico cpanel-pkg

    5) gzip pkg
    tar -cvf your scripts
    gzip your scripts.tar

    6) Make install folder
    mkdir new_scripts
    cd new_scripts
    put in files and scripts.tar.gz
    you can put in license.txt(pls refer cpanel-pkg

    You can see them in usercp.

    sorry. I am not native....
    Last edited by azrael; 01-30-2004 at 04:39 AM.

Similar Threads & Tags
Similar threads

  1. add-on scripts
    By mehrdad abed in forum New User Questions
    Replies: 3
    Last Post: 03-28-2006, 04:14 PM
  2. Add-On Scripts
    By Mini in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 10-21-2005, 07:05 AM
  3. add zencart to add-on scripts library
    By dirigo in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 05-03-2005, 08:46 AM
  4. add on scripts
    By jethbrown in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 12-06-2004, 02:36 PM
  5. Add On Scripts
    By Ronny in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 02-06-2003, 10:06 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube