From 877b08825570fccc9212ab6dee46a54e03a6f3a0 Mon Sep 17 00:00:00 2001 From: Luis Guzman Date: Tue, 30 Jun 2020 20:35:53 -0500 Subject: [PATCH] Move into postgresql as base DB Also delete tmp patch --- files/patch_425_3dty.patch | 24 ---------------------- jra_nextcloud.sh | 41 ++++++++++---------------------------- 2 files changed, 10 insertions(+), 55 deletions(-) delete mode 100644 files/patch_425_3dty.patch diff --git a/files/patch_425_3dty.patch b/files/patch_425_3dty.patch deleted file mode 100644 index e97492c..0000000 --- a/files/patch_425_3dty.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- Compiler.php 2020-03-11 08:52:46.000000000 -0600 -+++ Compiler-fixed.php 2020-04-04 06:56:43.175786008 -0600 -@@ -5211,10 +5211,10 @@ - return new Node\Number(strlen($stringContent), ''); - } - -- protected static $libStrSlice = ['string', 'start-at', 'end-at']; -+ protected static $libStrSlice = ['string', 'start-at', 'end-at:-1']; - protected function libStrSlice($args) - { -- if (isset($args[2]) && $args[2][1] == 0) { -+ if (isset($args[2]) && ! $args[2][1]) { - return static::$nullString; - } - -@@ -5227,7 +5227,7 @@ - $start--; - } - -- $end = (int) $args[2][1]; -+ $end = isset($args[2]) ? (int) $args[2][1] : -1; - $length = $end < 0 ? $end + 1 : ($end > 0 ? $end - $start : $end); - - $string[2] = $length diff --git a/jra_nextcloud.sh b/jra_nextcloud.sh index adbf6fc..c314594 100644 --- a/jra_nextcloud.sh +++ b/jra_nextcloud.sh @@ -50,7 +50,7 @@ done DISTRO_RELEASE="$(lsb_release -sc)" DOMAIN=$(ls /etc/prosody/conf.d/ | grep -v localhost | awk -F'.cfg' '{print $1}' | awk '!NF || !seen[$0]++') PHPVER="7.4" -MDBVER="10.4" +PSGVER="$(apt-cache madison postgresql | head -n1 | awk '{print $3}' | cut -d "+" -f1)" PHP_FPM_DIR="/etc/php/$PHPVER/fpm" PHP_INI="$PHP_FPM_DIR/php.ini" PHP_CONF="/etc/php/$PHPVER/fpm/pool.d/www.conf" @@ -86,16 +86,6 @@ if [ "$(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed")" = apt-get -yq2 install $1 fi } -add_mariadb() { - if [ "$(dpkg-query -W -f='${Status}' "mariadb-server" 2>/dev/null | grep -c "ok installed")" == "1" ]; then - echo "MariaDB already installed" - else - echo "# Adding MariaDB $MDBVER repository" - apt-key adv --recv-keys --keyserver keyserver.ubuntu.com C74CD1D8 - echo "deb [arch=amd64] http://ftp.ddg.lth.se/mariadb/repo/$MDBVER/ubuntu $DISTRO_RELEASE main" > /etc/apt/sources.list.d/mariadb.list - apt-get update -q2 - fi -} add_php74() { if [ "$(dpkg-query -W -f='${Status}' "php$PHPVER-fpm" 2>/dev/null | grep -c "ok installed")" == "1" ]; then echo "PHP $PHPVER already installed" @@ -107,15 +97,13 @@ add_php74() { fi } #Prevent root folder permission issues -cp $PWD/files/patch_425_3dty.patch /tmp cp $PWD/files/jra-nc-app-ef.json /tmp -exit_ifinstalled mariadb-server +exit_ifinstalled postgresql-$PSGVER ## Install software requirements -# MariaDB -add_mariadb -install_ifnot mariadb-server-$MDBVER +# PostgresSQL +install_ifnot postgresql-$PSGVER # PHP 7.4 add_php74 @@ -129,7 +117,7 @@ apt-get install -y \ php$PHPVER-json \ php$PHPVER-ldap \ php$PHPVER-mbstring \ - php$PHPVER-mysql \ + php$PHPVER-pgsql \ php$PHPVER-soap \ php$PHPVER-xml \ php$PHPVER-xmlrpc \ @@ -182,18 +170,15 @@ systemctl restart php$PHPVER-fpm.service # Create MySQL user #-------------------------------------------------- -echo -e "\n---- Creating the MariaDB User ----" +echo -e "\n---- Creating the PgSQL DB & User ----" -mysql -u root < $NC_NGINX_CONF @@ -377,17 +362,11 @@ mv nextcloud $NC_PATH chown -R www-data:www-data $NC_PATH chmod -R 755 $NC_PATH -if $(dpkg --compare-versions "$NCVERSION" "le" "18.0.3"); then -echo " --> Patching #425 (scssphp/src/Compiler.php)..." -sudo -u www-data patch -d "$NC_PATH/3rdparty/leafo/scssphp/src/" -p0 < /tmp/patch_425_3dty.patch -fi - echo " Database installation... " sudo -u www-data php $NC_PATH/occ maintenance:install \ ---database=mysql \ +--database=pgsql \ --database-name="$NC_DB" \ --database-user="$NC_DB_USER" \ --database-pass="$NC_DB_PASSWD" \