From 75aa0187b1aa07a4781c9e11b7cc36d146191c97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc?= <1536036+zoic21@users.noreply.github.com> Date: Fri, 6 Sep 2024 09:13:46 +0200 Subject: [PATCH 1/9] improve installation --- install/install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install/install.sh b/install/install.sh index 8dfd9671ba..8adc392921 100644 --- a/install/install.sh +++ b/install/install.sh @@ -167,6 +167,7 @@ step_6_jeedom_download() { fi cp -R /root/core-*/* ${WEBSERVER_HOME} cp -R /root/core-*/.[^.]* ${WEBSERVER_HOME} + find ${WEBSERVER_HOME}/ -exec touch {} + rm -rf /root/core-* > /dev/null 2>&1 rm /tmp/jeedom.zip echo "${GREEN}Step 6 - download Jeedom done${NORMAL}" From 628fc2d2ce48b6fda58a35fa57b0bdab7f8f0f46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc?= <1536036+zoic21@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:44:43 +0200 Subject: [PATCH 2/9] Update install.sh --- install/install.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/install/install.sh b/install/install.sh index 8adc392921..be938b06be 100644 --- a/install/install.sh +++ b/install/install.sh @@ -167,6 +167,7 @@ step_6_jeedom_download() { fi cp -R /root/core-*/* ${WEBSERVER_HOME} cp -R /root/core-*/.[^.]* ${WEBSERVER_HOME} + cp -R /root/core-*/.htaccess ${WEBSERVER_HOME}/htaccess find ${WEBSERVER_HOME}/ -exec touch {} + rm -rf /root/core-* > /dev/null 2>&1 rm /tmp/jeedom.zip @@ -346,6 +347,11 @@ step_10_jeedom_installation() { exit 1 fi fi + + if [ ! -f ${WEBSERVER_HOME}/.htaccess ];then + cp -R ${WEBSERVER_HOME}/htaccess ${WEBSERVER_HOME}/.htaccess + fi + rm ${WEBSERVER_HOME}/.htaccess echo "${GREEN}Step 10 - Jeedom install done${NORMAL}" } From 32e68dae9ec16eb58bdc66d8fdccbc0bdd1503bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc?= <1536036+zoic21@users.noreply.github.com> Date: Sat, 7 Sep 2024 10:34:32 +0200 Subject: [PATCH 3/9] improve docker --- Dockerfile | 46 ++++---- install/OS_specific/Docker/init.sh | 181 +++++++++++++++++++---------- 2 files changed, 148 insertions(+), 79 deletions(-) diff --git a/Dockerfile b/Dockerfile index a5fabd5067..30cbc3fa4c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG DEBIAN=bullseye +ARG DEBIAN=bookworm-slim FROM debian:${DEBIAN} ARG DEBIAN @@ -8,7 +8,15 @@ ENV WEBSERVER_HOME=${WEBSERVER_HOME} ARG VERSION=master ENV VERSION=${VERSION} ARG DATABASE=1 +ENV APACHE_HTTP_PORT=80 +ENV APACHE_HTTPS_PORT=443 ENV DATABASE=${DATABASE} +ENV DB_USERNAME=jeedom +ENV DB_NAME=jeedom +ENV DB_PORT=3306 +ENV DB_HOST=localhost +ENV TZ=America/Chicago +ENV DEBUG=0 # labels follows opencontainers convention LABEL org.opencontainers.image.title='Jeedom' @@ -25,37 +33,35 @@ WORKDIR ${WEBSERVER_HOME} VOLUME ${WEBSERVER_HOME} VOLUME /var/lib/mysql +#speed up build using docker cache +RUN apt update -y +RUN apt -o Dpkg::Options::="--force-confdef" -y install software-properties-common \ + ntp ca-certificates unzip curl sudo cron locate tar telnet wget logrotate dos2unix ntpdate htop \ + iotop vim iftop smbclient git python3 python3-pip libexpat1 ssl-cert \ + apt-transport-https xvfb cutycapt xauth at mariadb-client espeak net-tools nmap ffmpeg usbutils \ + gettext libcurl3-gnutls chromium librsync-dev ssl-cert iputils-ping \ + apache2 apache2-utils libexpat1 ssl-cert \ + php libapache2-mod-php php-json php-mysql php-curl php-gd php-imap php-xml php-opcache php-soap php-xmlrpc \ + php-common php-dev php-zip php-ssh2 php-mbstring php-ldap php-yaml php-snmp && apt -y remove brltty + COPY install/install.sh /tmp/ -# install step by step : step_1_upgrade RUN sh /tmp/install.sh -s 1 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker -# step_2_mainpackage RUN sh /tmp/install.sh -s 2 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker -# step_3_database RUN sh /tmp/install.sh -s 3 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker -# step_4_apache RUN sh /tmp/install.sh -s 4 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker -# step_5_php RUN sh /tmp/install.sh -s 5 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker -# step 6 : copy jeedom source files COPY . ${WEBSERVER_HOME} -# step_7_jeedom_customization_mariadb RUN sh /tmp/install.sh -s 7 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker -# step_8_jeedom_customization RUN sh /tmp/install.sh -s 8 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker -# step_9_jeedom_configuration RUN sh /tmp/install.sh -s 9 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker -# step_10_jeedom_installation RUN sh /tmp/install.sh -s 10 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker -# step_11_jeedom_post RUN sh /tmp/install.sh -s 11 -v ${VERSION} -w ${WEBSERVER_HOME} -d ${DATABASE} -i docker +RUN apt-get clean && rm -rf /var/lib/apt/lists/* +RUN echo >${WEBSERVER_HOME}/initialisation -# cleanup -RUN apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -# this file is a flag to trigger init.sh initialisation -RUN touch initialisation - +WORKDIR ${WEBSERVER_HOME} EXPOSE 80 -COPY install/OS_specific/Docker/init.sh /root/ +EXPOSE 443 +COPY --chown=root:root --chmod=550 install/OS_specific/Docker/init.sh /root/ +COPY --chown=root:root --chmod=550 install/bashrc /root/.bashrc CMD ["bash", "/root/init.sh"] \ No newline at end of file diff --git a/install/OS_specific/Docker/init.sh b/install/OS_specific/Docker/init.sh index a34be070f8..be831085e2 100644 --- a/install/OS_specific/Docker/init.sh +++ b/install/OS_specific/Docker/init.sh @@ -1,5 +1,6 @@ -#!/bin/bash +#!/usr/bin/env bash +#Variables VERT="\\033[1;32m" NORMAL="\\033[0;39m" ROUGE="\\033[1;31m" @@ -11,70 +12,132 @@ JAUNE="\\033[1;33m" CYAN="\\033[1;36m" FILE_STOP="/root/stop_requested" - -docker_stop(){ - echo "${JAUNE}Stopping Jeedom container${NORMAL}" - echo "${VERT}Killing CRON${NORMAL}" - killall cron - echo "${VERT}Stopping Apache gracefully${NORMAL}" - service apache2 stop - echo "${VERT}Stopping Database gracefully${NORMAL}" - service mariadb stop - echo "${VERT}Stopping ATD gracefully${NORMAL}" - service atd stop - echo "${ROUGE}Requesting stop on init.sh${NORMAL}" - touch ${FILE_STOP} - exit 0 -} +if [[ -e "${FILE_STOP}" ]]; then rm ${FILE_STOP}; fi # flag to fail fast on errors set -e +# enable debug if required. +[[ ${DEBUG:-0} -eq 1 ]] && set -x ||true + + +#Functions +docker_stop() { + echo "${JAUNE}Stopping Jeedom container${NORMAL}" + echo "${VERT}Killing CRON${NORMAL}" + killall cron + echo "${VERT}Stopping Apache gracefully${NORMAL}" + service apache2 stop + if [[ 1 -eq ${ISMARIABDBINSTALLED} ]]; then + echo "${VERT}Stopping Database gracefully${NORMAL}" + service mariadb stop + fi + echo "${VERT}Stopping ATD gracefully${NORMAL}" + service atd stop + echo "${ROUGE}Requesting stop on init.sh${NORMAL}" + touch ${FILE_STOP} + exit 0 +} -# $WEBSERVER_HOME and $VERSION env variables comes from Dockerfile +setTimeZone() { + [[ ${TZ} == $( + Listen ${APACHE_HTTPS_PORT:-443} + + + + Listen ${APACHE_HTTPS_PORT:-443} +" >/etc/apache2/ports.conf + sed -i -E "s/\/VirtualHost \*:${APACHE_HTTP_PORT}/" /etc/apache2/sites-available/000-default.conf + sed -i -E "s/\/VirtualHost \*:${APACHE_HTTPS_PORT}/" /etc/apache2/sites-available/default-ssl.conf + fi +} - service mariadb start - service mariadb status +db_creds(){ + cp ${WEBSERVER_HOME}/core/config/common.config.sample.php ${WEBSERVER_HOME}/core/config/common.config.php + sed -i "s/#PASSWORD#/${DB_PASSWORD}/g" ${WEBSERVER_HOME}/core/config/common.config.php + sed -i "s/#DBNAME#/${DB_NAME:-jeedom}/g" ${WEBSERVER_HOME}/core/config/common.config.php + sed -i "s/#USERNAME#/${DB_USERNAME:-jeedom}/g" ${WEBSERVER_HOME}/core/config/common.config.php + sed -i "s/#PORT#/${DB_PORT:-3306}/g" ${WEBSERVER_HOME}/core/config/common.config.php + sed -i "s/#HOST#/${DB_HOST:-localhost}/g" ${WEBSERVER_HOME}/core/config/common.config.php +} - DB_PASSWORD=$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 15) - echo "DROP USER IF EXISTS 'jeedom'@'localhost';" | mysql - echo "CREATE USER 'jeedom'@'localhost' IDENTIFIED BY '${DB_PASSWORD}';" | mysql - echo "DROP DATABASE IF EXISTS jeedom;" | mysql - echo "CREATE DATABASE jeedom;" | mysql - echo "GRANT ALL PRIVILEGES ON jeedom.* TO 'jeedom'@'localhost';" | mysql +#Main +# $WEBSERVER_HOME and $VERSION env variables comes from Dockerfile +set +e +dpkg -l mariadb-server 2>/dev/null +status=$? +ISMARIADBSERVER=$(( 1 - ${status} )) - cp ${WEBSERVER_HOME}/core/config/common.config.sample.php ${WEBSERVER_HOME}/core/config/common.config.php - sed -i "s/#PASSWORD#/${DB_PASSWORD}/g" ${WEBSERVER_HOME}/core/config/common.config.php - sed -i "s/#DBNAME#/${DB_NAME:-jeedom}/g" ${WEBSERVER_HOME}/core/config/common.config.php - sed -i "s/#USERNAME#/${DB_USERNAME:-jeedom}/g" ${WEBSERVER_HOME}/core/config/common.config.php - sed -i "s/#PORT#/${DB_PORT:-3306}/g" ${WEBSERVER_HOME}/core/config/common.config.php - sed -i "s/#HOST#/${DB_HOST:-localhost}/g" ${WEBSERVER_HOME}/core/config/common.config.php +if [[ -f ${WEBSERVER_HOME}/initialisation ]]; then + echo "************************ +Start Jeedom initialisation ! +************************" + JEEDOM_INSTALL=0 + # mariadb server is installed + if [[ 1 -eq ${ISMARIADBSERVER} ]]; then echo "************************ + Start mariadb service + ************************" + service mariadb start + service mariadb status + DB_PASSWORD=$(openssl rand -base64 32 | tr -d /=+) + echo "DROP USER IF EXISTS 'jeedom'@'%';" | mysql + echo "CREATE USER 'jeedom'@'%' IDENTIFIED BY '${DB_PASSWORD}';" | mysql + echo "DROP DATABASE IF EXISTS jeedom;" | mysql + echo "CREATE DATABASE jeedom;" | mysql + echo "GRANT ALL PRIVILEGES ON jeedom.* TO 'jeedom'@'%';" | mysql + fi + #define php db conf + db_creds + echo "************************ start JEEDOM PHP script installation ************************" - - php ${WEBSERVER_HOME}/install/install.php mode=force - + php "${WEBSERVER_HOME}/install/install.php" mode=force # remove the flag file after the first successfull installation - rm ${WEBSERVER_HOME}/initialisation + rm "${WEBSERVER_HOME}/initialisation" fi -echo 'Start atd' +#set admin password if needed +if [[ "${JEEDOM_INSTALL}" == 0 ]] && [[ ! -z "${ADMIN_PASSWORD}" ]]; then + echo "Set admin password with env var" + php "${WEBSERVER_HOME}/core/php/jeecli.php" user password admin "${ADMIN_PASSWORD}" +fi + +#set timezone +setTimeZone + +#setup apache port +apache_setup +#setup root passwd +set_root_password + service atd restart service atd status if [[ $(which mysqld | wc -l) -ne 0 ]]; then - echo 'Starting mariadb' + echo "Restarting mariadb service" chown -R mysql:mysql /var/lib/mysql /var/run/mysqld service mariadb restart if [ $? -ne 0 ]; then @@ -85,32 +148,32 @@ if [[ $(which mysqld | wc -l) -ne 0 ]]; then fi fi -if [[ ${JEEDOM_INSTALL} == 0 ]] && [[ ! -z "${RESTOREBACKUP}" ]] && [[ "${RESTOREBACKUP}" != 'NO' ]]; then - echo 'Need restore backup '${RESTOREBACKUP} - wget ${RESTOREBACKUP} -O /tmp/backup.tar.gz - php ${WEBSERVER_HOME}/install/restore.php backup=/tmp/backup.tar.gz +if [[ "${JEEDOM_INSTALL}" == 0 ]] && [[ ! -z "${RESTOREBACKUP}" ]] && [[ "${RESTOREBACKUP}" != "NO" ]]; then + echo "Need restore backup ${RESTOREBACKUP}" + wget "${RESTOREBACKUP}" -O /tmp/backup.tar.gz + php "${WEBSERVER_HOME}/install/restore.php backup=/tmp/backup.tar.gz" rm /tmp/backup.tar.gz - if [[ ! -z "${UPDATEJEEDOM}" ]] && [[ "${UPDATEJEEDOM}" != 'NO' ]]; then - echo 'Need update jeedom' - php ${WEBSERVER_HOME}/install/update.php + if [[ ! -z "${UPDATEJEEDOM}" ]] && [[ "${UPDATEJEEDOM}" != "NO" ]]; then + echo "Need update Jeedom" + php "${WEBSERVER_HOME}/install/update.php" fi fi -echo 'All init complete' -chmod 777 /dev/tty* -chmod 755 -R ${WEBSERVER_HOME} +echo "All init complete" +chmod 755 -R "${WEBSERVER_HOME}" -echo 'Start apache2' service apache2 start service apache2 status -echo 'Start CRON daemon' + +echo "Start cron daemon" cron # step_12_jeedom_check -sh /tmp/install.sh -s 12 -v ${VERSION} -w ${WEBSERVER_HOME} -i docker +sh ${WEBSERVER_HOME}/install/install.sh -s 12 -v ${VERSION} -w ${WEBSERVER_HOME} -i docker #TAKE CARE : the init.sh script is running under sh so trap only takes signal_number -echo 'Add trap docker_stop' +echo "Add trap docker_stop" trap "docker_stop $$ ;" 15 while [[ ! -e "${FILE_STOP}" ]]; do sleep 1; done +rm ${FILE_STOP} \ No newline at end of file From ab0a197cf7ec99b7ae79db68ae9478afd3ffc6f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc?= <1536036+zoic21@users.noreply.github.com> Date: Sat, 7 Sep 2024 11:13:58 +0200 Subject: [PATCH 4/9] bump to 4.4.16 --- core/config/version | 2 +- desktop/js/replace.js | 7 +++---- docs/fr_FR/changelog.md | 6 ++++++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/core/config/version b/core/config/version index db27cb2df2..4e91350dcc 100644 --- a/core/config/version +++ b/core/config/version @@ -1 +1 @@ -4.4.15 \ No newline at end of file +4.4.16 \ No newline at end of file diff --git a/desktop/js/replace.js b/desktop/js/replace.js index 25261b0975..c4e8ed5522 100644 --- a/desktop/js/replace.js +++ b/desktop/js/replace.js @@ -33,8 +33,8 @@ if (!jeeFrontEnd.replace) { var key = null document.querySelectorAll('#objectFilter .objectFilterKey').forEach(_filter => { if (_filter.checked) { - key = parseInt(_filter.getAttribute('data-key')) - if (isNaN(key)) key = null + key = _filter.getAttribute('data-key') + if (key == '') key = null jeeP.filteredObjects.push(key) } }) @@ -541,5 +541,4 @@ document.getElementById('eqSource').addEventListener('change', function(event) { jeeP.selectReplacerEqlogic(_target.closest('select.selectEqReplace')) return } -}) - +}) \ No newline at end of file diff --git a/docs/fr_FR/changelog.md b/docs/fr_FR/changelog.md index 76172bc9c4..80c7dd7595 100644 --- a/docs/fr_FR/changelog.md +++ b/docs/fr_FR/changelog.md @@ -1,5 +1,11 @@ # Changelog Jeedom V4.4 +# 4.4.16 + +- Correction d'un bug sur les filtre de la page de remplacement +- Correction de bugs sur la version docker [LIEN](https://github.com/jeedom/core/commit/32e68dae9ec16eb58bdc66d8fdccbc0bdd1503bd) + + # 4.4.15 - Correction d'un bug ou la connexion à Jeedom ne pouvait pas etre auto remplis par le navigateur [LIEN](https://github.com/jeedom/core/pull/2854) From c9ee8e072d4abe7ed8d358fbbd832706dfebc55c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc?= <1536036+zoic21@users.noreply.github.com> Date: Sat, 7 Sep 2024 11:23:25 +0200 Subject: [PATCH 5/9] update build docker --- .github/workflows/docker-image-latest.yml | 1 - docs/fr_FR/changelog.md | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/docker-image-latest.yml b/.github/workflows/docker-image-latest.yml index eb21f72892..f9e03a6d21 100644 --- a/.github/workflows/docker-image-latest.yml +++ b/.github/workflows/docker-image-latest.yml @@ -5,7 +5,6 @@ on: # only trigger CI when push on following branches branches: - 'master' - - 'beta' # this is to manually trigger the worklow workflow_dispatch: inputs: diff --git a/docs/fr_FR/changelog.md b/docs/fr_FR/changelog.md index 80c7dd7595..11fcbbddc1 100644 --- a/docs/fr_FR/changelog.md +++ b/docs/fr_FR/changelog.md @@ -2,7 +2,7 @@ # 4.4.16 -- Correction d'un bug sur les filtre de la page de remplacement +- Correction d'un bug sur les filtre de la page de remplacement [LIEN](https://github.com/jeedom/core/commit/ab0a197cf7ec99b7ae79db68ae9478afd3ffc6f1) - Correction de bugs sur la version docker [LIEN](https://github.com/jeedom/core/commit/32e68dae9ec16eb58bdc66d8fdccbc0bdd1503bd) From 713708d34fffc7dc240bec09b29c867a9878e9ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc?= <1536036+zoic21@users.noreply.github.com> Date: Sat, 7 Sep 2024 11:45:24 +0200 Subject: [PATCH 6/9] review all docker file --- install/OS_specific/Docker/init.sh | 165 ++++++++++++----------------- 1 file changed, 69 insertions(+), 96 deletions(-) diff --git a/install/OS_specific/Docker/init.sh b/install/OS_specific/Docker/init.sh index be831085e2..ca57203726 100644 --- a/install/OS_specific/Docker/init.sh +++ b/install/OS_specific/Docker/init.sh @@ -1,6 +1,4 @@ -#!/usr/bin/env bash - -#Variables +#!/bin/bash VERT="\\033[1;32m" NORMAL="\\033[0;39m" ROUGE="\\033[1;31m" @@ -10,17 +8,19 @@ BLANC="\\033[0;02m" BLANCLAIR="\\033[1;08m" JAUNE="\\033[1;33m" CYAN="\\033[1;36m" + +service_mariadb(){ + service mysql $1 + if [ $? -ne 0 ]; then + service mariadb $1 + if [ $? -ne 0 ]; then + echo "${ROUGE}Cannot start mariadb - Cancelling${NORMAL}" + return 1 + fi + fi + return 0 +} -FILE_STOP="/root/stop_requested" -if [[ -e "${FILE_STOP}" ]]; then rm ${FILE_STOP}; fi - -# flag to fail fast on errors -set -e -# enable debug if required. -[[ ${DEBUG:-0} -eq 1 ]] && set -x ||true - - -#Functions docker_stop() { echo "${JAUNE}Stopping Jeedom container${NORMAL}" echo "${VERT}Killing CRON${NORMAL}" @@ -60,120 +60,93 @@ apache_setup() { if [[ 3 -ne $(grep -cP "(${APACHE_HTTP_PORT}|${APACHE_HTTPS_PORT})" /etc/apache2/ports.conf) ]]; then echo "Ports update for apache2: ${APACHE_HTTP_PORT}, ${APACHE_HTTPS_PORT}" echo "Listen ${APACHE_HTTP_PORT} + + Listen ${APACHE_HTTPS_PORT:-443} + - - Listen ${APACHE_HTTPS_PORT:-443} - - - - Listen ${APACHE_HTTPS_PORT:-443} -" >/etc/apache2/ports.conf + + Listen ${APACHE_HTTPS_PORT:-443} + " >/etc/apache2/ports.conf sed -i -E "s/\/VirtualHost \*:${APACHE_HTTP_PORT}/" /etc/apache2/sites-available/000-default.conf sed -i -E "s/\/VirtualHost \*:${APACHE_HTTPS_PORT}/" /etc/apache2/sites-available/default-ssl.conf fi } -db_creds(){ - cp ${WEBSERVER_HOME}/core/config/common.config.sample.php ${WEBSERVER_HOME}/core/config/common.config.php - sed -i "s/#PASSWORD#/${DB_PASSWORD}/g" ${WEBSERVER_HOME}/core/config/common.config.php - sed -i "s/#DBNAME#/${DB_NAME:-jeedom}/g" ${WEBSERVER_HOME}/core/config/common.config.php - sed -i "s/#USERNAME#/${DB_USERNAME:-jeedom}/g" ${WEBSERVER_HOME}/core/config/common.config.php - sed -i "s/#PORT#/${DB_PORT:-3306}/g" ${WEBSERVER_HOME}/core/config/common.config.php - sed -i "s/#HOST#/${DB_HOST:-localhost}/g" ${WEBSERVER_HOME}/core/config/common.config.php -} +echo 'Start init' -#Main # $WEBSERVER_HOME and $VERSION env variables comes from Dockerfile -set +e -dpkg -l mariadb-server 2>/dev/null -status=$? -ISMARIADBSERVER=$(( 1 - ${status} )) - - -if [[ -f ${WEBSERVER_HOME}/initialisation ]]; then - echo "************************ -Start Jeedom initialisation ! -************************" - JEEDOM_INSTALL=0 - # mariadb server is installed - if [[ 1 -eq ${ISMARIADBSERVER} ]]; then - echo "************************ - Start mariadb service - ************************" - service mariadb start - service mariadb status - DB_PASSWORD=$(openssl rand -base64 32 | tr -d /=+) - echo "DROP USER IF EXISTS 'jeedom'@'%';" | mysql - echo "CREATE USER 'jeedom'@'%' IDENTIFIED BY '${DB_PASSWORD}';" | mysql - echo "DROP DATABASE IF EXISTS jeedom;" | mysql - echo "CREATE DATABASE jeedom;" | mysql - echo "GRANT ALL PRIVILEGES ON jeedom.* TO 'jeedom'@'%';" | mysql - fi - #define php db conf - db_creds - echo "************************ -start JEEDOM PHP script installation -************************" - php "${WEBSERVER_HOME}/install/install.php" mode=force - # remove the flag file after the first successfull installation - rm "${WEBSERVER_HOME}/initialisation" -fi -#set admin password if needed -if [[ "${JEEDOM_INSTALL}" == 0 ]] && [[ ! -z "${ADMIN_PASSWORD}" ]]; then - echo "Set admin password with env var" - php "${WEBSERVER_HOME}/core/php/jeecli.php" user password admin "${ADMIN_PASSWORD}" +if [ -f ${WEBSERVER_HOME}/core/config/common.config.php ]; then + echo 'Jeedom is already install' + JEEDOM_INSTALL=1 +else + echo 'Start jeedom installation' + JEEDOM_INSTALL=0 + rm -rf /root/install.sh + wget https://raw.githubusercontent.com/jeedom/core/${VERSION}/install/install.sh -O /root/install.sh + chmod +x /root/install.sh + /root/install.sh -s 6 -v ${VERSION} -w ${WEBSERVER_HOME} + if [ $(which mysqld | wc -l) -ne 0 ]; then + chown -R mysql:mysql /var/lib/mysql + mysql_install_db --user=mysql --basedir=/usr/ --ldata=/var/lib/mysql/ + service_mariadb restart + MYSQL_JEEDOM_PASSWD=$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 15) + echo "DROP USER 'jeedom'@'localhost';" | mysql > /dev/null 2>&1 + echo "CREATE USER 'jeedom'@'localhost' IDENTIFIED BY '${MYSQL_JEEDOM_PASSWD}';" | mysql + echo "DROP DATABASE IF EXISTS jeedom;" | mysql + echo "CREATE DATABASE jeedom;" | mysql + echo "GRANT ALL PRIVILEGES ON jeedom.* TO 'jeedom'@'localhost';" | mysql + cp ${WEBSERVER_HOME}/core/config/common.config.sample.php ${WEBSERVER_HOME}/core/config/common.config.php + sed -i "s/#PASSWORD#/${MYSQL_JEEDOM_PASSWD}/g" ${WEBSERVER_HOME}/core/config/common.config.php + sed -i "s/#DBNAME#/jeedom/g" ${WEBSERVER_HOME}/core/config/common.config.php + sed -i "s/#USERNAME#/jeedom/g" ${WEBSERVER_HOME}/core/config/common.config.php + sed -i "s/#PORT#/3306/g" ${WEBSERVER_HOME}/core/config/common.config.php + sed -i "s/#HOST#/localhost/g" ${WEBSERVER_HOME}/core/config/common.config.php + /root/install.sh -s 10 -v ${VERSION} -w ${WEBSERVER_HOME} + /root/install.sh -s 11 -v ${VERSION} -w ${WEBSERVER_HOME} + fi fi -#set timezone setTimeZone - #setup apache port apache_setup #setup root passwd set_root_password +echo 'Start atd' service atd restart -service atd status -if [[ $(which mysqld | wc -l) -ne 0 ]]; then - echo "Restarting mariadb service" +if [ $(which mysqld | wc -l) -ne 0 ]; then + echo 'Starting mariadb' chown -R mysql:mysql /var/lib/mysql /var/run/mysqld - service mariadb restart + service_mariadb restart if [ $? -ne 0 ]; then - # That can lead to FATAL corruption of databases - # rm /var/lib/mysql/ib_logfile* - echo "${ROUGE}Starting Database FAILED${NORMAL}" - exit 1 + rm /var/lib/mysql/ib_logfile* + service_mariadb restart fi fi -if [[ "${JEEDOM_INSTALL}" == 0 ]] && [[ ! -z "${RESTOREBACKUP}" ]] && [[ "${RESTOREBACKUP}" != "NO" ]]; then - echo "Need restore backup ${RESTOREBACKUP}" - wget "${RESTOREBACKUP}" -O /tmp/backup.tar.gz - php "${WEBSERVER_HOME}/install/restore.php backup=/tmp/backup.tar.gz" +if [ ${JEEDOM_INSTALL} -eq 0 ] && [ ! -z "${RESTOREBACKUP}" ] && [ "${RESTOREBACKUP}" != 'NO' ]; then + echo 'Need restore backup '${RESTOREBACKUP} + wget ${RESTOREBACKUP} -O /tmp/backup.tar.gz + php ${WEBSERVER_HOME}/install/restore.php backup=/tmp/backup.tar.gz rm /tmp/backup.tar.gz - if [[ ! -z "${UPDATEJEEDOM}" ]] && [[ "${UPDATEJEEDOM}" != "NO" ]]; then - echo "Need update Jeedom" - php "${WEBSERVER_HOME}/install/update.php" + if [ ! -z "${UPDATEJEEDOM}" ] && [ "${UPDATEJEEDOM}" != 'NO' ]; then + echo 'Need update jeedom' + php ${WEBSERVER_HOME}/install/update.php fi fi -echo "All init complete" -chmod 755 -R "${WEBSERVER_HOME}" +echo 'All init complete' +chmod 777 /dev/tty* +chmod 777 -R /tmp +chmod 755 -R ${WEBSERVER_HOME} +chown -R www-data:www-data ${WEBSERVER_HOME} +echo 'Start apache2' service apache2 start -service apache2 status - -echo "Start cron daemon" -cron - -# step_12_jeedom_check -sh ${WEBSERVER_HOME}/install/install.sh -s 12 -v ${VERSION} -w ${WEBSERVER_HOME} -i docker -#TAKE CARE : the init.sh script is running under sh so trap only takes signal_number echo "Add trap docker_stop" trap "docker_stop $$ ;" 15 -while [[ ! -e "${FILE_STOP}" ]]; do sleep 1; done -rm ${FILE_STOP} \ No newline at end of file +cron -f \ No newline at end of file From fee96c032fabc7afdd8b5b146e4cdf235f1d1ffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc?= <1536036+zoic21@users.noreply.github.com> Date: Sat, 7 Sep 2024 11:47:14 +0200 Subject: [PATCH 7/9] fix --- install/OS_specific/Docker/init.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/install/OS_specific/Docker/init.sh b/install/OS_specific/Docker/init.sh index ca57203726..1bb9c50f77 100644 --- a/install/OS_specific/Docker/init.sh +++ b/install/OS_specific/Docker/init.sh @@ -23,8 +23,6 @@ service_mariadb(){ docker_stop() { echo "${JAUNE}Stopping Jeedom container${NORMAL}" - echo "${VERT}Killing CRON${NORMAL}" - killall cron echo "${VERT}Stopping Apache gracefully${NORMAL}" service apache2 stop if [[ 1 -eq ${ISMARIABDBINSTALLED} ]]; then @@ -34,7 +32,8 @@ docker_stop() { echo "${VERT}Stopping ATD gracefully${NORMAL}" service atd stop echo "${ROUGE}Requesting stop on init.sh${NORMAL}" - touch ${FILE_STOP} + echo "${VERT}Killing CRON${NORMAL}" + killall cron exit 0 } From 9a3ccff898ac611f09d705655ab6b66fb7a7fdc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc?= <1536036+zoic21@users.noreply.github.com> Date: Sun, 8 Sep 2024 18:58:01 +0200 Subject: [PATCH 8/9] fix #2888 --- core/php/jeecli.php | 1 + 1 file changed, 1 insertion(+) diff --git a/core/php/jeecli.php b/core/php/jeecli.php index 3d4b1a4a72..20dd71ae51 100644 --- a/core/php/jeecli.php +++ b/core/php/jeecli.php @@ -51,6 +51,7 @@ die(); } $plugin->setIsEnable(1,true,true); + jeedom::cleanFileSystemRight(); break; case 'dependancy_end': if (!isset($argv[3])) { From 17605198ff58c6d2cd7e55176e02e63e37749ca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc?= <1536036+zoic21@users.noreply.github.com> Date: Sun, 8 Sep 2024 18:58:45 +0200 Subject: [PATCH 9/9] update changelog --- docs/fr_FR/changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/fr_FR/changelog.md b/docs/fr_FR/changelog.md index 11fcbbddc1..3b571eb383 100644 --- a/docs/fr_FR/changelog.md +++ b/docs/fr_FR/changelog.md @@ -4,6 +4,7 @@ - Correction d'un bug sur les filtre de la page de remplacement [LIEN](https://github.com/jeedom/core/commit/ab0a197cf7ec99b7ae79db68ae9478afd3ffc6f1) - Correction de bugs sur la version docker [LIEN](https://github.com/jeedom/core/commit/32e68dae9ec16eb58bdc66d8fdccbc0bdd1503bd) +- Correction d'un bug sur les droits lors de l'installation d'un plugin en dependance d'un autre [LIEN](https://github.com/jeedom/core/issues/2888) # 4.4.15