From 3ea150e2f7298cf5c1921714db05b33cc908d40e Mon Sep 17 00:00:00 2001 From: Camille Lafitte Date: Fri, 26 Jan 2024 11:13:31 +0100 Subject: [PATCH] Use sed_script during roundcube installation * SED_SCRIPT is provided as second argument to all install.d/ scripts Follow exit status as explained at https://www.gnu.org/software/bash/manual/html_node/Exit-Status.html --- roundcube/roundcube-install | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/roundcube/roundcube-install b/roundcube/roundcube-install index 8f8cada6..f7403e38 100644 --- a/roundcube/roundcube-install +++ b/roundcube/roundcube-install @@ -22,6 +22,19 @@ # Purpose of file: Install roundcube conf files. # ---------------------------------------------------------------------- +if [ "$#" -ne 2 ]; then + echo "roundcube-install can't be ran, missing some parameters" + exit 2 +fi + +if [ -f "$2" ] +then + SED_SCRIPT="$2" +else + echo "roundcube-install can't be ran, sed_script is not a file" + exit 2 +fi + if [ "$1" = "templates" ] then echo "Installing Roundcube Templates ..." @@ -29,9 +42,6 @@ then LOGIN="0000_roundcube" PASSWORD="`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..10)'`" DESKEY="`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..24)'`" - # " - # Add new variables to the sed script ... - SED_SCRIPT="/tmp/alternc-roundcube.sedscript" # cf alternc.install for more explanations on this horror : eval `sed -n -e "/=/{s/ *= *\"\?/='/;s/\"\?\$/'/;s/host/MYSQL_HOST/;s/user/MYSQL_USER/;s/password/MYSQL_PASS/;s/database/MYSQL_DATABASE/;p}" /etc/alternc/my.cnf` . /etc/alternc/local.sh