#!/bin/bash # # Updates code from the git repositories selected # Help () { echo "Usage: $0 [-h] -o={all|core|community|vendor|vendor02|custom}" echo echo "Options:" echo "-h Help (display this text)" echo "-o Repositories to be updated (one of 'all', 'core', 'community'," echo " 'vendor', 'vendor02, 'custom'). Required." echo } gt_core () { REPO="Odoo 14.0 core" SRC=https://github.com/odoo/odoo.git DEST=./core/ OPTIONS="--single-branch --depth 1 --branch 14.0" if [ ! -d "$DEST" ]; then echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Clone $REPO" echo " …to $DEST" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" git clone $OPTIONS $SRC $DEST else echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Update $REPO" echo " …in $DEST" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" git -C $DEST pull fi } gt_community () { REPO="Modules by Odoo Community Association" SRC=ssh://git@gitea.agofer.net:22001/Agofer/Community.git DEST=./community/ OPTIONS="--recurse-submodules" if [ ! -d "$DEST" ]; then echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Clone $REPO" echo " …to $DEST" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" git clone $OPTIONS $SRC $DEST else echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Update $REPO" echo " …in $DEST" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" git -C $DEST pull $OPTIONS fi } gt_vendor () { REPO="Avancys v14 for Agofer" SRC=git@gitlab.com:mgarcia.avancys/v14_avancys_agofer.git DEST=./vendor/ OPTIONS="" if [ ! -d "$DEST" ]; then echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Clone $REPO" echo " …to $DEST" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" git clone $OPTIONS $SRC $DEST else echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Update $REPO" echo " …in $DEST" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" git -C $DEST pull fi } gt_vendor01 () { REPO="Original electronic invoice modules by Avancys" SRC=ssh://git@gitea.agofer.net:22001/jegomez/v14-facturacionelectronica.git DEST=./vendor01/ OPTIONS="" if [ ! -d "$DEST" ]; then echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Clone $REPO" echo " …to $DEST" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" git clone $OPTIONS $SRC $DEST else echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Update $REPO" echo " …in $DEST" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" git -C $DEST pull fi } gt_vendor02 () { REPO="Electronic documents by Avancys" SRC=git@gitlab.com:mgarcia.avancys/v14-electronic-documents-agofer.git DEST=./vendor02/ OPTIONS="" if [ ! -d "$DEST" ]; then echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Clone $REPO" echo " …to $DEST" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" git clone $OPTIONS $SRC $DEST else echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Update $REPO" echo " …in $DEST" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" git -C $DEST pull fi } gt_custom () { REPO="Custom in-house modules" SRC=ssh://git@gitea.agofer.net:22001/Agofer/Extended.git DEST=./custom/ OPTIONS="" if [ ! -d "$DEST" ]; then echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Clone $REPO" echo " …to $DEST" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" git clone $OPTIONS $SRC $DEST else echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Update $REPO" echo " …in $DEST" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" git -C $DEST pull fi } gt_all () { gt_core # Download from Odoo core repo gt_community # OCA modules repo, using git submodules gt_vendor # Avancys main repo gt_vendor01 # In-house replacement repo for removed Avancys modules gt_vendor02 # Avancys e-document modules gt_custom # Custom in-house 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') # Download from repo all modules gt_all exit;; 'core') # Download from repo Odoo core gt_core exit;; 'community') # Download from repo OCA modules gt_community exit;; 'vendor') # Download from repo Avancys modules gt_vendor exit;; 'vendor01') # Download original e-invoice Avancys modules gt_vendor01 exit;; 'vendor02') # Download from Avancys e-document modules gt_vendor02 exit;; 'custom') # Download from repo Custom modules developed in-house gt_custom exit;; *) # Invalid option echo "Error: Invalid module" echo Help exit;; esac