From 8238c259e7d1faf156663a8a994010a9bc0a48cc Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Mon, 10 Jan 2022 23:00:27 +0100 Subject: [PATCH] Example code for Debian .deb of issue #185 --- build/deb/DEBIAN/control | 12 ++++++++++++ release.php | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 build/deb/DEBIAN/control diff --git a/build/deb/DEBIAN/control b/build/deb/DEBIAN/control new file mode 100644 index 000000000..7d08ad96e --- /dev/null +++ b/build/deb/DEBIAN/control @@ -0,0 +1,12 @@ +Package: snappymail +Version: 0.0.0 +Maintainer: the-djmaze +Depends: php-json +Architecture: all +Homepage: https://snappymail.eu +Vcs-Browser: https://github.com/the-djmaze/snappymail +Vcs-Git: https://github.com/the-djmaze/snappymail.git +Description: SnappyMail is a PHP-based simple, modern, lightweight & fast web-based email client with no database requirements. + It supports IMAP, SMTP and Sieve protocols, multiple accounts and identities, an admin panel for configuration. + Plugins can be installed to further extend functionality. + Emails are not stored locally, but are accessed through IMAP. diff --git a/release.php b/release.php index 25cecc4d2..048b1d1da 100755 --- a/release.php +++ b/release.php @@ -2,7 +2,7 @@ version}", 'snappymail/v/0.0.0'); + // Arch User Repository if ($options['aur']) { // extension_loaded('blake2') @@ -297,6 +299,36 @@ pkgname = snappymail file_put_contents($file, $PKGBUILD); } } +// Debian Repository +else if (isset($options['debian'])) { + $target_dir = __DIR__ . "/build/deb/snappymail_{$package->version}-1_all"; + + $data = file_get_contents(__DIR__ . '/build/deb/DEBIAN/control'); + $data = preg_replace('/Version: [0-9.]+/', "Version: {$package->version}", $data); + $dir = $target_dir . '/DEBIAN'; + is_dir($dir) || mkdir($dir, 0755, true); + file_put_contents("{$dir}/control", $data); + + $dir = $target_dir . '/var/lib/snappymail'; + is_dir($dir) || mkdir($dir, 0755, true); + file_put_contents($dir . '/VERSION', $package->version); + + $dir = $target_dir . '/usr/share/doc/snappymail'; + is_dir($dir) || mkdir($dir, 0755, true); + copy('CODE_OF_CONDUCT.md', "{$dir}/CODE_OF_CONDUCT.md"); + copy('CONTRIBUTING.md', "{$dir}/CONTRIBUTING.md"); + copy('README.md', "{$dir}/README.md"); + copy('CODE_OF_CONDUCT.md', "{$dir}/CODE_OF_CONDUCT.md"); + //usr/share/doc/snappymail/README.Debian + //usr/share/doc/snappymail/changelog.Debian.gz + //usr/share/doc/snappymail/copyright + + $dir = $target_dir . '/usr/share/snappymail'; + is_dir($dir) ? passthru('rm -dfr "'.$dir.'"') : mkdir(dirname($dir), 0755, true); + passthru('cp -r "' . __DIR__ . '/snappymail/v/0.0.0" "' . $dir . '"'); + + passthru('dpkg --build "'.$target_dir.'"'); +} // Docker build else if ($options['docker']) { echo "\x1b[33;1m === Docker === \x1b[0m\n";