File: //scripts.20110531.215904.25158/updatefrontpage
#!/usr/bin/perl
# cpanel - updatefrontpage Copyright(c) 2010 cPanel, Inc.
# All rights Reserved.
# copyright@cpanel.net http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
BEGIN { unshift @INC, '/usr/local/cpanel'; }
use Cpanel::SafeRun::Simple ();
use Cpanel::OSSys ();
use Cpanel::SafeDir::MK ();
use Cpanel::HttpRequest ();
use Cpanel::RpmUtils ();
my $system = Cpanel::OSSys::get_system();
if ( $system =~ m/freebsd/i ) {
if ( -e '/compat/ia32' ) {
if ( !-e '/compat/ia32/usr/local' ) {
Cpanel::SafeDir::MK( '/compat/ia32/usr/local', '0755' );
}
if ( !-e '/compat/ia32/usr/local/frontpage' ) {
symlink( '/usr/local/frontpage', '/compat/ia32/usr/local/frontpage' );
}
}
if ( grep( /auto/, @ARGV ) || !-e '/usr/local/frontpage/version5.0/bin' ) {
system 'chflags', 'noschg', '/usr/local/frontpage/version5.0/apache-fp/_vti_bin/fpexe';
system '/scripts/installfpfreebsd';
system '/scripts/initfpsuexec';
system 'chflags', 'schg', '/usr/local/frontpage/version5.0/apache-fp/_vti_bin/fpexe';
setperms();
}
}
else {
my $frontpage_rpm = Cpanel::SafeRun::Simple::saferun( 'rpm', '-q', 'frontpage' );
if ( !$frontpage_rpm || $frontpage_rpm =~ /(?:5\.0|5\.1|5\.2-0|not)/ ) {
system 'chattr', '-i', '/usr/local/frontpage/version5.0/apache-fp/_vti_bin/fpexe';
Cpanel::SafeDir::MK::safemkdir( '/var/spool/cpupdate', '0700' );
my $httpClient = Cpanel::HttpRequest->new( 'hideOutput' => 0 );
$httpClient->download( 'http://httpupdate.cpanel.net/fp/frontpage-2002-SR1.2.i386.rpm', '/var/spool/cpupdates/frontpage-2002-SR1.2.i386.rpm' );
Cpanel::RpmUtils::rpmpreinstall('/var/spool/cpupdates/frontpage-2002-SR1.2.i386.rpm');
system 'rpm', '-Uvh', '--nodeps', '/var/spool/cpupdates/frontpage-2002-SR1.2.i386.rpm';
unlink '/var/spool/cpupdates/frontpage-2002-SR1.2.i386.rpm';
system '/scripts/initfpsuexec';
system 'chattr', '+i', '/usr/local/frontpage/version5.0/apache-fp/_vti_bin/fpexe';
setperms();
}
}
system '/scripts/checkfpkey';
exit 0;
sub setperms {
chmod( 0755, '/usr/local/frontpage' );
chmod( 0755, '/usr/local/frontpage/version5.0' );
chmod( 0711, '/usr/local/frontpage/version5.0/apache-fp' );
chmod( 0755, '/usr/local/frontpage/version5.0/apache-fp/_vti_bin' );
system 'chown', '-R', 'bin:bin', '/usr/local/frontpage/version5.0/exes';
}