#!/bin/bash # # Installs selected content from the downloaded repos into a production folder # if [ $UID != 0 ]; then echo "You need administration privileges to run this script." exit 1 fi DESTDIR=/opt/odoo OPTIONS="-av --exclude-from=common_exclude_patterns.txt --chown odoo:odoo" Help () { echo "Usage: $0 [-h] -o={all|core|community|apps|vendor|special|custom}" echo echo "Options:" echo "-h Help (display this text)" echo "-o Modules to be installed (one of 'all', 'core', 'community'," echo " 'apps', 'vendor', 'special, 'custom'). Required." echo } cp_core () { REPO="Odoo 14.0 core" SRC=./core/ DEST=$DESTDIR/core/ echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Install $REPO into production directory structure" echo " …from $SRC to $DEST" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" rsync $OPTIONS $SRC $DEST } cp_community () { REPO="Modules by Odoo Community Association" SRC=./community/oca DEST=$DESTDIR/community/ echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Install $REPO into production directory structure" echo "(selected modules)" echo " …from $SRC to $DEST" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" while read -r i || [ -n "$i" ] do rsync $OPTIONS "$SRC/${i%/}" $DEST done < selected_oca_modules.txt } cp_apps () { REPO="Modules from Odoo Apps Store" SRC=./apps/ DEST=$DESTDIR/apps/ echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Install $REPO into production directory structure" echo " …from $SRC to $DEST" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" rsync $OPTIONS $SRC $DEST } cp_vendor () { REPO="Avancys v14 for Agofer" SRC=./vendor/ DEST=$DESTDIR/vendor/ echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Install $REPO into production directory structure" echo "(selected modules)" echo " …from $SRC to $DEST" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" # Exclude proprietary modules, and modules included in other repos. rsync $OPTIONS --exclude-from=rejected_vendor_modules.txt $SRC $DEST } cp_special () { REPO="Special Avancys v14 electronic invoice" SRC=./special/ DEST=$DESTDIR/vendor/ echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Install $REPO into production directory structure" echo "(selected modules)" echo " …from $SRC to $DEST" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" rsync $OPTIONS --exclude-from=rejected_modules.txt \ $SRC $DEST } cp_custom () { REPO="Custom in-house modules " SRC=./custom/ DEST=$DESTDIR/custom/ echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Install $REPO into production directory structure" echo " …from $SRC to $DEST" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" rsync $OPTIONS $SRC $DEST } cp_all () { cp_core # Install Odoo core cp_community # Install OCA modules cp_vendor # Install Avancys modules cp_custom # Install Custom modules } if (($# == 0)) then Help exit fi while getopts ":ho:" option; do case $option in h) # display Help Help exit;; o) # Enter a name Modules=$OPTARG;; *) # Invalid option echo "Error: Invalid option" echo Help exit;; esac done case $Modules in 'all') # Install all modules cp_all exit;; 'core') # Install Odoo core cp_core exit;; 'apps') # Install modules from Apps Store cp_apps exit;; 'community') # Install OCA modules cp_community exit;; 'vendor') # Install Avancys modules cp_vendor exit;; 'special') # Install Avancys e-invoice modules cp_special exit;; 'custom') # Install Custom modules developed in-house cp_custom exit;; *) # Invalid option echo "Error: Invalid module" echo Help exit;; esac