From 07a182b25a612c23ccda476a6777ce1ef4c98a66 Mon Sep 17 00:00:00 2001 From: "TRIXServer.com" Date: Tue, 23 Apr 2024 00:52:22 -0300 Subject: [PATCH] better --- odoo_install.sh | 98 ++++++------------------------------------------- 1 file changed, 11 insertions(+), 87 deletions(-) diff --git a/odoo_install.sh b/odoo_install.sh index 6431080..e6ed585 100644 --- a/odoo_install.sh +++ b/odoo_install.sh @@ -33,7 +33,7 @@ INSTALL_NGINX="False" OE_SUPERADMIN="admin" # Set to "True" to generate a random password, "False" to use the variable in OE_SUPERADMIN GENERATE_RANDOM_PASSWORD="True" -OE_CONFIG="${OE_USER}-server" +OE_CONFIG="${OE_USER}/${OE_USER}" # Set the website name WEBSITE_NAME="_" # Set the default Odoo longpolling port (you still have to use -c /etc/odoo-server.conf for example to use this.) @@ -50,7 +50,7 @@ ADMIN_EMAIL="odoo@example.com" ## https://www.odoo.com/documentation/13.0/setup/install.html#debian-ubuntu WKHTMLTOX_X64="https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.$(lsb_release -c -s)_amd64.deb" -WKHTMLTOX_X32="https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.$(lsb_release -c -s)_i386.deb" +WKHTMLTOX_X32="https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.$(lsb_release -c -s)_amd64.deb" #-------------------------------------------------- # Update Server #-------------------------------------------------- @@ -60,6 +60,10 @@ sudo add-apt-repository universe # libpng12-0 dependency for wkhtmltopdf sudo add-apt-repository "deb http://mirrors.kernel.org/ubuntu/ xenial main" sudo apt-get update +sudo apt-get install software-properties-common -y +sudo apt-get update +sudo add-apt-repository ppa:linuxuprising/libpng12 -y +sudo apt update sudo apt-get upgrade -y #-------------------------------------------------- @@ -152,8 +156,6 @@ echo -e "\n---- Setting permissions on home folder ----" sudo chown -R $OE_USER:$OE_USER $OE_HOME/* echo -e "* Create server config file" - - sudo touch /etc/${OE_CONFIG}.conf echo -e "* Creating server config file" sudo su root -c "printf '[options] \n; This is the password that allows database operations:\n' >> /etc/${OE_CONFIG}.conf" @@ -177,89 +179,11 @@ fi sudo chown $OE_USER:$OE_USER /etc/${OE_CONFIG}.conf sudo chmod 640 /etc/${OE_CONFIG}.conf -echo -e "* Create startup file" -sudo su root -c "echo '#!/bin/sh' >> $OE_HOME_EXT/start.sh" -sudo su root -c "echo 'sudo -u $OE_USER $OE_HOME_EXT/odoo-bin --config=/etc/${OE_CONFIG}.conf' >> $OE_HOME_EXT/start.sh" -sudo chmod 755 $OE_HOME_EXT/start.sh - -#-------------------------------------------------- -# Adding ODOO as a deamon (initscript) -#-------------------------------------------------- - -echo -e "* Create init file" -cat < ~/$OE_CONFIG -#!/bin/sh -### BEGIN INIT INFO -# Provides: $OE_CONFIG -# Required-Start: \$remote_fs \$syslog -# Required-Stop: \$remote_fs \$syslog -# Should-Start: \$network -# Should-Stop: \$network -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Enterprise Business Applications -# Description: ODOO Business Applications -### END INIT INFO -PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin -DAEMON=$OE_HOME_EXT/odoo-bin -NAME=$OE_CONFIG -DESC=$OE_CONFIG -# Specify the user name (Default: odoo). -USER=$OE_USER -# Specify an alternate config file (Default: /etc/openerp-server.conf). -CONFIGFILE="/etc/${OE_CONFIG}.conf" -# pidfile -PIDFILE=/var/run/\${NAME}.pid -# Additional options that are passed to the Daemon. -DAEMON_OPTS="-c \$CONFIGFILE" -[ -x \$DAEMON ] || exit 0 -[ -f \$CONFIGFILE ] || exit 0 -checkpid() { -[ -f \$PIDFILE ] || return 1 -pid=\`cat \$PIDFILE\` -[ -d /proc/\$pid ] && return 0 -return 1 -} -case "\${1}" in -start) -echo -n "Starting \${DESC}: " -start-stop-daemon --start --quiet --pidfile \$PIDFILE \ ---chuid \$USER --background --make-pidfile \ ---exec \$DAEMON -- \$DAEMON_OPTS -echo "\${NAME}." -;; -stop) -echo -n "Stopping \${DESC}: " -start-stop-daemon --stop --quiet --pidfile \$PIDFILE \ ---oknodo -echo "\${NAME}." -;; -restart|force-reload) -echo -n "Restarting \${DESC}: " -start-stop-daemon --stop --quiet --pidfile \$PIDFILE \ ---oknodo -sleep 1 -start-stop-daemon --start --quiet --pidfile \$PIDFILE \ ---chuid \$USER --background --make-pidfile \ ---exec \$DAEMON -- \$DAEMON_OPTS -echo "\${NAME}." -;; -*) -N=/etc/init.d/\$NAME -echo "Usage: \$NAME {start|stop|restart|force-reload}" >&2 -exit 1 -;; -esac -exit 0 -EOF - -echo -e "* Security Init File" -sudo mv ~/$OE_CONFIG /etc/init.d/$OE_CONFIG -sudo chmod 755 /etc/init.d/$OE_CONFIG -sudo chown root: /etc/init.d/$OE_CONFIG - -echo -e "* Start ODOO on Startup" -sudo update-rc.d $OE_CONFIG defaults +sudo ln -s $OE_HOME_EXT/odoo-bin /usr/bin/odoo +sudo ln -s $OE_HOME_EXT/debian/odoo.service /etc/systemd/system/ +sudo systemctl daemon-reload +sudo systemctl enable odoo +sudo systemctl start odoo #-------------------------------------------------- # Install Nginx if needed