provisioning tool for building opinionated architecture
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#!/bin/bash
CLIENT=$1 ADDON=$2
function usage() { echo 'usage: <CLIENT> <ADDON>' exit 100 }
# VERIFICATION
[[ -z "$CLIENT" || -z "$ADDON" ]] && usage [[ ! -d "/home/odoo/data-${CLIENT}" ]] && echo "unknown CLIENT <${CLIENT}>, should exist in folder /home/odoo/data-..." && exit 2
URL="https://pypi.org/project/odoo-addon-${ADDON}/" curl --output /dev/null --silent --head --fail "${URL}" [[ $? -ne 0 ]] && echo "unknown ADDON <${ADDON}>, should be downloadable from: ${URL}" && exit 3
[[ -d "/home/odoo/data-${CLIENT}/addons/15.0/${ADDON}" ]] && echo "ADDON <${ADDON}> already exists, consider removing manually!" && exit 4
# ACTION
package=$(curl -Ls "$URL" | rg '<a href="(https://files.pythonhosted.org/.*)">' -r '$1') wget $package -O /tmp/package.zip rm /tmp/ADDON -rf && mkdir /tmp/ADDON unzip /tmp/package.zip 'odoo/addons/*' -d /tmp/ADDON/ real_name=$(unzip -l /tmp/package.zip | head -n4 | tail -n1 | cut -d'/' -f3) chown -R odoo:odoo /tmp/ADDON/ mv /tmp/ADDON/odoo/addons/* "/home/odoo/data-$CLIENT/addons/15.0/"
# ADD su odoo -c "python3.9 /home/odoo/odoo15/odoo-bin -c /etc/odoo15/$CLIENT.conf -i $real_name -d odoo15-$CLIENT --worker=0 --stop-after-init"
|