From f38436a8de31b613c5a78ebe93b39c28a2508540 Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Fri, 5 Jul 2019 00:47:25 +0100 Subject: [PATCH 01/24] Update sympl-mail-dovecot-sni to always reload doevcot --- mail/sbin/sympl-mail-dovecot-sni | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mail/sbin/sympl-mail-dovecot-sni b/mail/sbin/sympl-mail-dovecot-sni index 67befcf6..11467540 100755 --- a/mail/sbin/sympl-mail-dovecot-sni +++ b/mail/sbin/sympl-mail-dovecot-sni @@ -31,6 +31,7 @@ done >> /dev/shm/sympl-mail-dovecot-sni.config # Compare it with what's there already. if [ -f "/etc/dovecot/sympl.d/10-main/60-sni" ]; then if diff /dev/shm/sympl-mail-dovecot-sni.config /etc/dovecot/sympl.d/10-main/60-sni > /dev/null ; then + /usr/sbin/service dovecot reload # Config has not changed, exiting. exit 0 fi @@ -39,10 +40,10 @@ fi # Move the new config into place, make it and start it up mv /dev/shm/sympl-mail-dovecot-sni.config /etc/dovecot/sympl.d/10-main/60-sni cd /etc/dovecot -sudo make test +make test -sudo make > /dev/null -sudo /usr/sbin/service dovecot reload +make > /dev/null +/usr/sbin/service dovecot reload if [ -f /dev/shm/sympl-mail-dovecot-sni.data ]; then rm /dev/shm/sympl-mail-dovecot-sni.data; fi -- GitLab From 59e07e0a582bb8b9bfa710e9943fcdece72a887e Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Fri, 5 Jul 2019 00:48:30 +0100 Subject: [PATCH 02/24] Update sympl-mail --- mail/sympl/ssl-hooks.d/sympl-mail | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mail/sympl/ssl-hooks.d/sympl-mail b/mail/sympl/ssl-hooks.d/sympl-mail index fc25abf4..1c9e08e6 100755 --- a/mail/sympl/ssl-hooks.d/sympl-mail +++ b/mail/sympl/ssl-hooks.d/sympl-mail @@ -8,4 +8,5 @@ fi # # Rebuild Dovecot SNI Certificates and reload on cert change. # -sudo /usr/sbin/sympl-mail-dovecot-sni +/usr/sbin/sympl-mail-dovecot-sni +/usr/sbin/service dovecot reload \ No newline at end of file -- GitLab From 975ebaebd384eae51a76cf9617137de1f1c74211 Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Fri, 5 Jul 2019 00:49:03 +0100 Subject: [PATCH 03/24] Revert "Update sympl-mail-dovecot-sni to always reload doevcot" This reverts commit f38436a8de31b613c5a78ebe93b39c28a2508540 --- mail/sbin/sympl-mail-dovecot-sni | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mail/sbin/sympl-mail-dovecot-sni b/mail/sbin/sympl-mail-dovecot-sni index 11467540..67befcf6 100755 --- a/mail/sbin/sympl-mail-dovecot-sni +++ b/mail/sbin/sympl-mail-dovecot-sni @@ -31,7 +31,6 @@ done >> /dev/shm/sympl-mail-dovecot-sni.config # Compare it with what's there already. if [ -f "/etc/dovecot/sympl.d/10-main/60-sni" ]; then if diff /dev/shm/sympl-mail-dovecot-sni.config /etc/dovecot/sympl.d/10-main/60-sni > /dev/null ; then - /usr/sbin/service dovecot reload # Config has not changed, exiting. exit 0 fi @@ -40,10 +39,10 @@ fi # Move the new config into place, make it and start it up mv /dev/shm/sympl-mail-dovecot-sni.config /etc/dovecot/sympl.d/10-main/60-sni cd /etc/dovecot -make test +sudo make test -make > /dev/null -/usr/sbin/service dovecot reload +sudo make > /dev/null +sudo /usr/sbin/service dovecot reload if [ -f /dev/shm/sympl-mail-dovecot-sni.data ]; then rm /dev/shm/sympl-mail-dovecot-sni.data; fi -- GitLab From 526228532df3f572eb239f6936768310f5305db0 Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Sat, 6 Jul 2019 16:19:38 +0100 Subject: [PATCH 04/24] Remove SNI config file when uninstalling --- mail/debian/prerm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/mail/debian/prerm b/mail/debian/prerm index 4d02900f..5bed295c 100755 --- a/mail/debian/prerm +++ b/mail/debian/prerm @@ -16,13 +16,20 @@ if echo "ae779d6822f91492b26697d6b9931835 /etc/default/clamav-daemon" | md5sum rm -f /etc/default/clamav-daemon fi -# -# Remove the old diversion +# +# Remove the old Dovecot SNI config if it exists +# +if [ -f /etc/dovecot/sympl.d/10-main/60-sni ]; then + rm /etc/dovecot/sympl.d/10-main/60-sni +fi + +# +# Remove the old diversion # package="sympl-mail" conf="/etc/dovecot/dovecot.conf" -# +# # Dovecot ships with its own config. # package="sympl-mail" @@ -46,5 +53,6 @@ if dpkg-divert --list "$package" | grep -xFq "diversion of $conf to $theirfile b fi + #DEBHELPER# exit 0 -- GitLab From c2db01867421f7ab7828cbdec4a464252eff7ffe Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Sat, 6 Jul 2019 16:19:51 +0100 Subject: [PATCH 05/24] Only run if there are certs available --- mail/sbin/sympl-mail-dovecot-sni | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/mail/sbin/sympl-mail-dovecot-sni b/mail/sbin/sympl-mail-dovecot-sni index 67befcf6..0299a279 100755 --- a/mail/sbin/sympl-mail-dovecot-sni +++ b/mail/sbin/sympl-mail-dovecot-sni @@ -2,6 +2,23 @@ set -e +if [ ! -L /srv/*/config/ssl/current ]; then + # No certs avaialable, so check if /etc/dovecot/sympl.d/10-main/60-sni exists + if [ -f /etc/dovecot/sympl.d/10-main/60-sni ]; then + # it exists, so remove it + rm /etc/dovecot/sympl.d/10-main/60-sni + # then rebuild the configuration + cd /etc/dovecot + make test + make > /dev/null + /usr/sbin/service dovecot reload + exit 0 + else + # Nothing to do yet, so just exit. + exit 0 + fi +fi + for certificate in $( find -L /srv/*/config/ssl/current -name 'ssl.crt' -print ); do certpath="$( echo $certificate | sed 's|/config/ssl/current/.*$|/config/ssl/current|' )" # Ensure there is a matching key file, and the path doesnt include an underscore @@ -39,10 +56,10 @@ fi # Move the new config into place, make it and start it up mv /dev/shm/sympl-mail-dovecot-sni.config /etc/dovecot/sympl.d/10-main/60-sni cd /etc/dovecot -sudo make test +make test -sudo make > /dev/null -sudo /usr/sbin/service dovecot reload +make > /dev/null +/usr/sbin/service dovecot reload if [ -f /dev/shm/sympl-mail-dovecot-sni.data ]; then rm /dev/shm/sympl-mail-dovecot-sni.data; fi -- GitLab From b3273eb91a9517283a5bc107a31987f3dc8a78a3 Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Sat, 6 Jul 2019 18:45:24 +0100 Subject: [PATCH 06/24] Update sympl-mail-dovecot-sni --- mail/sbin/sympl-mail-dovecot-sni | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mail/sbin/sympl-mail-dovecot-sni b/mail/sbin/sympl-mail-dovecot-sni index 0299a279..09a23f77 100755 --- a/mail/sbin/sympl-mail-dovecot-sni +++ b/mail/sbin/sympl-mail-dovecot-sni @@ -9,8 +9,8 @@ if [ ! -L /srv/*/config/ssl/current ]; then rm /etc/dovecot/sympl.d/10-main/60-sni # then rebuild the configuration cd /etc/dovecot - make test - make > /dev/null + /usr/bin/make test + /usr/bin/make > /dev/null /usr/sbin/service dovecot reload exit 0 else @@ -56,9 +56,8 @@ fi # Move the new config into place, make it and start it up mv /dev/shm/sympl-mail-dovecot-sni.config /etc/dovecot/sympl.d/10-main/60-sni cd /etc/dovecot -make test - -make > /dev/null +/usr/bin/make test +/usr/bin/make > /dev/null /usr/sbin/service dovecot reload if [ -f /dev/shm/sympl-mail-dovecot-sni.data ]; then rm /dev/shm/sympl-mail-dovecot-sni.data; fi -- GitLab From e549d923b48be9681702e291bd64762fbc0f1597 Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Sat, 6 Jul 2019 18:47:34 +0100 Subject: [PATCH 07/24] Update changelog --- mail/debian/changelog | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mail/debian/changelog b/mail/debian/changelog index 612a4ba4..b70dd1ce 100644 --- a/mail/debian/changelog +++ b/mail/debian/changelog @@ -1,4 +1,11 @@ -sympl-mail (10.0.190702.1) stable; urgency=medium +sympl-mail (10.0.190706.0) stable; urgency=medium + + * Updated sympl-mail-dovecot-sni for edge cases + * Improved sympl-mail ssl-hook + + -- Paul Cammish Sun, 06 Jul 2019 18:51:42 +0100 + + sympl-mail (10.0.190702.1) stable; urgency=medium * Adjusted exim config group -- GitLab From e284d04b96ce891ea1f5f746942da6d7d83c3102 Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Sat, 6 Jul 2019 19:00:55 +0100 Subject: [PATCH 08/24] Update sympl-mail-dovecot-sni --- mail/sbin/sympl-mail-dovecot-sni | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mail/sbin/sympl-mail-dovecot-sni b/mail/sbin/sympl-mail-dovecot-sni index 09a23f77..88859970 100755 --- a/mail/sbin/sympl-mail-dovecot-sni +++ b/mail/sbin/sympl-mail-dovecot-sni @@ -9,9 +9,9 @@ if [ ! -L /srv/*/config/ssl/current ]; then rm /etc/dovecot/sympl.d/10-main/60-sni # then rebuild the configuration cd /etc/dovecot - /usr/bin/make test - /usr/bin/make > /dev/null - /usr/sbin/service dovecot reload + sudo /usr/bin/make test + sudo /usr/bin/make > /dev/null + sudo /usr/sbin/service dovecot reload exit 0 else # Nothing to do yet, so just exit. @@ -56,9 +56,9 @@ fi # Move the new config into place, make it and start it up mv /dev/shm/sympl-mail-dovecot-sni.config /etc/dovecot/sympl.d/10-main/60-sni cd /etc/dovecot -/usr/bin/make test -/usr/bin/make > /dev/null -/usr/sbin/service dovecot reload +sudo /usr/bin/make test +sudo /usr/bin/make > /dev/null +sudo /usr/sbin/service dovecot reload if [ -f /dev/shm/sympl-mail-dovecot-sni.data ]; then rm /dev/shm/sympl-mail-dovecot-sni.data; fi -- GitLab From 78b0eee6c40f8e22a3d721cb6f20f942941794fb Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Sat, 6 Jul 2019 19:36:42 +0100 Subject: [PATCH 09/24] Update sympl-mail-dovecot-sni --- mail/sbin/sympl-mail-dovecot-sni | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/mail/sbin/sympl-mail-dovecot-sni b/mail/sbin/sympl-mail-dovecot-sni index 88859970..7f332e62 100755 --- a/mail/sbin/sympl-mail-dovecot-sni +++ b/mail/sbin/sympl-mail-dovecot-sni @@ -7,11 +7,13 @@ if [ ! -L /srv/*/config/ssl/current ]; then if [ -f /etc/dovecot/sympl.d/10-main/60-sni ]; then # it exists, so remove it rm /etc/dovecot/sympl.d/10-main/60-sni - # then rebuild the configuration - cd /etc/dovecot - sudo /usr/bin/make test - sudo /usr/bin/make > /dev/null - sudo /usr/sbin/service dovecot reload + # then rebuild the configuration if theres a Makefile (ie: sympl-mail is installed) + if [ -f /etc/dovecot/Makefile ]; then + cd /etc/dovecot + sudo /usr/bin/make test + sudo /usr/bin/make > /dev/null + sudo /usr/sbin/service dovecot reload + fi exit 0 else # Nothing to do yet, so just exit. @@ -53,12 +55,16 @@ if [ -f "/etc/dovecot/sympl.d/10-main/60-sni" ]; then fi fi -# Move the new config into place, make it and start it up +# Move the new config into place... mv /dev/shm/sympl-mail-dovecot-sni.config /etc/dovecot/sympl.d/10-main/60-sni -cd /etc/dovecot -sudo /usr/bin/make test -sudo /usr/bin/make > /dev/null -sudo /usr/sbin/service dovecot reload + +# ... and build the new config if the Makefile is in place. +if [ -f /etc/dovecot/Makefile ]; then + cd /etc/dovecot + sudo /usr/bin/make test + sudo /usr/bin/make > /dev/null + sudo /usr/sbin/service dovecot reload +fi if [ -f /dev/shm/sympl-mail-dovecot-sni.data ]; then rm /dev/shm/sympl-mail-dovecot-sni.data; fi -- GitLab From eb58235452d000defd3aeac2aa3633b3c96fc3c2 Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Fri, 5 Jul 2019 00:47:25 +0100 Subject: [PATCH 10/24] Update sympl-mail-dovecot-sni to always reload doevcot --- mail/sbin/sympl-mail-dovecot-sni | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mail/sbin/sympl-mail-dovecot-sni b/mail/sbin/sympl-mail-dovecot-sni index 67befcf6..11467540 100755 --- a/mail/sbin/sympl-mail-dovecot-sni +++ b/mail/sbin/sympl-mail-dovecot-sni @@ -31,6 +31,7 @@ done >> /dev/shm/sympl-mail-dovecot-sni.config # Compare it with what's there already. if [ -f "/etc/dovecot/sympl.d/10-main/60-sni" ]; then if diff /dev/shm/sympl-mail-dovecot-sni.config /etc/dovecot/sympl.d/10-main/60-sni > /dev/null ; then + /usr/sbin/service dovecot reload # Config has not changed, exiting. exit 0 fi @@ -39,10 +40,10 @@ fi # Move the new config into place, make it and start it up mv /dev/shm/sympl-mail-dovecot-sni.config /etc/dovecot/sympl.d/10-main/60-sni cd /etc/dovecot -sudo make test +make test -sudo make > /dev/null -sudo /usr/sbin/service dovecot reload +make > /dev/null +/usr/sbin/service dovecot reload if [ -f /dev/shm/sympl-mail-dovecot-sni.data ]; then rm /dev/shm/sympl-mail-dovecot-sni.data; fi -- GitLab From 0e97343a504b588a269d17ee4f64195fd7d57115 Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Fri, 5 Jul 2019 00:48:30 +0100 Subject: [PATCH 11/24] Update sympl-mail --- mail/sympl/ssl-hooks.d/sympl-mail | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mail/sympl/ssl-hooks.d/sympl-mail b/mail/sympl/ssl-hooks.d/sympl-mail index fc25abf4..1c9e08e6 100755 --- a/mail/sympl/ssl-hooks.d/sympl-mail +++ b/mail/sympl/ssl-hooks.d/sympl-mail @@ -8,4 +8,5 @@ fi # # Rebuild Dovecot SNI Certificates and reload on cert change. # -sudo /usr/sbin/sympl-mail-dovecot-sni +/usr/sbin/sympl-mail-dovecot-sni +/usr/sbin/service dovecot reload \ No newline at end of file -- GitLab From c0d25c0caf0657f9ffd998d0f2d18dd68a0f1e04 Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Fri, 5 Jul 2019 00:49:03 +0100 Subject: [PATCH 12/24] Revert "Update sympl-mail-dovecot-sni to always reload doevcot" This reverts commit f38436a8de31b613c5a78ebe93b39c28a2508540 --- mail/sbin/sympl-mail-dovecot-sni | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mail/sbin/sympl-mail-dovecot-sni b/mail/sbin/sympl-mail-dovecot-sni index 11467540..67befcf6 100755 --- a/mail/sbin/sympl-mail-dovecot-sni +++ b/mail/sbin/sympl-mail-dovecot-sni @@ -31,7 +31,6 @@ done >> /dev/shm/sympl-mail-dovecot-sni.config # Compare it with what's there already. if [ -f "/etc/dovecot/sympl.d/10-main/60-sni" ]; then if diff /dev/shm/sympl-mail-dovecot-sni.config /etc/dovecot/sympl.d/10-main/60-sni > /dev/null ; then - /usr/sbin/service dovecot reload # Config has not changed, exiting. exit 0 fi @@ -40,10 +39,10 @@ fi # Move the new config into place, make it and start it up mv /dev/shm/sympl-mail-dovecot-sni.config /etc/dovecot/sympl.d/10-main/60-sni cd /etc/dovecot -make test +sudo make test -make > /dev/null -/usr/sbin/service dovecot reload +sudo make > /dev/null +sudo /usr/sbin/service dovecot reload if [ -f /dev/shm/sympl-mail-dovecot-sni.data ]; then rm /dev/shm/sympl-mail-dovecot-sni.data; fi -- GitLab From e905e83e6090892116fa6f888c79778872854473 Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Sat, 6 Jul 2019 16:19:38 +0100 Subject: [PATCH 13/24] Remove SNI config file when uninstalling --- mail/debian/prerm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/mail/debian/prerm b/mail/debian/prerm index 4d02900f..5bed295c 100755 --- a/mail/debian/prerm +++ b/mail/debian/prerm @@ -16,13 +16,20 @@ if echo "ae779d6822f91492b26697d6b9931835 /etc/default/clamav-daemon" | md5sum rm -f /etc/default/clamav-daemon fi -# -# Remove the old diversion +# +# Remove the old Dovecot SNI config if it exists +# +if [ -f /etc/dovecot/sympl.d/10-main/60-sni ]; then + rm /etc/dovecot/sympl.d/10-main/60-sni +fi + +# +# Remove the old diversion # package="sympl-mail" conf="/etc/dovecot/dovecot.conf" -# +# # Dovecot ships with its own config. # package="sympl-mail" @@ -46,5 +53,6 @@ if dpkg-divert --list "$package" | grep -xFq "diversion of $conf to $theirfile b fi + #DEBHELPER# exit 0 -- GitLab From 8864a9b347521f2d28b91f4967bba1214973799d Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Sat, 6 Jul 2019 16:19:51 +0100 Subject: [PATCH 14/24] Only run if there are certs available --- mail/sbin/sympl-mail-dovecot-sni | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/mail/sbin/sympl-mail-dovecot-sni b/mail/sbin/sympl-mail-dovecot-sni index 67befcf6..0299a279 100755 --- a/mail/sbin/sympl-mail-dovecot-sni +++ b/mail/sbin/sympl-mail-dovecot-sni @@ -2,6 +2,23 @@ set -e +if [ ! -L /srv/*/config/ssl/current ]; then + # No certs avaialable, so check if /etc/dovecot/sympl.d/10-main/60-sni exists + if [ -f /etc/dovecot/sympl.d/10-main/60-sni ]; then + # it exists, so remove it + rm /etc/dovecot/sympl.d/10-main/60-sni + # then rebuild the configuration + cd /etc/dovecot + make test + make > /dev/null + /usr/sbin/service dovecot reload + exit 0 + else + # Nothing to do yet, so just exit. + exit 0 + fi +fi + for certificate in $( find -L /srv/*/config/ssl/current -name 'ssl.crt' -print ); do certpath="$( echo $certificate | sed 's|/config/ssl/current/.*$|/config/ssl/current|' )" # Ensure there is a matching key file, and the path doesnt include an underscore @@ -39,10 +56,10 @@ fi # Move the new config into place, make it and start it up mv /dev/shm/sympl-mail-dovecot-sni.config /etc/dovecot/sympl.d/10-main/60-sni cd /etc/dovecot -sudo make test +make test -sudo make > /dev/null -sudo /usr/sbin/service dovecot reload +make > /dev/null +/usr/sbin/service dovecot reload if [ -f /dev/shm/sympl-mail-dovecot-sni.data ]; then rm /dev/shm/sympl-mail-dovecot-sni.data; fi -- GitLab From 5d4e899f106565a80f27b3738c0093f8b165f38c Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Sat, 6 Jul 2019 18:45:24 +0100 Subject: [PATCH 15/24] Update sympl-mail-dovecot-sni --- mail/sbin/sympl-mail-dovecot-sni | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mail/sbin/sympl-mail-dovecot-sni b/mail/sbin/sympl-mail-dovecot-sni index 0299a279..09a23f77 100755 --- a/mail/sbin/sympl-mail-dovecot-sni +++ b/mail/sbin/sympl-mail-dovecot-sni @@ -9,8 +9,8 @@ if [ ! -L /srv/*/config/ssl/current ]; then rm /etc/dovecot/sympl.d/10-main/60-sni # then rebuild the configuration cd /etc/dovecot - make test - make > /dev/null + /usr/bin/make test + /usr/bin/make > /dev/null /usr/sbin/service dovecot reload exit 0 else @@ -56,9 +56,8 @@ fi # Move the new config into place, make it and start it up mv /dev/shm/sympl-mail-dovecot-sni.config /etc/dovecot/sympl.d/10-main/60-sni cd /etc/dovecot -make test - -make > /dev/null +/usr/bin/make test +/usr/bin/make > /dev/null /usr/sbin/service dovecot reload if [ -f /dev/shm/sympl-mail-dovecot-sni.data ]; then rm /dev/shm/sympl-mail-dovecot-sni.data; fi -- GitLab From 7d4f0bdce35289ba14744544e9548879fd862b17 Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Sat, 6 Jul 2019 18:47:34 +0100 Subject: [PATCH 16/24] Update changelog --- mail/debian/changelog | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mail/debian/changelog b/mail/debian/changelog index 612a4ba4..b70dd1ce 100644 --- a/mail/debian/changelog +++ b/mail/debian/changelog @@ -1,4 +1,11 @@ -sympl-mail (10.0.190702.1) stable; urgency=medium +sympl-mail (10.0.190706.0) stable; urgency=medium + + * Updated sympl-mail-dovecot-sni for edge cases + * Improved sympl-mail ssl-hook + + -- Paul Cammish Sun, 06 Jul 2019 18:51:42 +0100 + + sympl-mail (10.0.190702.1) stable; urgency=medium * Adjusted exim config group -- GitLab From 01a0535bae742dbafde2541998038bfe50ea1f1b Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Sat, 6 Jul 2019 19:00:55 +0100 Subject: [PATCH 17/24] Update sympl-mail-dovecot-sni --- mail/sbin/sympl-mail-dovecot-sni | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mail/sbin/sympl-mail-dovecot-sni b/mail/sbin/sympl-mail-dovecot-sni index 09a23f77..88859970 100755 --- a/mail/sbin/sympl-mail-dovecot-sni +++ b/mail/sbin/sympl-mail-dovecot-sni @@ -9,9 +9,9 @@ if [ ! -L /srv/*/config/ssl/current ]; then rm /etc/dovecot/sympl.d/10-main/60-sni # then rebuild the configuration cd /etc/dovecot - /usr/bin/make test - /usr/bin/make > /dev/null - /usr/sbin/service dovecot reload + sudo /usr/bin/make test + sudo /usr/bin/make > /dev/null + sudo /usr/sbin/service dovecot reload exit 0 else # Nothing to do yet, so just exit. @@ -56,9 +56,9 @@ fi # Move the new config into place, make it and start it up mv /dev/shm/sympl-mail-dovecot-sni.config /etc/dovecot/sympl.d/10-main/60-sni cd /etc/dovecot -/usr/bin/make test -/usr/bin/make > /dev/null -/usr/sbin/service dovecot reload +sudo /usr/bin/make test +sudo /usr/bin/make > /dev/null +sudo /usr/sbin/service dovecot reload if [ -f /dev/shm/sympl-mail-dovecot-sni.data ]; then rm /dev/shm/sympl-mail-dovecot-sni.data; fi -- GitLab From c704e3451a26d125338f6f55fd496b84ba6b8e1f Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Sat, 6 Jul 2019 19:36:42 +0100 Subject: [PATCH 18/24] Update sympl-mail-dovecot-sni --- mail/sbin/sympl-mail-dovecot-sni | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/mail/sbin/sympl-mail-dovecot-sni b/mail/sbin/sympl-mail-dovecot-sni index 88859970..7f332e62 100755 --- a/mail/sbin/sympl-mail-dovecot-sni +++ b/mail/sbin/sympl-mail-dovecot-sni @@ -7,11 +7,13 @@ if [ ! -L /srv/*/config/ssl/current ]; then if [ -f /etc/dovecot/sympl.d/10-main/60-sni ]; then # it exists, so remove it rm /etc/dovecot/sympl.d/10-main/60-sni - # then rebuild the configuration - cd /etc/dovecot - sudo /usr/bin/make test - sudo /usr/bin/make > /dev/null - sudo /usr/sbin/service dovecot reload + # then rebuild the configuration if theres a Makefile (ie: sympl-mail is installed) + if [ -f /etc/dovecot/Makefile ]; then + cd /etc/dovecot + sudo /usr/bin/make test + sudo /usr/bin/make > /dev/null + sudo /usr/sbin/service dovecot reload + fi exit 0 else # Nothing to do yet, so just exit. @@ -53,12 +55,16 @@ if [ -f "/etc/dovecot/sympl.d/10-main/60-sni" ]; then fi fi -# Move the new config into place, make it and start it up +# Move the new config into place... mv /dev/shm/sympl-mail-dovecot-sni.config /etc/dovecot/sympl.d/10-main/60-sni -cd /etc/dovecot -sudo /usr/bin/make test -sudo /usr/bin/make > /dev/null -sudo /usr/sbin/service dovecot reload + +# ... and build the new config if the Makefile is in place. +if [ -f /etc/dovecot/Makefile ]; then + cd /etc/dovecot + sudo /usr/bin/make test + sudo /usr/bin/make > /dev/null + sudo /usr/sbin/service dovecot reload +fi if [ -f /dev/shm/sympl-mail-dovecot-sni.data ]; then rm /dev/shm/sympl-mail-dovecot-sni.data; fi -- GitLab From 489460f071dfe86e8acaa758b3e6cc851e016758 Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Sat, 6 Jul 2019 21:16:27 +0100 Subject: [PATCH 19/24] Fixed race condition bug --- mail/sbin/sympl-mail-dovecot-sni | 6 +++--- mail/sympl/ssl-hooks.d/sympl-mail | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mail/sbin/sympl-mail-dovecot-sni b/mail/sbin/sympl-mail-dovecot-sni index 7f332e62..6f67ed89 100755 --- a/mail/sbin/sympl-mail-dovecot-sni +++ b/mail/sbin/sympl-mail-dovecot-sni @@ -12,7 +12,7 @@ if [ ! -L /srv/*/config/ssl/current ]; then cd /etc/dovecot sudo /usr/bin/make test sudo /usr/bin/make > /dev/null - sudo /usr/sbin/service dovecot reload + sudo /usr/sbin/service dovecot reload > /dev/null 2>&1 | true fi exit 0 else @@ -50,7 +50,7 @@ done >> /dev/shm/sympl-mail-dovecot-sni.config # Compare it with what's there already. if [ -f "/etc/dovecot/sympl.d/10-main/60-sni" ]; then if diff /dev/shm/sympl-mail-dovecot-sni.config /etc/dovecot/sympl.d/10-main/60-sni > /dev/null ; then - # Config has not changed, exiting. + # Config hasnt changed, so just exit. exit 0 fi fi @@ -63,7 +63,7 @@ if [ -f /etc/dovecot/Makefile ]; then cd /etc/dovecot sudo /usr/bin/make test sudo /usr/bin/make > /dev/null - sudo /usr/sbin/service dovecot reload + sudo /usr/sbin/service dovecot reload > /dev/null 2>&1 | true fi if [ -f /dev/shm/sympl-mail-dovecot-sni.data ]; then rm /dev/shm/sympl-mail-dovecot-sni.data; fi diff --git a/mail/sympl/ssl-hooks.d/sympl-mail b/mail/sympl/ssl-hooks.d/sympl-mail index 1c9e08e6..0b285fd0 100755 --- a/mail/sympl/ssl-hooks.d/sympl-mail +++ b/mail/sympl/ssl-hooks.d/sympl-mail @@ -1,12 +1,12 @@ -#!/bin/bash -eu +#!/bin/bash -if ! [ "$1" = "live-update" ] ; then - echo "I: $0: Ignoring unknown hook action $1" +if ! [ "x$1" = "xlive-update" ] ; then + echo "I: $0: Ignoring unknown hook action '$1'" exit 0 fi # -# Rebuild Dovecot SNI Certificates and reload on cert change. +# Rebuild Dovecot SNI Certificates and reload config. # /usr/sbin/sympl-mail-dovecot-sni -/usr/sbin/service dovecot reload \ No newline at end of file +/usr/sbin/service dovecot reload > /dev/null 2>&1 | true -- GitLab From 25b89d2fad7d389954e6ea82ad3cb8d50d6097d3 Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Sat, 6 Jul 2019 21:26:38 +0100 Subject: [PATCH 20/24] Update changelog --- mail/debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mail/debian/changelog b/mail/debian/changelog index b70dd1ce..9e25a812 100644 --- a/mail/debian/changelog +++ b/mail/debian/changelog @@ -1,3 +1,9 @@ +sympl-mail (10.0.190706.1) stable; urgency=medium + + * Resolved potential race condition + + -- Paul Cammish Sun, 06 Jul 2019 21:26:12 +0100 + sympl-mail (10.0.190706.0) stable; urgency=medium * Updated sympl-mail-dovecot-sni for edge cases -- GitLab From 81af05c73fe5389e7fedbe83a20bfa7dfc6efdaf Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Sun, 7 Jul 2019 16:28:16 +0100 Subject: [PATCH 21/24] Significantly Improved CI --- .gitlab-ci.yml | 140 +++++++----------- .../conf-available/sympl-phpmyadmin.conf | 0 .../phpmyadmin}/debian/changelog | 0 .../phpmyadmin}/debian/compat | 0 .../phpmyadmin}/debian/control | 0 .../phpmyadmin}/debian/copyright | 0 .../phpmyadmin}/debian/install | 0 .../phpmyadmin}/debian/postinst | 0 .../phpmyadmin}/debian/preinst | 0 .../phpmyadmin}/debian/prerm | 0 .../phpmyadmin}/debian/rules | 0 .../phpmyadmin}/debian/source/format | 0 .../patterns.d/phpmyadmin-suhosin.patterns | 0 .../phpmyadmin/config.sympl.inc.php | 0 .../phpmyadmin}/test.d/tc_phpmyadmin.rb | 0 autotest/change-hostname | 9 ++ autotest/get_previous_versions | 65 -------- autotest/install_then_upgrade | 89 +++++++++++ autotest/test.d/01-setup | 1 + autotest/test.d/91-manual | 2 +- 20 files changed, 155 insertions(+), 151 deletions(-) rename {phpmyadmin => .retired/phpmyadmin}/apache2/conf-available/sympl-phpmyadmin.conf (100%) rename {phpmyadmin => .retired/phpmyadmin}/debian/changelog (100%) rename {phpmyadmin => .retired/phpmyadmin}/debian/compat (100%) rename {phpmyadmin => .retired/phpmyadmin}/debian/control (100%) rename {phpmyadmin => .retired/phpmyadmin}/debian/copyright (100%) rename {phpmyadmin => .retired/phpmyadmin}/debian/install (100%) rename {phpmyadmin => .retired/phpmyadmin}/debian/postinst (100%) rename {phpmyadmin => .retired/phpmyadmin}/debian/preinst (100%) rename {phpmyadmin => .retired/phpmyadmin}/debian/prerm (100%) rename {phpmyadmin => .retired/phpmyadmin}/debian/rules (100%) rename {phpmyadmin => .retired/phpmyadmin}/debian/source/format (100%) rename {phpmyadmin => .retired/phpmyadmin}/patterns.d/phpmyadmin-suhosin.patterns (100%) rename {phpmyadmin => .retired/phpmyadmin}/phpmyadmin/config.sympl.inc.php (100%) rename {phpmyadmin => .retired/phpmyadmin}/test.d/tc_phpmyadmin.rb (100%) create mode 100755 autotest/change-hostname delete mode 100755 autotest/get_previous_versions create mode 100755 autotest/install_then_upgrade diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index eaf7ad73..9e15b870 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,8 @@ stages: - - package - - publish - - install + - Package + - Publish + - Install + - Upgrade # This will run through the packages one at a time, building them into artifacts # This uses the kelduum/sympl-build:v1 docker image, which is Debian Stretch with @@ -11,13 +12,13 @@ stages: tags: - docker image: kelduum/sympl-build-buster:v1 - stage: package + stage: Package script: - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections - apt-get update && apt-get install -q -yy gitlab-runner rake devscripts rdoc graphviz ruby-dev gem2deb txt2man dh-systemd apache2-dev libcap-dev php7.3-common dh-golang golang-go - - export PACKAGE=${CI_BUILD_NAME##package:} + - export PACKAGE=${CI_BUILD_NAME#sympl-} - git describe --all - - echo "$CI_BUILD_NAME" - "$PACKAGE" - "${CI_BUILD_NAME##package:}" + - echo "Building '$CI_BUILD_NAME' in directory '$PACKAGE'" - cd $PACKAGE - dpkg-buildpackage --no-sign --build=full - cd .. @@ -26,46 +27,46 @@ stages: artifacts: paths: - deb/ - expire_in: 4 days + expire_in: 1 day # List of packages to build -package:core: +sympl-core: <<: *package -package:backup: +sympl-backup: <<: *package -package:cron: +sympl-cron: <<: *package -package:dns: +sympl-dns: <<: *package -package:mail: +sympl-mail: <<: *package -package:firewall: +sympl-firewall: <<: *package -package:ftp: +sympl-ftp: <<: *package -package:web: +sympl-web: <<: *package -package:monit: +sympl-monit: <<: *package -package:mysql: +sympl-mysql: <<: *package -package:phpmyadmin: +#sympl-phpmyadmin: +# <<: *package +sympl-updater: <<: *package -package:updater: +sympl-webmail: <<: *package -package:webmail: - <<: *package - + # This builds the debian packages and drops them in a very simple local repo # so they can be installed during the next (install) step. # Again, it uses the kelduum/sympl-build docker image with the relevant tools pre-installed -publish: +Build Repo: tags: - docker image: kelduum/sympl-build-buster:v1 - stage: publish + stage: Publish script: - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections - apt-get update && apt-get install -q -yy dpkg-dev git @@ -73,116 +74,85 @@ publish: - dpkg-scanpackages deb > deb/Packages - gzip -k deb/Packages - echo '## Building repo...' - - mkdir -p repo/pool/main/s repo/pool/main/l repo/dists/buster/main/binary-amd64 + - mkdir -p repo/pool/main/s repo/pool/main/l repo/dists/local/main/binary-amd64 - cp deb/s*.deb repo/pool/main/s - cp deb/l*.deb repo/pool/main/l - cd repo - - dpkg-scanpackages -m pool | gzip > dists/buster/main/binary-amd64/Packages.gz - - dpkg-scanpackages -m pool > dists/buster/main/binary-amd64/Packages + - dpkg-scanpackages -m pool | gzip > dists/local/main/binary-amd64/Packages.gz + - dpkg-scanpackages -m pool > dists/local/main/binary-amd64/Packages artifacts: paths: - deb/* - repo/* - expire_in: 1 month + expire_in: 1 day -# This stage runs on a VM running VirtualBox 5, which the gitlab-runner controls. -# The vbox:buster image is a pre-installed minimal copy of Debian Stretch. -# -# Clean is a minimal install, where quick has all of the pre-reqs installed, -# other than unattended-upgrades as it tries to run at reboot. +# The next two stages runs on a VM running VirtualBox 5, which the gitlab-runner controls. +# The image is a pre-installed minimal copy of Debian, ideally with the dependencies pre +# downloaded. -install:quick: +Clean Install: tags: - - vbox:buster-quick - stage: install - allow_failure: false + - vbox:buster + stage: Install script: + - chmod -x $( which gitlab-runner ) - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections - git describe --all - - chmod -x $( which gitlab-runner ) - - hostname -b quick.sympl.test ; hostname > /etc/hostname ; HOSTNAME=$(hostname) ; sed -i -n '/^127\.0\.0\.1/!p' /etc/hosts ; echo -e "127.0.0.1\t$(hostname) $(hostname -s) localhost" >> /etc/hosts + - apt-get -qq update; apt-get -qq -y upgrade - cp -r repo/ / - chmod -R 664 /repo ; chmod -R +X /repo - - echo "deb [trusted=yes] file:/repo buster main" > /etc/apt/sources.list.d/local.list + - echo "deb [trusted=yes] file:/repo local main" > /etc/apt/sources.list.d/local.list - apt-get -qq update - apt-get -y --allow-unauthenticated install --install-recommends sympl-core - run-parts --verbose --exit-on-error autotest/test.d - hostname - dpkg -l 'sympl*' -# allow_failure: true -# when: manual variables: CI_DEBUG_TRACE: "false" + allow_failure: false + when: always artifacts: paths: - repo/* - expire_in: 4 days + expire_in: 1 hour - -install:clean: +Upgrade Testing: tags: - vbox:buster - stage: install - allow_failure: false + stage: Upgrade script: - - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections - - git describe --all - chmod -x $( which gitlab-runner ) - - hostname -b clean.sympl.test ; hostname > /etc/hostname ; HOSTNAME=$(hostname) ; sed -i -n '/^127\.0\.0\.1/!p' /etc/hosts ; echo -e "127.0.0.1\t$(hostname) $(hostname -s) localhost" >> /etc/hosts - - apt-get -qq update; apt-get -qq -y upgrade - - cp -r repo/ / - - chmod -R 664 /repo ; chmod -R +X /repo - - echo "deb [trusted=yes] file:/repo buster main" > /etc/apt/sources.list.d/local.list - - apt-get -qq update || true - - apt-get -y --allow-unauthenticated install --install-recommends sympl-core + - git describe --all + - autotest/install_then_upgrade buster-testing - run-parts --verbose --exit-on-error autotest/test.d - hostname - dpkg -l 'sympl*' + allow_failure: false variables: CI_DEBUG_TRACE: "false" -# allow_failure: true -# when: manual artifacts: paths: - repo/* - expire_in: 4 days - + expire_in: 1 hour -install:upgrade: +Upgrade Stable: tags: - vbox:buster - stage: install - allow_failure: false + stage: Upgrade script: - - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections - - git describe --all - chmod -x $( which gitlab-runner ) - - hostname -b upgrade.sympl.test ; hostname > /etc/hostname ; HOSTNAME=$(hostname) ; sed -i -n '/^127\.0\.0\.1/!p' /etc/hosts ; echo -e "127.0.0.1\t$(hostname) $(hostname -s) localhost" >> /etc/hosts - - apt-get -qq update; apt-get -qq -y upgrade - - wget -qO- http://mirror.mythic-beasts.com/mythic/support@mythic-beasts.com.gpg.key | apt-key add - - - echo deb http://packages.mythic-beasts.com/mythic/ buster-testing main > /etc/apt/sources.list.d/sympl_mythic-beasts.list - - apt-get -qq update - - apt-get -qq install $( autotest/get_previous_versions buster-testing ) - - dpkg -l 'sympl-*' | grep '^ii' | awk '{ print $2 " " $3 }' | sort > pre-upgrade - - cp -r repo/ / - - chmod -R 664 /repo ; chmod -R +X /repo - - echo "deb [trusted=yes] file:/repo buster main" > /etc/apt/sources.list.d/local.list - - apt-get -qq update || true - - apt-get -y --allow-unauthenticated --with-new-pkgs upgrade - - apt-get -y autoremove - - dpkg -l 'sympl-*' | grep '^ii' | awk '{ print $2 " " $3 }' | sort > post-upgrade - - autotest/checkupgrade + - git describe --all + - autotest/install_then_upgrade buster - run-parts --verbose --exit-on-error autotest/test.d - hostname - dpkg -l 'sympl*' - allow_failure: true - # when: manual + allow_failure: false + when: delayed + start_in: 5 minutes variables: CI_DEBUG_TRACE: "false" artifacts: paths: - repo/* - expire_in: 4 days - - + expire_in: 1 hour diff --git a/phpmyadmin/apache2/conf-available/sympl-phpmyadmin.conf b/.retired/phpmyadmin/apache2/conf-available/sympl-phpmyadmin.conf similarity index 100% rename from phpmyadmin/apache2/conf-available/sympl-phpmyadmin.conf rename to .retired/phpmyadmin/apache2/conf-available/sympl-phpmyadmin.conf diff --git a/phpmyadmin/debian/changelog b/.retired/phpmyadmin/debian/changelog similarity index 100% rename from phpmyadmin/debian/changelog rename to .retired/phpmyadmin/debian/changelog diff --git a/phpmyadmin/debian/compat b/.retired/phpmyadmin/debian/compat similarity index 100% rename from phpmyadmin/debian/compat rename to .retired/phpmyadmin/debian/compat diff --git a/phpmyadmin/debian/control b/.retired/phpmyadmin/debian/control similarity index 100% rename from phpmyadmin/debian/control rename to .retired/phpmyadmin/debian/control diff --git a/phpmyadmin/debian/copyright b/.retired/phpmyadmin/debian/copyright similarity index 100% rename from phpmyadmin/debian/copyright rename to .retired/phpmyadmin/debian/copyright diff --git a/phpmyadmin/debian/install b/.retired/phpmyadmin/debian/install similarity index 100% rename from phpmyadmin/debian/install rename to .retired/phpmyadmin/debian/install diff --git a/phpmyadmin/debian/postinst b/.retired/phpmyadmin/debian/postinst similarity index 100% rename from phpmyadmin/debian/postinst rename to .retired/phpmyadmin/debian/postinst diff --git a/phpmyadmin/debian/preinst b/.retired/phpmyadmin/debian/preinst similarity index 100% rename from phpmyadmin/debian/preinst rename to .retired/phpmyadmin/debian/preinst diff --git a/phpmyadmin/debian/prerm b/.retired/phpmyadmin/debian/prerm similarity index 100% rename from phpmyadmin/debian/prerm rename to .retired/phpmyadmin/debian/prerm diff --git a/phpmyadmin/debian/rules b/.retired/phpmyadmin/debian/rules similarity index 100% rename from phpmyadmin/debian/rules rename to .retired/phpmyadmin/debian/rules diff --git a/phpmyadmin/debian/source/format b/.retired/phpmyadmin/debian/source/format similarity index 100% rename from phpmyadmin/debian/source/format rename to .retired/phpmyadmin/debian/source/format diff --git a/phpmyadmin/patterns.d/phpmyadmin-suhosin.patterns b/.retired/phpmyadmin/patterns.d/phpmyadmin-suhosin.patterns similarity index 100% rename from phpmyadmin/patterns.d/phpmyadmin-suhosin.patterns rename to .retired/phpmyadmin/patterns.d/phpmyadmin-suhosin.patterns diff --git a/phpmyadmin/phpmyadmin/config.sympl.inc.php b/.retired/phpmyadmin/phpmyadmin/config.sympl.inc.php similarity index 100% rename from phpmyadmin/phpmyadmin/config.sympl.inc.php rename to .retired/phpmyadmin/phpmyadmin/config.sympl.inc.php diff --git a/phpmyadmin/test.d/tc_phpmyadmin.rb b/.retired/phpmyadmin/test.d/tc_phpmyadmin.rb similarity index 100% rename from phpmyadmin/test.d/tc_phpmyadmin.rb rename to .retired/phpmyadmin/test.d/tc_phpmyadmin.rb diff --git a/autotest/change-hostname b/autotest/change-hostname new file mode 100755 index 00000000..fd4ca0cc --- /dev/null +++ b/autotest/change-hostname @@ -0,0 +1,9 @@ +#!/bin/bash + +hostname -b $1 +hostname > /etc/hostname +export HOSTNAME=$(hostname) +sed -i -n '/^127\.0\.0\.1/!p' /etc/hosts +echo -e "127.0.0.1\t$(hostname) $(hostname -s) localhost" >> /etc/hosts +echo "Hostname set to $(hostname --fqdn)" + diff --git a/autotest/get_previous_versions b/autotest/get_previous_versions deleted file mode 100755 index 8cb6b9b6..00000000 --- a/autotest/get_previous_versions +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -# If we're not on master, then install the already public versions -if [[ ! $( git describe --all ) == *master ]] ; then - - echo "--install-recommends sympl-core" - -else - - if [ "$1" == "" ]; then - echo "Error: need a distro name, such as 'stretch-testing'" > /dev/stderr - exit 1 - fi - - # Get the current versions - head -n 1 ./*/debian/changelog | grep '^sympl' | sed -e 's|(||' -e 's|).*||' > .built - touch .install-ver - - # While we don't have a list - while [ "$( cat .install-ver | wc -l )" != "$( cat .built | wc -l )" ]; do - - # Sleep for a bit if it's not the first time - if [ -s .install-ver ]; then - sleep 10 - fi - - # Pull the list of packages - # Using £ is untidy, but means you don't have to use GNU sed - wget -q -O - "http://packages.mythic-beasts.com/mythic/dists/$1/main/source/Sources.gz" \ - | gunzip \ - | grep -A 2 '^Package: sympl' \ - | grep -v ^Binary \ - | sed -e 's|^Package: ||' -e 's|^Version: ||' \ - | tr '\n' ' ' \ - | sed -e 's| -- |£|g' \ - | tr '£' '\n' \ - > .packages - - # Get the newest version of each package, other than duplicates - cat .packages .built \ - | sort -r \ - | uniq -u \ - | awk '!seen[$1] { print $1 " " $2 } {++seen[$1]}' \ - > .install - - # Filter for only packages in the repo - rm .install-ver - for package in $( find . -type f -name 'changelog' | sed -e 's|^\./||' -e 's|/.*||' | tr '\n' ' ' ); do - grep "^sympl-${package} " .install >> .install-ver - done - - # Check for any versions to be installed which match the ones we built, force a retry if so - retry=false - cat .built | while read line; do - if [ $( grep -c "$line" .install-ver ) != 0 ]; then retry=true; fi - done - if [ $retry == true ]; then echo invalid > .install-ver ; fi - - done - -cat .install-ver | tr ' ' '=' | tr '\n' ' ' - -rm .install-ver .install .packages .built - -fi diff --git a/autotest/install_then_upgrade b/autotest/install_then_upgrade new file mode 100755 index 00000000..f20b2f40 --- /dev/null +++ b/autotest/install_then_upgrade @@ -0,0 +1,89 @@ +#!/bin/bash + +set -e + +if [ "x$1" == "x" ]; then + echo "Error: I need a repo name, such as 'stretch-testing'" > /dev/stderr + exit 1 +fi + +REPO=$1 + +head -n 1 ./*/debian/changelog | grep '^sympl' | sed -e 's|(||' -e 's|).*||' | sort > /tmp/local_versions + +wget -q -O - "http://packages.mythic-beasts.com/mythic/dists/$REPO/main/source/Sources.gz" \ + | gunzip \ + | grep -A 2 '^Package: sympl' \ + | grep -v ^Binary \ + | sed -e 's|^Package: ||' -e 's|^Version: ||' \ + | tr '\n' ' ' \ + | sed -e 's| -- |\n|g' \ + | sort -r \ + > /tmp/packages + +#echo local_versons +#cat /tmp/local_versions +#echo --- +#echo packages +#cat /tmp/packages + +cp /tmp/local_versions /tmp/from_repo + +cat /tmp/local_versions | while read PACKAGE LOCAL_VER ; do +# echo Checking for previous version of $PACKAGE $LOCAL_VER + if grep "^$PACKAGE " /tmp/packages > /tmp/check-package; then + LOCAL_VER_NUM="$( echo $LOCAL_VER | tr -d '.' )" + cat /tmp/check-package | while read skip REPO_VER ; do + REPO_VER_NUM="$( echo $REPO_VER | tr -d '.' )" + if [ $REPO_VER_NUM -lt $LOCAL_VER_NUM ]; then + sed -i "s|^$PACKAGE .*|$PACKAGE $REPO_VER|" /tmp/from_repo + break + # else + # echo skipping $REPO_VER + fi + done + else + sed -i "s|^$PACKAGE .*||" /tmp/from_repo + # echo new package: $PACKAGE + fi +done + +rm /tmp/check-package /tmp/packages + +#diff /tmp/from_repo /tmp/local_versions +echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections + +apt-get -qq update +apt-get -qq -y upgrade + +wget -qO- http://mirror.mythic-beasts.com/mythic/support@mythic-beasts.com.gpg.key | apt-key add - + +echo deb http://packages.mythic-beasts.com/mythic/ $REPO main > /etc/apt/sources.list.d/sympl_mythic-beasts.list + +cp -r repo/ / +chmod -R 664 /repo ; chmod -R +X /repo +echo "deb [trusted=yes] file:/repo local main" > /etc/apt/sources.list.d/local.list + +apt-get -qq update + +echo ---------- Installing ----------- +cat /tmp/from_repo | tr ' ' '\t' +echo --------------------------------- + +apt-get -q -y install --allow-unauthenticated --install-recommends $( cat /tmp/from_repo | tr ' ' '=' | tr '\n' ' ' ) + +rm /etc/apt/sources.list.d/sympl_mythic-beasts.list +apt-get -qq update + +echo ----------- Upgrading ----------- +diff /tmp/from_repo /tmp/local_versions | grep '^> ' | sed -e 's|> ||' | tr ' ' '\t' +echo --------------------------------- + +apt-get -q -y install --allow-unauthenticated --install-recommends $( diff /tmp/from_repo /tmp/local_versions | grep '^>' | sed -e 's|> ||' | tr ' ' '=' | tr '\n' ' ' ) + +apt-get -y autoremove + +dpkg -l 'sympl-*' | grep '^ii' | awk '{ print $2 " " $3 }' + +exit 0 + diff --git a/autotest/test.d/01-setup b/autotest/test.d/01-setup index 5bfc108e..fffb7db1 100755 --- a/autotest/test.d/01-setup +++ b/autotest/test.d/01-setup @@ -84,3 +84,4 @@ while [ `ps -ef | grep 'spamd child' | grep -v -c grep` -lt 2 ]; do done echo ' done.' + diff --git a/autotest/test.d/91-manual b/autotest/test.d/91-manual index 79d563e3..a3a9cfb6 100755 --- a/autotest/test.d/91-manual +++ b/autotest/test.d/91-manual @@ -4,6 +4,6 @@ errors=0 -for command in $(find /bin /sbin /usr/bin /usr/sbin -name 'symbiosis-*' | grep -v 'symbiosis-crontab$\|symbiosis-dns-generate$\|symbiosis-generate-dhparams$\|symbiosis-httpd-logger$'); do echo -ne "\nTesting '$command --manual'" ; $command --manual > /tmp/autotest_out 2>&1 ; if [ $? -ne 0 ]; then errors=$((errors+1)); echo ' FAIL'; cat /tmp/autotest_out; else echo ' OK'; fi ; done +for command in $(find /bin /sbin /usr/bin /usr/sbin -name 'symbiosis-*' | grep -v 'symbiosis-crontab$\|symbiosis-dns-generate$\|symbiosis-generate-dhparams$\|symbiosis-httpd-logger$'); do echo -ne "Testing '$command --manual'" ; $command --manual > /tmp/autotest_out 2>&1 ; if [ $? -ne 0 ]; then errors=$((errors+1)); echo ' FAIL'; cat /tmp/autotest_out; else echo ' OK'; fi ; done exit $errors -- GitLab From 03d03cdb11685757e8dae28e2c08b69090874e80 Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Sun, 7 Jul 2019 21:00:57 +0100 Subject: [PATCH 22/24] Fixed minor bug --- mail/debian/changelog | 16 +++++++++++----- mail/sbin/sympl-mail-dovecot-sni | 4 ++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/mail/debian/changelog b/mail/debian/changelog index 9e25a812..bc3b630f 100644 --- a/mail/debian/changelog +++ b/mail/debian/changelog @@ -1,9 +1,15 @@ +sympl-mail (10.0.190707.0) stable; urgency=medium + + * Fixed unhandled input + + -- Paul Cammish Sun, 07 Jul 2019 20:59:13 +0100 + sympl-mail (10.0.190706.1) stable; urgency=medium * Resolved potential race condition - -- Paul Cammish Sun, 06 Jul 2019 21:26:12 +0100 - + -- Paul Cammish Sat, 06 Jul 2019 21:26:12 +0100 + sympl-mail (10.0.190706.0) stable; urgency=medium * Updated sympl-mail-dovecot-sni for edge cases @@ -101,8 +107,8 @@ symbiosis-email (2018:0807) stable; urgency=medium symbiosis-email (2018:0615) stable; urgency=medium - * Set 'keep_environment' in Exim config. - * Only restart clamav in postinst when 'antivirus' file present. + * Set 'keep_environment' in Exim config. + * Only restart clamav in postinst when 'antivirus' file present. -- Andrew Ladlow Fri, 15 Jun 2018 13:15:08 +0100 @@ -143,7 +149,7 @@ symbiosis-email (2015:1218) oldstable; urgency=medium * Re-instate clamav tests that stop it if no domains are using anti-virus scanning. Closes #49. - * Fix path to binary in /etc/cron.d/symbiosis-email. Closes #72. + * Fix path to binary in /etc/cron.d/symbiosis-email. Closes #72. * Ensure manpages are built -- Patrick J Cherry Thu, 13 Jul 2017 15:13:30 +0100 diff --git a/mail/sbin/sympl-mail-dovecot-sni b/mail/sbin/sympl-mail-dovecot-sni index 6f67ed89..ff8de6bb 100755 --- a/mail/sbin/sympl-mail-dovecot-sni +++ b/mail/sbin/sympl-mail-dovecot-sni @@ -2,7 +2,7 @@ set -e -if [ ! -L /srv/*/config/ssl/current ]; then +if [ ! -L '/srv/*/config/ssl/current' ]; then # No certs avaialable, so check if /etc/dovecot/sympl.d/10-main/60-sni exists if [ -f /etc/dovecot/sympl.d/10-main/60-sni ]; then # it exists, so remove it @@ -21,7 +21,7 @@ if [ ! -L /srv/*/config/ssl/current ]; then fi fi -for certificate in $( find -L /srv/*/config/ssl/current -name 'ssl.crt' -print ); do +for certificate in $( find -L '/srv/*/config/ssl/current' -name 'ssl.crt' -print ); do certpath="$( echo $certificate | sed 's|/config/ssl/current/.*$|/config/ssl/current|' )" # Ensure there is a matching key file, and the path doesnt include an underscore if [ -f "${certpath}/ssl.key" ] && [ -f "${certpath}/ssl.bundle" ] && [ "$certpath" != "*_*" ] ; then -- GitLab From d48a30d5429e0d670748545530cc05895981a9c3 Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Sun, 7 Jul 2019 21:10:06 +0100 Subject: [PATCH 23/24] Revert "Merge branch 'buster-testing' of gitlab.mythic-beasts.com:sympl/sympl into buster-testing" This reverts commit 563366d9d940170655e3d30d3a7ecfc24ad59df7 --- .gitlab-ci.yml | 140 +++++++++++------- autotest/change-hostname | 9 -- autotest/get_previous_versions | 65 ++++++++ autotest/install_then_upgrade | 89 ----------- autotest/test.d/01-setup | 1 - autotest/test.d/91-manual | 2 +- .../conf-available/sympl-phpmyadmin.conf | 0 .../debian/changelog | 0 .../phpmyadmin => phpmyadmin}/debian/compat | 0 .../phpmyadmin => phpmyadmin}/debian/control | 0 .../debian/copyright | 0 .../phpmyadmin => phpmyadmin}/debian/install | 0 .../phpmyadmin => phpmyadmin}/debian/postinst | 0 .../phpmyadmin => phpmyadmin}/debian/preinst | 0 .../phpmyadmin => phpmyadmin}/debian/prerm | 0 .../phpmyadmin => phpmyadmin}/debian/rules | 0 .../debian/source/format | 0 .../patterns.d/phpmyadmin-suhosin.patterns | 0 .../phpmyadmin/config.sympl.inc.php | 0 .../test.d/tc_phpmyadmin.rb | 0 20 files changed, 151 insertions(+), 155 deletions(-) delete mode 100755 autotest/change-hostname create mode 100755 autotest/get_previous_versions delete mode 100755 autotest/install_then_upgrade rename {.retired/phpmyadmin => phpmyadmin}/apache2/conf-available/sympl-phpmyadmin.conf (100%) rename {.retired/phpmyadmin => phpmyadmin}/debian/changelog (100%) rename {.retired/phpmyadmin => phpmyadmin}/debian/compat (100%) rename {.retired/phpmyadmin => phpmyadmin}/debian/control (100%) rename {.retired/phpmyadmin => phpmyadmin}/debian/copyright (100%) rename {.retired/phpmyadmin => phpmyadmin}/debian/install (100%) rename {.retired/phpmyadmin => phpmyadmin}/debian/postinst (100%) rename {.retired/phpmyadmin => phpmyadmin}/debian/preinst (100%) rename {.retired/phpmyadmin => phpmyadmin}/debian/prerm (100%) rename {.retired/phpmyadmin => phpmyadmin}/debian/rules (100%) rename {.retired/phpmyadmin => phpmyadmin}/debian/source/format (100%) rename {.retired/phpmyadmin => phpmyadmin}/patterns.d/phpmyadmin-suhosin.patterns (100%) rename {.retired/phpmyadmin => phpmyadmin}/phpmyadmin/config.sympl.inc.php (100%) rename {.retired/phpmyadmin => phpmyadmin}/test.d/tc_phpmyadmin.rb (100%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9e15b870..eaf7ad73 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,7 @@ stages: - - Package - - Publish - - Install - - Upgrade + - package + - publish + - install # This will run through the packages one at a time, building them into artifacts # This uses the kelduum/sympl-build:v1 docker image, which is Debian Stretch with @@ -12,13 +11,13 @@ stages: tags: - docker image: kelduum/sympl-build-buster:v1 - stage: Package + stage: package script: - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections - apt-get update && apt-get install -q -yy gitlab-runner rake devscripts rdoc graphviz ruby-dev gem2deb txt2man dh-systemd apache2-dev libcap-dev php7.3-common dh-golang golang-go - - export PACKAGE=${CI_BUILD_NAME#sympl-} + - export PACKAGE=${CI_BUILD_NAME##package:} - git describe --all - - echo "Building '$CI_BUILD_NAME' in directory '$PACKAGE'" + - echo "$CI_BUILD_NAME" - "$PACKAGE" - "${CI_BUILD_NAME##package:}" - cd $PACKAGE - dpkg-buildpackage --no-sign --build=full - cd .. @@ -27,46 +26,46 @@ stages: artifacts: paths: - deb/ - expire_in: 1 day + expire_in: 4 days # List of packages to build -sympl-core: +package:core: <<: *package -sympl-backup: +package:backup: <<: *package -sympl-cron: +package:cron: <<: *package -sympl-dns: +package:dns: <<: *package -sympl-mail: +package:mail: <<: *package -sympl-firewall: +package:firewall: <<: *package -sympl-ftp: +package:ftp: <<: *package -sympl-web: +package:web: <<: *package -sympl-monit: +package:monit: <<: *package -sympl-mysql: +package:mysql: <<: *package -#sympl-phpmyadmin: -# <<: *package -sympl-updater: +package:phpmyadmin: <<: *package -sympl-webmail: +package:updater: <<: *package - +package:webmail: + <<: *package + # This builds the debian packages and drops them in a very simple local repo # so they can be installed during the next (install) step. # Again, it uses the kelduum/sympl-build docker image with the relevant tools pre-installed -Build Repo: +publish: tags: - docker image: kelduum/sympl-build-buster:v1 - stage: Publish + stage: publish script: - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections - apt-get update && apt-get install -q -yy dpkg-dev git @@ -74,85 +73,116 @@ Build Repo: - dpkg-scanpackages deb > deb/Packages - gzip -k deb/Packages - echo '## Building repo...' - - mkdir -p repo/pool/main/s repo/pool/main/l repo/dists/local/main/binary-amd64 + - mkdir -p repo/pool/main/s repo/pool/main/l repo/dists/buster/main/binary-amd64 - cp deb/s*.deb repo/pool/main/s - cp deb/l*.deb repo/pool/main/l - cd repo - - dpkg-scanpackages -m pool | gzip > dists/local/main/binary-amd64/Packages.gz - - dpkg-scanpackages -m pool > dists/local/main/binary-amd64/Packages + - dpkg-scanpackages -m pool | gzip > dists/buster/main/binary-amd64/Packages.gz + - dpkg-scanpackages -m pool > dists/buster/main/binary-amd64/Packages artifacts: paths: - deb/* - repo/* - expire_in: 1 day + expire_in: 1 month -# The next two stages runs on a VM running VirtualBox 5, which the gitlab-runner controls. -# The image is a pre-installed minimal copy of Debian, ideally with the dependencies pre -# downloaded. +# This stage runs on a VM running VirtualBox 5, which the gitlab-runner controls. +# The vbox:buster image is a pre-installed minimal copy of Debian Stretch. +# +# Clean is a minimal install, where quick has all of the pre-reqs installed, +# other than unattended-upgrades as it tries to run at reboot. -Clean Install: +install:quick: tags: - - vbox:buster - stage: Install + - vbox:buster-quick + stage: install + allow_failure: false script: - - chmod -x $( which gitlab-runner ) - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections - git describe --all - - apt-get -qq update; apt-get -qq -y upgrade + - chmod -x $( which gitlab-runner ) + - hostname -b quick.sympl.test ; hostname > /etc/hostname ; HOSTNAME=$(hostname) ; sed -i -n '/^127\.0\.0\.1/!p' /etc/hosts ; echo -e "127.0.0.1\t$(hostname) $(hostname -s) localhost" >> /etc/hosts - cp -r repo/ / - chmod -R 664 /repo ; chmod -R +X /repo - - echo "deb [trusted=yes] file:/repo local main" > /etc/apt/sources.list.d/local.list + - echo "deb [trusted=yes] file:/repo buster main" > /etc/apt/sources.list.d/local.list - apt-get -qq update - apt-get -y --allow-unauthenticated install --install-recommends sympl-core - run-parts --verbose --exit-on-error autotest/test.d - hostname - dpkg -l 'sympl*' +# allow_failure: true +# when: manual variables: CI_DEBUG_TRACE: "false" - allow_failure: false - when: always artifacts: paths: - repo/* - expire_in: 1 hour + expire_in: 4 days -Upgrade Testing: + +install:clean: tags: - vbox:buster - stage: Upgrade + stage: install + allow_failure: false script: - - chmod -x $( which gitlab-runner ) + - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections - git describe --all - - autotest/install_then_upgrade buster-testing + - chmod -x $( which gitlab-runner ) + - hostname -b clean.sympl.test ; hostname > /etc/hostname ; HOSTNAME=$(hostname) ; sed -i -n '/^127\.0\.0\.1/!p' /etc/hosts ; echo -e "127.0.0.1\t$(hostname) $(hostname -s) localhost" >> /etc/hosts + - apt-get -qq update; apt-get -qq -y upgrade + - cp -r repo/ / + - chmod -R 664 /repo ; chmod -R +X /repo + - echo "deb [trusted=yes] file:/repo buster main" > /etc/apt/sources.list.d/local.list + - apt-get -qq update || true + - apt-get -y --allow-unauthenticated install --install-recommends sympl-core - run-parts --verbose --exit-on-error autotest/test.d - hostname - dpkg -l 'sympl*' - allow_failure: false variables: CI_DEBUG_TRACE: "false" +# allow_failure: true +# when: manual artifacts: paths: - repo/* - expire_in: 1 hour + expire_in: 4 days + -Upgrade Stable: +install:upgrade: tags: - vbox:buster - stage: Upgrade + stage: install + allow_failure: false script: - - chmod -x $( which gitlab-runner ) + - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections - git describe --all - - autotest/install_then_upgrade buster + - chmod -x $( which gitlab-runner ) + - hostname -b upgrade.sympl.test ; hostname > /etc/hostname ; HOSTNAME=$(hostname) ; sed -i -n '/^127\.0\.0\.1/!p' /etc/hosts ; echo -e "127.0.0.1\t$(hostname) $(hostname -s) localhost" >> /etc/hosts + - apt-get -qq update; apt-get -qq -y upgrade + - wget -qO- http://mirror.mythic-beasts.com/mythic/support@mythic-beasts.com.gpg.key | apt-key add - + - echo deb http://packages.mythic-beasts.com/mythic/ buster-testing main > /etc/apt/sources.list.d/sympl_mythic-beasts.list + - apt-get -qq update + - apt-get -qq install $( autotest/get_previous_versions buster-testing ) + - dpkg -l 'sympl-*' | grep '^ii' | awk '{ print $2 " " $3 }' | sort > pre-upgrade + - cp -r repo/ / + - chmod -R 664 /repo ; chmod -R +X /repo + - echo "deb [trusted=yes] file:/repo buster main" > /etc/apt/sources.list.d/local.list + - apt-get -qq update || true + - apt-get -y --allow-unauthenticated --with-new-pkgs upgrade + - apt-get -y autoremove + - dpkg -l 'sympl-*' | grep '^ii' | awk '{ print $2 " " $3 }' | sort > post-upgrade + - autotest/checkupgrade - run-parts --verbose --exit-on-error autotest/test.d - hostname - dpkg -l 'sympl*' - allow_failure: false - when: delayed - start_in: 5 minutes + allow_failure: true + # when: manual variables: CI_DEBUG_TRACE: "false" artifacts: paths: - repo/* - expire_in: 1 hour + expire_in: 4 days + + diff --git a/autotest/change-hostname b/autotest/change-hostname deleted file mode 100755 index fd4ca0cc..00000000 --- a/autotest/change-hostname +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -hostname -b $1 -hostname > /etc/hostname -export HOSTNAME=$(hostname) -sed -i -n '/^127\.0\.0\.1/!p' /etc/hosts -echo -e "127.0.0.1\t$(hostname) $(hostname -s) localhost" >> /etc/hosts -echo "Hostname set to $(hostname --fqdn)" - diff --git a/autotest/get_previous_versions b/autotest/get_previous_versions new file mode 100755 index 00000000..8cb6b9b6 --- /dev/null +++ b/autotest/get_previous_versions @@ -0,0 +1,65 @@ +#!/bin/bash + +# If we're not on master, then install the already public versions +if [[ ! $( git describe --all ) == *master ]] ; then + + echo "--install-recommends sympl-core" + +else + + if [ "$1" == "" ]; then + echo "Error: need a distro name, such as 'stretch-testing'" > /dev/stderr + exit 1 + fi + + # Get the current versions + head -n 1 ./*/debian/changelog | grep '^sympl' | sed -e 's|(||' -e 's|).*||' > .built + touch .install-ver + + # While we don't have a list + while [ "$( cat .install-ver | wc -l )" != "$( cat .built | wc -l )" ]; do + + # Sleep for a bit if it's not the first time + if [ -s .install-ver ]; then + sleep 10 + fi + + # Pull the list of packages + # Using £ is untidy, but means you don't have to use GNU sed + wget -q -O - "http://packages.mythic-beasts.com/mythic/dists/$1/main/source/Sources.gz" \ + | gunzip \ + | grep -A 2 '^Package: sympl' \ + | grep -v ^Binary \ + | sed -e 's|^Package: ||' -e 's|^Version: ||' \ + | tr '\n' ' ' \ + | sed -e 's| -- |£|g' \ + | tr '£' '\n' \ + > .packages + + # Get the newest version of each package, other than duplicates + cat .packages .built \ + | sort -r \ + | uniq -u \ + | awk '!seen[$1] { print $1 " " $2 } {++seen[$1]}' \ + > .install + + # Filter for only packages in the repo + rm .install-ver + for package in $( find . -type f -name 'changelog' | sed -e 's|^\./||' -e 's|/.*||' | tr '\n' ' ' ); do + grep "^sympl-${package} " .install >> .install-ver + done + + # Check for any versions to be installed which match the ones we built, force a retry if so + retry=false + cat .built | while read line; do + if [ $( grep -c "$line" .install-ver ) != 0 ]; then retry=true; fi + done + if [ $retry == true ]; then echo invalid > .install-ver ; fi + + done + +cat .install-ver | tr ' ' '=' | tr '\n' ' ' + +rm .install-ver .install .packages .built + +fi diff --git a/autotest/install_then_upgrade b/autotest/install_then_upgrade deleted file mode 100755 index f20b2f40..00000000 --- a/autotest/install_then_upgrade +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash - -set -e - -if [ "x$1" == "x" ]; then - echo "Error: I need a repo name, such as 'stretch-testing'" > /dev/stderr - exit 1 -fi - -REPO=$1 - -head -n 1 ./*/debian/changelog | grep '^sympl' | sed -e 's|(||' -e 's|).*||' | sort > /tmp/local_versions - -wget -q -O - "http://packages.mythic-beasts.com/mythic/dists/$REPO/main/source/Sources.gz" \ - | gunzip \ - | grep -A 2 '^Package: sympl' \ - | grep -v ^Binary \ - | sed -e 's|^Package: ||' -e 's|^Version: ||' \ - | tr '\n' ' ' \ - | sed -e 's| -- |\n|g' \ - | sort -r \ - > /tmp/packages - -#echo local_versons -#cat /tmp/local_versions -#echo --- -#echo packages -#cat /tmp/packages - -cp /tmp/local_versions /tmp/from_repo - -cat /tmp/local_versions | while read PACKAGE LOCAL_VER ; do -# echo Checking for previous version of $PACKAGE $LOCAL_VER - if grep "^$PACKAGE " /tmp/packages > /tmp/check-package; then - LOCAL_VER_NUM="$( echo $LOCAL_VER | tr -d '.' )" - cat /tmp/check-package | while read skip REPO_VER ; do - REPO_VER_NUM="$( echo $REPO_VER | tr -d '.' )" - if [ $REPO_VER_NUM -lt $LOCAL_VER_NUM ]; then - sed -i "s|^$PACKAGE .*|$PACKAGE $REPO_VER|" /tmp/from_repo - break - # else - # echo skipping $REPO_VER - fi - done - else - sed -i "s|^$PACKAGE .*||" /tmp/from_repo - # echo new package: $PACKAGE - fi -done - -rm /tmp/check-package /tmp/packages - -#diff /tmp/from_repo /tmp/local_versions -echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections - -apt-get -qq update -apt-get -qq -y upgrade - -wget -qO- http://mirror.mythic-beasts.com/mythic/support@mythic-beasts.com.gpg.key | apt-key add - - -echo deb http://packages.mythic-beasts.com/mythic/ $REPO main > /etc/apt/sources.list.d/sympl_mythic-beasts.list - -cp -r repo/ / -chmod -R 664 /repo ; chmod -R +X /repo -echo "deb [trusted=yes] file:/repo local main" > /etc/apt/sources.list.d/local.list - -apt-get -qq update - -echo ---------- Installing ----------- -cat /tmp/from_repo | tr ' ' '\t' -echo --------------------------------- - -apt-get -q -y install --allow-unauthenticated --install-recommends $( cat /tmp/from_repo | tr ' ' '=' | tr '\n' ' ' ) - -rm /etc/apt/sources.list.d/sympl_mythic-beasts.list -apt-get -qq update - -echo ----------- Upgrading ----------- -diff /tmp/from_repo /tmp/local_versions | grep '^> ' | sed -e 's|> ||' | tr ' ' '\t' -echo --------------------------------- - -apt-get -q -y install --allow-unauthenticated --install-recommends $( diff /tmp/from_repo /tmp/local_versions | grep '^>' | sed -e 's|> ||' | tr ' ' '=' | tr '\n' ' ' ) - -apt-get -y autoremove - -dpkg -l 'sympl-*' | grep '^ii' | awk '{ print $2 " " $3 }' - -exit 0 - diff --git a/autotest/test.d/01-setup b/autotest/test.d/01-setup index fffb7db1..5bfc108e 100755 --- a/autotest/test.d/01-setup +++ b/autotest/test.d/01-setup @@ -84,4 +84,3 @@ while [ `ps -ef | grep 'spamd child' | grep -v -c grep` -lt 2 ]; do done echo ' done.' - diff --git a/autotest/test.d/91-manual b/autotest/test.d/91-manual index a3a9cfb6..79d563e3 100755 --- a/autotest/test.d/91-manual +++ b/autotest/test.d/91-manual @@ -4,6 +4,6 @@ errors=0 -for command in $(find /bin /sbin /usr/bin /usr/sbin -name 'symbiosis-*' | grep -v 'symbiosis-crontab$\|symbiosis-dns-generate$\|symbiosis-generate-dhparams$\|symbiosis-httpd-logger$'); do echo -ne "Testing '$command --manual'" ; $command --manual > /tmp/autotest_out 2>&1 ; if [ $? -ne 0 ]; then errors=$((errors+1)); echo ' FAIL'; cat /tmp/autotest_out; else echo ' OK'; fi ; done +for command in $(find /bin /sbin /usr/bin /usr/sbin -name 'symbiosis-*' | grep -v 'symbiosis-crontab$\|symbiosis-dns-generate$\|symbiosis-generate-dhparams$\|symbiosis-httpd-logger$'); do echo -ne "\nTesting '$command --manual'" ; $command --manual > /tmp/autotest_out 2>&1 ; if [ $? -ne 0 ]; then errors=$((errors+1)); echo ' FAIL'; cat /tmp/autotest_out; else echo ' OK'; fi ; done exit $errors diff --git a/.retired/phpmyadmin/apache2/conf-available/sympl-phpmyadmin.conf b/phpmyadmin/apache2/conf-available/sympl-phpmyadmin.conf similarity index 100% rename from .retired/phpmyadmin/apache2/conf-available/sympl-phpmyadmin.conf rename to phpmyadmin/apache2/conf-available/sympl-phpmyadmin.conf diff --git a/.retired/phpmyadmin/debian/changelog b/phpmyadmin/debian/changelog similarity index 100% rename from .retired/phpmyadmin/debian/changelog rename to phpmyadmin/debian/changelog diff --git a/.retired/phpmyadmin/debian/compat b/phpmyadmin/debian/compat similarity index 100% rename from .retired/phpmyadmin/debian/compat rename to phpmyadmin/debian/compat diff --git a/.retired/phpmyadmin/debian/control b/phpmyadmin/debian/control similarity index 100% rename from .retired/phpmyadmin/debian/control rename to phpmyadmin/debian/control diff --git a/.retired/phpmyadmin/debian/copyright b/phpmyadmin/debian/copyright similarity index 100% rename from .retired/phpmyadmin/debian/copyright rename to phpmyadmin/debian/copyright diff --git a/.retired/phpmyadmin/debian/install b/phpmyadmin/debian/install similarity index 100% rename from .retired/phpmyadmin/debian/install rename to phpmyadmin/debian/install diff --git a/.retired/phpmyadmin/debian/postinst b/phpmyadmin/debian/postinst similarity index 100% rename from .retired/phpmyadmin/debian/postinst rename to phpmyadmin/debian/postinst diff --git a/.retired/phpmyadmin/debian/preinst b/phpmyadmin/debian/preinst similarity index 100% rename from .retired/phpmyadmin/debian/preinst rename to phpmyadmin/debian/preinst diff --git a/.retired/phpmyadmin/debian/prerm b/phpmyadmin/debian/prerm similarity index 100% rename from .retired/phpmyadmin/debian/prerm rename to phpmyadmin/debian/prerm diff --git a/.retired/phpmyadmin/debian/rules b/phpmyadmin/debian/rules similarity index 100% rename from .retired/phpmyadmin/debian/rules rename to phpmyadmin/debian/rules diff --git a/.retired/phpmyadmin/debian/source/format b/phpmyadmin/debian/source/format similarity index 100% rename from .retired/phpmyadmin/debian/source/format rename to phpmyadmin/debian/source/format diff --git a/.retired/phpmyadmin/patterns.d/phpmyadmin-suhosin.patterns b/phpmyadmin/patterns.d/phpmyadmin-suhosin.patterns similarity index 100% rename from .retired/phpmyadmin/patterns.d/phpmyadmin-suhosin.patterns rename to phpmyadmin/patterns.d/phpmyadmin-suhosin.patterns diff --git a/.retired/phpmyadmin/phpmyadmin/config.sympl.inc.php b/phpmyadmin/phpmyadmin/config.sympl.inc.php similarity index 100% rename from .retired/phpmyadmin/phpmyadmin/config.sympl.inc.php rename to phpmyadmin/phpmyadmin/config.sympl.inc.php diff --git a/.retired/phpmyadmin/test.d/tc_phpmyadmin.rb b/phpmyadmin/test.d/tc_phpmyadmin.rb similarity index 100% rename from .retired/phpmyadmin/test.d/tc_phpmyadmin.rb rename to phpmyadmin/test.d/tc_phpmyadmin.rb -- GitLab From 41dd8ad70c13a6bc9d9830474bac7a5cb004c1be Mon Sep 17 00:00:00 2001 From: Paul Cammish Date: Sun, 7 Jul 2019 21:20:52 +0100 Subject: [PATCH 24/24] Revert "Revert "Merge branch 'buster-testing' of gitlab.mythic-beasts.com:sympl/sympl into buster-testing"" This reverts commit d48a30d5429e0d670748545530cc05895981a9c3 --- .gitlab-ci.yml | 140 +++++++----------- .../conf-available/sympl-phpmyadmin.conf | 0 .../phpmyadmin}/debian/changelog | 0 .../phpmyadmin}/debian/compat | 0 .../phpmyadmin}/debian/control | 0 .../phpmyadmin}/debian/copyright | 0 .../phpmyadmin}/debian/install | 0 .../phpmyadmin}/debian/postinst | 0 .../phpmyadmin}/debian/preinst | 0 .../phpmyadmin}/debian/prerm | 0 .../phpmyadmin}/debian/rules | 0 .../phpmyadmin}/debian/source/format | 0 .../patterns.d/phpmyadmin-suhosin.patterns | 0 .../phpmyadmin/config.sympl.inc.php | 0 .../phpmyadmin}/test.d/tc_phpmyadmin.rb | 0 autotest/change-hostname | 9 ++ autotest/get_previous_versions | 65 -------- autotest/install_then_upgrade | 89 +++++++++++ autotest/test.d/01-setup | 1 + autotest/test.d/91-manual | 2 +- 20 files changed, 155 insertions(+), 151 deletions(-) rename {phpmyadmin => .retired/phpmyadmin}/apache2/conf-available/sympl-phpmyadmin.conf (100%) rename {phpmyadmin => .retired/phpmyadmin}/debian/changelog (100%) rename {phpmyadmin => .retired/phpmyadmin}/debian/compat (100%) rename {phpmyadmin => .retired/phpmyadmin}/debian/control (100%) rename {phpmyadmin => .retired/phpmyadmin}/debian/copyright (100%) rename {phpmyadmin => .retired/phpmyadmin}/debian/install (100%) rename {phpmyadmin => .retired/phpmyadmin}/debian/postinst (100%) rename {phpmyadmin => .retired/phpmyadmin}/debian/preinst (100%) rename {phpmyadmin => .retired/phpmyadmin}/debian/prerm (100%) rename {phpmyadmin => .retired/phpmyadmin}/debian/rules (100%) rename {phpmyadmin => .retired/phpmyadmin}/debian/source/format (100%) rename {phpmyadmin => .retired/phpmyadmin}/patterns.d/phpmyadmin-suhosin.patterns (100%) rename {phpmyadmin => .retired/phpmyadmin}/phpmyadmin/config.sympl.inc.php (100%) rename {phpmyadmin => .retired/phpmyadmin}/test.d/tc_phpmyadmin.rb (100%) create mode 100755 autotest/change-hostname delete mode 100755 autotest/get_previous_versions create mode 100755 autotest/install_then_upgrade diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index eaf7ad73..9e15b870 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,8 @@ stages: - - package - - publish - - install + - Package + - Publish + - Install + - Upgrade # This will run through the packages one at a time, building them into artifacts # This uses the kelduum/sympl-build:v1 docker image, which is Debian Stretch with @@ -11,13 +12,13 @@ stages: tags: - docker image: kelduum/sympl-build-buster:v1 - stage: package + stage: Package script: - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections - apt-get update && apt-get install -q -yy gitlab-runner rake devscripts rdoc graphviz ruby-dev gem2deb txt2man dh-systemd apache2-dev libcap-dev php7.3-common dh-golang golang-go - - export PACKAGE=${CI_BUILD_NAME##package:} + - export PACKAGE=${CI_BUILD_NAME#sympl-} - git describe --all - - echo "$CI_BUILD_NAME" - "$PACKAGE" - "${CI_BUILD_NAME##package:}" + - echo "Building '$CI_BUILD_NAME' in directory '$PACKAGE'" - cd $PACKAGE - dpkg-buildpackage --no-sign --build=full - cd .. @@ -26,46 +27,46 @@ stages: artifacts: paths: - deb/ - expire_in: 4 days + expire_in: 1 day # List of packages to build -package:core: +sympl-core: <<: *package -package:backup: +sympl-backup: <<: *package -package:cron: +sympl-cron: <<: *package -package:dns: +sympl-dns: <<: *package -package:mail: +sympl-mail: <<: *package -package:firewall: +sympl-firewall: <<: *package -package:ftp: +sympl-ftp: <<: *package -package:web: +sympl-web: <<: *package -package:monit: +sympl-monit: <<: *package -package:mysql: +sympl-mysql: <<: *package -package:phpmyadmin: +#sympl-phpmyadmin: +# <<: *package +sympl-updater: <<: *package -package:updater: +sympl-webmail: <<: *package -package:webmail: - <<: *package - + # This builds the debian packages and drops them in a very simple local repo # so they can be installed during the next (install) step. # Again, it uses the kelduum/sympl-build docker image with the relevant tools pre-installed -publish: +Build Repo: tags: - docker image: kelduum/sympl-build-buster:v1 - stage: publish + stage: Publish script: - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections - apt-get update && apt-get install -q -yy dpkg-dev git @@ -73,116 +74,85 @@ publish: - dpkg-scanpackages deb > deb/Packages - gzip -k deb/Packages - echo '## Building repo...' - - mkdir -p repo/pool/main/s repo/pool/main/l repo/dists/buster/main/binary-amd64 + - mkdir -p repo/pool/main/s repo/pool/main/l repo/dists/local/main/binary-amd64 - cp deb/s*.deb repo/pool/main/s - cp deb/l*.deb repo/pool/main/l - cd repo - - dpkg-scanpackages -m pool | gzip > dists/buster/main/binary-amd64/Packages.gz - - dpkg-scanpackages -m pool > dists/buster/main/binary-amd64/Packages + - dpkg-scanpackages -m pool | gzip > dists/local/main/binary-amd64/Packages.gz + - dpkg-scanpackages -m pool > dists/local/main/binary-amd64/Packages artifacts: paths: - deb/* - repo/* - expire_in: 1 month + expire_in: 1 day -# This stage runs on a VM running VirtualBox 5, which the gitlab-runner controls. -# The vbox:buster image is a pre-installed minimal copy of Debian Stretch. -# -# Clean is a minimal install, where quick has all of the pre-reqs installed, -# other than unattended-upgrades as it tries to run at reboot. +# The next two stages runs on a VM running VirtualBox 5, which the gitlab-runner controls. +# The image is a pre-installed minimal copy of Debian, ideally with the dependencies pre +# downloaded. -install:quick: +Clean Install: tags: - - vbox:buster-quick - stage: install - allow_failure: false + - vbox:buster + stage: Install script: + - chmod -x $( which gitlab-runner ) - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections - git describe --all - - chmod -x $( which gitlab-runner ) - - hostname -b quick.sympl.test ; hostname > /etc/hostname ; HOSTNAME=$(hostname) ; sed -i -n '/^127\.0\.0\.1/!p' /etc/hosts ; echo -e "127.0.0.1\t$(hostname) $(hostname -s) localhost" >> /etc/hosts + - apt-get -qq update; apt-get -qq -y upgrade - cp -r repo/ / - chmod -R 664 /repo ; chmod -R +X /repo - - echo "deb [trusted=yes] file:/repo buster main" > /etc/apt/sources.list.d/local.list + - echo "deb [trusted=yes] file:/repo local main" > /etc/apt/sources.list.d/local.list - apt-get -qq update - apt-get -y --allow-unauthenticated install --install-recommends sympl-core - run-parts --verbose --exit-on-error autotest/test.d - hostname - dpkg -l 'sympl*' -# allow_failure: true -# when: manual variables: CI_DEBUG_TRACE: "false" + allow_failure: false + when: always artifacts: paths: - repo/* - expire_in: 4 days + expire_in: 1 hour - -install:clean: +Upgrade Testing: tags: - vbox:buster - stage: install - allow_failure: false + stage: Upgrade script: - - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections - - git describe --all - chmod -x $( which gitlab-runner ) - - hostname -b clean.sympl.test ; hostname > /etc/hostname ; HOSTNAME=$(hostname) ; sed -i -n '/^127\.0\.0\.1/!p' /etc/hosts ; echo -e "127.0.0.1\t$(hostname) $(hostname -s) localhost" >> /etc/hosts - - apt-get -qq update; apt-get -qq -y upgrade - - cp -r repo/ / - - chmod -R 664 /repo ; chmod -R +X /repo - - echo "deb [trusted=yes] file:/repo buster main" > /etc/apt/sources.list.d/local.list - - apt-get -qq update || true - - apt-get -y --allow-unauthenticated install --install-recommends sympl-core + - git describe --all + - autotest/install_then_upgrade buster-testing - run-parts --verbose --exit-on-error autotest/test.d - hostname - dpkg -l 'sympl*' + allow_failure: false variables: CI_DEBUG_TRACE: "false" -# allow_failure: true -# when: manual artifacts: paths: - repo/* - expire_in: 4 days - + expire_in: 1 hour -install:upgrade: +Upgrade Stable: tags: - vbox:buster - stage: install - allow_failure: false + stage: Upgrade script: - - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections - - git describe --all - chmod -x $( which gitlab-runner ) - - hostname -b upgrade.sympl.test ; hostname > /etc/hostname ; HOSTNAME=$(hostname) ; sed -i -n '/^127\.0\.0\.1/!p' /etc/hosts ; echo -e "127.0.0.1\t$(hostname) $(hostname -s) localhost" >> /etc/hosts - - apt-get -qq update; apt-get -qq -y upgrade - - wget -qO- http://mirror.mythic-beasts.com/mythic/support@mythic-beasts.com.gpg.key | apt-key add - - - echo deb http://packages.mythic-beasts.com/mythic/ buster-testing main > /etc/apt/sources.list.d/sympl_mythic-beasts.list - - apt-get -qq update - - apt-get -qq install $( autotest/get_previous_versions buster-testing ) - - dpkg -l 'sympl-*' | grep '^ii' | awk '{ print $2 " " $3 }' | sort > pre-upgrade - - cp -r repo/ / - - chmod -R 664 /repo ; chmod -R +X /repo - - echo "deb [trusted=yes] file:/repo buster main" > /etc/apt/sources.list.d/local.list - - apt-get -qq update || true - - apt-get -y --allow-unauthenticated --with-new-pkgs upgrade - - apt-get -y autoremove - - dpkg -l 'sympl-*' | grep '^ii' | awk '{ print $2 " " $3 }' | sort > post-upgrade - - autotest/checkupgrade + - git describe --all + - autotest/install_then_upgrade buster - run-parts --verbose --exit-on-error autotest/test.d - hostname - dpkg -l 'sympl*' - allow_failure: true - # when: manual + allow_failure: false + when: delayed + start_in: 5 minutes variables: CI_DEBUG_TRACE: "false" artifacts: paths: - repo/* - expire_in: 4 days - - + expire_in: 1 hour diff --git a/phpmyadmin/apache2/conf-available/sympl-phpmyadmin.conf b/.retired/phpmyadmin/apache2/conf-available/sympl-phpmyadmin.conf similarity index 100% rename from phpmyadmin/apache2/conf-available/sympl-phpmyadmin.conf rename to .retired/phpmyadmin/apache2/conf-available/sympl-phpmyadmin.conf diff --git a/phpmyadmin/debian/changelog b/.retired/phpmyadmin/debian/changelog similarity index 100% rename from phpmyadmin/debian/changelog rename to .retired/phpmyadmin/debian/changelog diff --git a/phpmyadmin/debian/compat b/.retired/phpmyadmin/debian/compat similarity index 100% rename from phpmyadmin/debian/compat rename to .retired/phpmyadmin/debian/compat diff --git a/phpmyadmin/debian/control b/.retired/phpmyadmin/debian/control similarity index 100% rename from phpmyadmin/debian/control rename to .retired/phpmyadmin/debian/control diff --git a/phpmyadmin/debian/copyright b/.retired/phpmyadmin/debian/copyright similarity index 100% rename from phpmyadmin/debian/copyright rename to .retired/phpmyadmin/debian/copyright diff --git a/phpmyadmin/debian/install b/.retired/phpmyadmin/debian/install similarity index 100% rename from phpmyadmin/debian/install rename to .retired/phpmyadmin/debian/install diff --git a/phpmyadmin/debian/postinst b/.retired/phpmyadmin/debian/postinst similarity index 100% rename from phpmyadmin/debian/postinst rename to .retired/phpmyadmin/debian/postinst diff --git a/phpmyadmin/debian/preinst b/.retired/phpmyadmin/debian/preinst similarity index 100% rename from phpmyadmin/debian/preinst rename to .retired/phpmyadmin/debian/preinst diff --git a/phpmyadmin/debian/prerm b/.retired/phpmyadmin/debian/prerm similarity index 100% rename from phpmyadmin/debian/prerm rename to .retired/phpmyadmin/debian/prerm diff --git a/phpmyadmin/debian/rules b/.retired/phpmyadmin/debian/rules similarity index 100% rename from phpmyadmin/debian/rules rename to .retired/phpmyadmin/debian/rules diff --git a/phpmyadmin/debian/source/format b/.retired/phpmyadmin/debian/source/format similarity index 100% rename from phpmyadmin/debian/source/format rename to .retired/phpmyadmin/debian/source/format diff --git a/phpmyadmin/patterns.d/phpmyadmin-suhosin.patterns b/.retired/phpmyadmin/patterns.d/phpmyadmin-suhosin.patterns similarity index 100% rename from phpmyadmin/patterns.d/phpmyadmin-suhosin.patterns rename to .retired/phpmyadmin/patterns.d/phpmyadmin-suhosin.patterns diff --git a/phpmyadmin/phpmyadmin/config.sympl.inc.php b/.retired/phpmyadmin/phpmyadmin/config.sympl.inc.php similarity index 100% rename from phpmyadmin/phpmyadmin/config.sympl.inc.php rename to .retired/phpmyadmin/phpmyadmin/config.sympl.inc.php diff --git a/phpmyadmin/test.d/tc_phpmyadmin.rb b/.retired/phpmyadmin/test.d/tc_phpmyadmin.rb similarity index 100% rename from phpmyadmin/test.d/tc_phpmyadmin.rb rename to .retired/phpmyadmin/test.d/tc_phpmyadmin.rb diff --git a/autotest/change-hostname b/autotest/change-hostname new file mode 100755 index 00000000..fd4ca0cc --- /dev/null +++ b/autotest/change-hostname @@ -0,0 +1,9 @@ +#!/bin/bash + +hostname -b $1 +hostname > /etc/hostname +export HOSTNAME=$(hostname) +sed -i -n '/^127\.0\.0\.1/!p' /etc/hosts +echo -e "127.0.0.1\t$(hostname) $(hostname -s) localhost" >> /etc/hosts +echo "Hostname set to $(hostname --fqdn)" + diff --git a/autotest/get_previous_versions b/autotest/get_previous_versions deleted file mode 100755 index 8cb6b9b6..00000000 --- a/autotest/get_previous_versions +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -# If we're not on master, then install the already public versions -if [[ ! $( git describe --all ) == *master ]] ; then - - echo "--install-recommends sympl-core" - -else - - if [ "$1" == "" ]; then - echo "Error: need a distro name, such as 'stretch-testing'" > /dev/stderr - exit 1 - fi - - # Get the current versions - head -n 1 ./*/debian/changelog | grep '^sympl' | sed -e 's|(||' -e 's|).*||' > .built - touch .install-ver - - # While we don't have a list - while [ "$( cat .install-ver | wc -l )" != "$( cat .built | wc -l )" ]; do - - # Sleep for a bit if it's not the first time - if [ -s .install-ver ]; then - sleep 10 - fi - - # Pull the list of packages - # Using £ is untidy, but means you don't have to use GNU sed - wget -q -O - "http://packages.mythic-beasts.com/mythic/dists/$1/main/source/Sources.gz" \ - | gunzip \ - | grep -A 2 '^Package: sympl' \ - | grep -v ^Binary \ - | sed -e 's|^Package: ||' -e 's|^Version: ||' \ - | tr '\n' ' ' \ - | sed -e 's| -- |£|g' \ - | tr '£' '\n' \ - > .packages - - # Get the newest version of each package, other than duplicates - cat .packages .built \ - | sort -r \ - | uniq -u \ - | awk '!seen[$1] { print $1 " " $2 } {++seen[$1]}' \ - > .install - - # Filter for only packages in the repo - rm .install-ver - for package in $( find . -type f -name 'changelog' | sed -e 's|^\./||' -e 's|/.*||' | tr '\n' ' ' ); do - grep "^sympl-${package} " .install >> .install-ver - done - - # Check for any versions to be installed which match the ones we built, force a retry if so - retry=false - cat .built | while read line; do - if [ $( grep -c "$line" .install-ver ) != 0 ]; then retry=true; fi - done - if [ $retry == true ]; then echo invalid > .install-ver ; fi - - done - -cat .install-ver | tr ' ' '=' | tr '\n' ' ' - -rm .install-ver .install .packages .built - -fi diff --git a/autotest/install_then_upgrade b/autotest/install_then_upgrade new file mode 100755 index 00000000..f20b2f40 --- /dev/null +++ b/autotest/install_then_upgrade @@ -0,0 +1,89 @@ +#!/bin/bash + +set -e + +if [ "x$1" == "x" ]; then + echo "Error: I need a repo name, such as 'stretch-testing'" > /dev/stderr + exit 1 +fi + +REPO=$1 + +head -n 1 ./*/debian/changelog | grep '^sympl' | sed -e 's|(||' -e 's|).*||' | sort > /tmp/local_versions + +wget -q -O - "http://packages.mythic-beasts.com/mythic/dists/$REPO/main/source/Sources.gz" \ + | gunzip \ + | grep -A 2 '^Package: sympl' \ + | grep -v ^Binary \ + | sed -e 's|^Package: ||' -e 's|^Version: ||' \ + | tr '\n' ' ' \ + | sed -e 's| -- |\n|g' \ + | sort -r \ + > /tmp/packages + +#echo local_versons +#cat /tmp/local_versions +#echo --- +#echo packages +#cat /tmp/packages + +cp /tmp/local_versions /tmp/from_repo + +cat /tmp/local_versions | while read PACKAGE LOCAL_VER ; do +# echo Checking for previous version of $PACKAGE $LOCAL_VER + if grep "^$PACKAGE " /tmp/packages > /tmp/check-package; then + LOCAL_VER_NUM="$( echo $LOCAL_VER | tr -d '.' )" + cat /tmp/check-package | while read skip REPO_VER ; do + REPO_VER_NUM="$( echo $REPO_VER | tr -d '.' )" + if [ $REPO_VER_NUM -lt $LOCAL_VER_NUM ]; then + sed -i "s|^$PACKAGE .*|$PACKAGE $REPO_VER|" /tmp/from_repo + break + # else + # echo skipping $REPO_VER + fi + done + else + sed -i "s|^$PACKAGE .*||" /tmp/from_repo + # echo new package: $PACKAGE + fi +done + +rm /tmp/check-package /tmp/packages + +#diff /tmp/from_repo /tmp/local_versions +echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections + +apt-get -qq update +apt-get -qq -y upgrade + +wget -qO- http://mirror.mythic-beasts.com/mythic/support@mythic-beasts.com.gpg.key | apt-key add - + +echo deb http://packages.mythic-beasts.com/mythic/ $REPO main > /etc/apt/sources.list.d/sympl_mythic-beasts.list + +cp -r repo/ / +chmod -R 664 /repo ; chmod -R +X /repo +echo "deb [trusted=yes] file:/repo local main" > /etc/apt/sources.list.d/local.list + +apt-get -qq update + +echo ---------- Installing ----------- +cat /tmp/from_repo | tr ' ' '\t' +echo --------------------------------- + +apt-get -q -y install --allow-unauthenticated --install-recommends $( cat /tmp/from_repo | tr ' ' '=' | tr '\n' ' ' ) + +rm /etc/apt/sources.list.d/sympl_mythic-beasts.list +apt-get -qq update + +echo ----------- Upgrading ----------- +diff /tmp/from_repo /tmp/local_versions | grep '^> ' | sed -e 's|> ||' | tr ' ' '\t' +echo --------------------------------- + +apt-get -q -y install --allow-unauthenticated --install-recommends $( diff /tmp/from_repo /tmp/local_versions | grep '^>' | sed -e 's|> ||' | tr ' ' '=' | tr '\n' ' ' ) + +apt-get -y autoremove + +dpkg -l 'sympl-*' | grep '^ii' | awk '{ print $2 " " $3 }' + +exit 0 + diff --git a/autotest/test.d/01-setup b/autotest/test.d/01-setup index 5bfc108e..fffb7db1 100755 --- a/autotest/test.d/01-setup +++ b/autotest/test.d/01-setup @@ -84,3 +84,4 @@ while [ `ps -ef | grep 'spamd child' | grep -v -c grep` -lt 2 ]; do done echo ' done.' + diff --git a/autotest/test.d/91-manual b/autotest/test.d/91-manual index 79d563e3..a3a9cfb6 100755 --- a/autotest/test.d/91-manual +++ b/autotest/test.d/91-manual @@ -4,6 +4,6 @@ errors=0 -for command in $(find /bin /sbin /usr/bin /usr/sbin -name 'symbiosis-*' | grep -v 'symbiosis-crontab$\|symbiosis-dns-generate$\|symbiosis-generate-dhparams$\|symbiosis-httpd-logger$'); do echo -ne "\nTesting '$command --manual'" ; $command --manual > /tmp/autotest_out 2>&1 ; if [ $? -ne 0 ]; then errors=$((errors+1)); echo ' FAIL'; cat /tmp/autotest_out; else echo ' OK'; fi ; done +for command in $(find /bin /sbin /usr/bin /usr/sbin -name 'symbiosis-*' | grep -v 'symbiosis-crontab$\|symbiosis-dns-generate$\|symbiosis-generate-dhparams$\|symbiosis-httpd-logger$'); do echo -ne "Testing '$command --manual'" ; $command --manual > /tmp/autotest_out 2>&1 ; if [ $? -ne 0 ]; then errors=$((errors+1)); echo ' FAIL'; cat /tmp/autotest_out; else echo ' OK'; fi ; done exit $errors -- GitLab