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.
 
 

31 lines
1.0 KiB

#!/bin/bash
CLIENT=$1
ADDON=$2
function usage() {
echo 'usage: <CLIENT> <ADDON>'
exit 1
}
# 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/odoo12-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/12.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/
chown -R odoo:odoo /tmp/ADDON/
mv /tmp/ADDON/odoo/addons/* /home/odoo/data-${CLIENT}/addons/12.0/
echo "FORCE RELOADING ADDONS with: ./web?debug#menu_id=48&action=36"