Created
September 4, 2021 01:58
-
-
Save bitodoo/5855af900d626f377b9d3eaf5035de7d to your computer and use it in GitHub Desktop.
Mode posbox in PC with ubuntu 18.01.5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Run not as root | |
# ./install_posbox_in_pc.sh | |
# No LSB modules are available. | |
# Distributor ID: Ubuntu | |
# Description: Ubuntu 18.04.5 LTS | |
# Release: 18.04 | |
# Codename: bionic | |
VIRTUAL_NAME=.virt_odev10 | |
ODOO_SERVICE=odoo_10 | |
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install libldap2-dev libsasl2-dev npm nodejs git libxml2-dev libxslt1-dev libjpeg-dev gdebi postgresql virtualenv -y | |
sudo apt-get install python2.7 python2.7-lxml python2.7-ldap python2.7-dev python2.7-setuptools python-pip -y | |
cd | |
echo "Descargando odoo" | |
git clone https://github.com/odoo/odoo.git --branch=10.0 --depth=1 .odoo | |
echo "Creamos el usuario en la base de datos" | |
sudo -u postgres bash -c "psql -c \"CREATE USER ${USER} WITH PASSWORD '${USER}';\"" | |
echo "Creando el entorno virtual de python" | |
# python 2.7.15+ | |
virtualenv --no-site-packages $VIRTUAL_NAME -p /usr/bin/python2.7 | |
# Path virtualenv | |
VIRTUALENV_DIR=$HOME/$VIRTUAL_NAME | |
source $VIRTUALENV_DIR/bin/activate | |
echo "Instalamos los requerimientos" | |
pip install -r .odoo/requirements.txt | |
echo "Instalación final de los requerimientos" | |
echo "Cambiamos la versión de pyusb" | |
pip install netifaces evdev pyusb==1.0.0b1 | |
echo "Creamos el grupi usbusers" | |
sudo groupadd usbusers | |
sudo usermod -a -G usbusers $USER | |
echo "Creamos el archivo 99-usbusers.rules" | |
cat << EOF | sudo tee -a /etc/udev/rules.d/99-usbusers.rules | |
SUBSYSTEM=="usb", GROUP="usbusers", MODE="0660" | |
SUBSYSTEMS=="usb", GROUP="usbusers", MODE="0660" | |
EOF | |
echo "Instalamos Odoo" | |
cd .odoo | |
python setup.py install | |
echo "Creamos el archivo de configuración" | |
touch $HOME/.odoorc | |
sudo su root -c "printf '[options]\n' >> $HOME/.odoorc" | |
sudo su root -c "printf 'addons_path=${HOME}/.odoo/addons\n' >> $HOME/.odoorc" | |
sudo chown $USER:$USER $HOME/.odoorc | |
sudo chmod 640 $HOME/.odoorc | |
echo "Creamos el directorio para los logs" | |
mkdir $HOME/.log | |
LOG_DIR=$HOME/.log | |
echo "Creamos el archivo para la ejecución" | |
cat <<EOF > $HOME/.start.sh | |
#!/bin/bash | |
# run this as the odoo* user: $USER | |
source $VIRTUALENV_DIR/bin/activate | |
odoo --load=web,hw_proxy,hw_posbox_homepage,hw_escpos 1> $LOG_DIR/error.log 2> $LOG_DIR/debug.log | |
EOF | |
echo "Crea una unidad systemd para el entorno de Odoo. Esto le permite ejecutarlo como un servicio independiente." | |
cat << EOF | sudo tee -a /lib/systemd/system/$ODOO_SERVICE-server.service | |
[Unit] | |
Description=Odoo posbox mode | |
[Service] | |
Type=simple | |
PermissionsStartOnly=true | |
SyslogIdentifier=$ODOO_SERVICE-server | |
User=$USER | |
Group=$USER | |
ExecStart=$HOME/.start.sh | |
WorkingDirectory=$HOME | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
sudo chmod 755 /lib/systemd/system/$ODOO_SERVICE-server.service | |
sudo chown root: /lib/systemd/system/$ODOO_SERVICE-server.service | |
sudo chown $USER:$USER $HOME/.start.sh | |
chmod +x $HOME/.start.sh | |
echo "Ahora puede iniciar su nuevo servicio Odoo y verificar las entradas" | |
sudo systemctl start $ODOO_SERVICE-server.service | |
sudo systemctl status $ODOO_SERVICE-server.service | |
echo "Dejamos activo el servicio" | |
sudo systemctl enable $ODOO_SERVICE-server.service | |
# reboot | |
echo "End install" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, The posbox in version is compatible with odoo 14 ? Did you know if something similar is existing about odoo 14, I would try to install a posbox manualy for odoo 14 C but I can't find a procedure for. Odoo documentation to do it, stop at version 11.
Thanks