Added build script for cPanel

This commit is contained in:
the-djmaze 2022-11-25 09:56:26 +01:00
parent 5c02806a76
commit ce7bcbcaf5
2 changed files with 44 additions and 1 deletions

39
build/cpanel.php Executable file
View file

@ -0,0 +1,39 @@
<?php
echo "\x1b[33;1m === cPanel === \x1b[0m\n";
$cpanel_destination = "{$destPath}snappymail-{$package->version}-cpanel.tar";
@unlink($cpanel_destination);
@unlink("{$cpanel_destination}.gz");
$cpanel_tar = new PharData($cpanel_destination);
$cpanel_tar->buildFromDirectory('./integrations/cpanel', "@integrations/cpanel/@");
$cpanel_path = '/usr/local/cpanel/base/3rdparty/snappymail/';
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('snappymail/v'), RecursiveIteratorIterator::SELF_FIRST);
foreach ($files as $file) {
if (is_file($file)) {
$newFile = str_replace('\\', '/', $file);
$cpanel_tar->addFile($file, "{$cpanel_path}{$newFile}");
}
}
$cpanel_tar->addFile('.htaccess', "{$cpanel_path}.htaccess");
//$cpanel_tar->addFile('_include.php', 'snappymail/app/_include.php');
$cpanel_tar->addFile('README.md', "{$cpanel_path}README.md");
$cpanel_tar->addFromString('VERSION', $package->version);
$index = file_get_contents('index.php');
$index = str_replace('0.0.0', $package->version, $index);
$cpanel_tar->addFromString("{$cpanel_path}index.php", $index);
$data = file_get_contents('dev/serviceworker.js');
$cpanel_tar->addFromString("{$cpanel_path}serviceworker.js", $data);
$cpanel_tar->compress(Phar::GZ);
unlink($cpanel_destination);
$cpanel_destination .= '.gz';
echo "{$cpanel_destination} created\n";

View file

@ -2,7 +2,7 @@
<?php
chdir(__DIR__);
$options = getopt('', ['aur','docker','plugins','set-version','skip-gulp','debian','nextcloud','sign']);
$options = getopt('', ['aur','docker','plugins','set-version','skip-gulp','debian','nextcloud','sign','cpanel']);
if (isset($options['plugins'])) {
require(__DIR__ . '/build/plugins.php');
@ -178,6 +178,10 @@ if (isset($options['nextcloud'])) {
require(__DIR__ . '/build/nextcloud.php');
}
if (isset($options['cpanel'])) {
require(__DIR__ . '/build/cpanel.php');
}
rename("snappymail/v/{$package->version}", 'snappymail/v/0.0.0');
file_put_contents("{$destPath}core.json", '{