From 63ef2cc72460bf1dcbaada783b1c7a8a999a5b2e Mon Sep 17 00:00:00 2001
From: the-djmaze <>
Date: Tue, 11 Oct 2022 11:52:48 +0200
Subject: [PATCH] Create Nextcloud release builder for #96
---
build/nextcloud.php | 40 +++++++++++++++++++
integrations/nextcloud/snappymail/VERSION | 1 -
.../nextcloud/snappymail/appinfo/info.xml | 2 +-
.../nextcloud/snappymail/appinfo/version | 1 -
release.php | 11 ++++-
5 files changed, 50 insertions(+), 5 deletions(-)
create mode 100755 build/nextcloud.php
delete mode 100755 integrations/nextcloud/snappymail/VERSION
delete mode 100755 integrations/nextcloud/snappymail/appinfo/version
diff --git a/build/nextcloud.php b/build/nextcloud.php
new file mode 100755
index 000000000..3c8a50681
--- /dev/null
+++ b/build/nextcloud.php
@@ -0,0 +1,40 @@
+version}-nextcloud.tar";
+
+@unlink($nc_destination);
+@unlink("{$nc_destination}.gz");
+
+$nc_tar = new PharData($nc_destination);
+
+$nc_tar->buildFromDirectory('./integrations/nextcloud', "@integrations/nextcloud/snappymail/@");
+
+$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('snappymail/v'), RecursiveIteratorIterator::SELF_FIRST);
+foreach ($files as $file) {
+ if (is_file($file)) {
+ $file = str_replace('\\', '/', $file);
+ $nc_tar->addFile($file, "snappymail/app/{$file}");
+ }
+}
+/*
+$nc_tar->addFile('data/.htaccess');
+$nc_tar->addFromString('data/VERSION', $package->version);
+$nc_tar->addFile('data/README.md');
+*/
+$nc_tar->addFile('_include.php', 'snappymail/app/_include.php');
+$nc_tar->addFile('.htaccess', 'snappymail/app/.htaccess');
+
+$index = file_get_contents('index.php');
+$index = str_replace('0.0.0', $package->version, $index);
+$nc_tar->addFromString('snappymail/app/index.php', $index);
+$nc_tar->addFile('README.md', 'snappymail/app/README.md');
+
+$data = file_get_contents('dev/serviceworker.js');
+$nc_tar->addFromString('snappymail/app/serviceworker.js', $data);
+
+$nc_tar->compress(Phar::GZ);
+unlink($nc_destination);
+$nc_destination .= '.gz';
+
+echo "{$nc_destination} created\n";
diff --git a/integrations/nextcloud/snappymail/VERSION b/integrations/nextcloud/snappymail/VERSION
deleted file mode 100755
index 5150594de..000000000
--- a/integrations/nextcloud/snappymail/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-2.18.5
\ No newline at end of file
diff --git a/integrations/nextcloud/snappymail/appinfo/info.xml b/integrations/nextcloud/snappymail/appinfo/info.xml
index 712291113..0e7a0b458 100644
--- a/integrations/nextcloud/snappymail/appinfo/info.xml
+++ b/integrations/nextcloud/snappymail/appinfo/info.xml
@@ -3,10 +3,10 @@
snappymail
SnappyMail
SnappyMail Webmail
- Simple, modern and fast web-based email client. After enabling in Nextcloud, go to Nextcloud admin panel, "Additionnal settings" and you will see a "SnappyMail webmail" section. There, click on the link to go to the SnappyMail admin panel. The default user/password is admin/12345. This version is based on SnappyMail 2.6.0 (2021-07).
2.18.5
agpl
SnappyMail, RainLoop Team, Nextgen-Networks, Tab Fitts, Nathan Kinkade, Pierre-Alain Bandinelli
+ Simple, modern and fast web-based email client. After enabling in Nextcloud, go to Nextcloud admin panel, "Additionnal settings" and you will see a "SnappyMail webmail" section. There, click on the link to go to the SnappyMail admin panel.
SnappyMail
https://github.com/the-djmaze/snappymail/blob/master/integrations/nextcloud/snappymail/README.md
diff --git a/integrations/nextcloud/snappymail/appinfo/version b/integrations/nextcloud/snappymail/appinfo/version
deleted file mode 100755
index a8a188756..000000000
--- a/integrations/nextcloud/snappymail/appinfo/version
+++ /dev/null
@@ -1 +0,0 @@
-7.1.2
diff --git a/release.php b/release.php
index f388ba0af..a784a62ea 100755
--- a/release.php
+++ b/release.php
@@ -2,7 +2,7 @@
[^<]*', "{$package
$file = __DIR__ . '/.docker/release/files/usr/local/include/application.ini';
file_put_contents($file, preg_replace('/current = "[0-9.]+"/', "current = \"{$package->version}\"", file_get_contents($file)));
// nextcloud
-file_put_contents(__DIR__ . '/integrations/nextcloud/snappymail/VERSION', $package->version);
$file = __DIR__ . '/integrations/nextcloud/snappymail/appinfo/info.xml';
file_put_contents($file, preg_replace('/[^<]*', "{$package->version}<", file_get_contents($file)));
// virtualmin
@@ -175,6 +174,10 @@ $tar_destination .= '.gz';
echo "{$zip_destination} created\n{$tar_destination} created\n";
+if (isset($options['nextcloud'])) {
+ require(__DIR__ . '/build/nextcloud.php');
+}
+
rename("snappymail/v/{$package->version}", 'snappymail/v/0.0.0');
file_put_contents("{$destPath}core.json", '{
@@ -252,6 +255,10 @@ if (isset($options['sign'])) {
echo "\x1b[33;1m === PGP Sign === \x1b[0m\n";
passthru('gpg --local-user 1016E47079145542F8BA133548208BA13290F3EB --armor --detach-sign '.escapeshellarg($tar_destination), $return_var);
passthru('gpg --local-user 1016E47079145542F8BA133548208BA13290F3EB --armor --detach-sign '.escapeshellarg($zip_destination), $return_var);
+ if (isset($options['nextcloud'])) {
+ passthru('gpg --local-user 1016E47079145542F8BA133548208BA13290F3EB --armor --detach-sign '
+ .escapeshellarg("{$destPath}snappymail-{$package->version}-nextcloud.tar.gz"), $return_var);
+ }
if (isset($options['debian'])) {
passthru('gpg --local-user 1016E47079145542F8BA133548208BA13290F3EB --armor --detach-sign '
. escapeshellarg(__DIR__ . "/build/dist/releases/webmail/{$package->version}/" . basename(DEB_DEST_DIR.'.deb')), $return_var);