#!/bin/bash # # Updates code from the git repositories selected # Help () { echo "Usage: $0 [-h] -o={all|core|community|vendor|custom}" echo echo "Options:" echo "-h Help (display this text)" echo "-o Repositories to be updated (one of 'all', 'core', 'community', 'vendor'," echo " '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_special () { REPO="Special repo for electronic invoice 1.8 by Avancys" SRC=git@gitlab.com:mgarcia.avancys/v14-facturacionelectronica.git DEST=./special/ 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 repo Odoo core gt_community # Download from repo OCA modules gt_vendor # Download from repo Avancys modules gt_custom # Download from repo 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') # 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;; 'special') # Download from special repo Avancys e-invoice modules gt_special exit;; 'custom') # Download from repo Custom modules developed in-house gt_custom exit;; *) # Invalid option echo "Error: Invalid module" echo Help exit;; esac