From 67fd3175810ccb99e9783c9fac90b457d59db484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20E=2E=20G=C3=B3mez?= Date: Fri, 11 Jun 2021 07:16:18 -0500 Subject: [PATCH] [NEW] Changes locations for downloaded repos. Script to update repos --- .gitignore | 8 +-- README.md | 52 ++------------- install_odoo_code.sh | 8 +-- update_from_repo.sh | 152 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 165 insertions(+), 55 deletions(-) create mode 100755 update_from_repo.sh diff --git a/.gitignore b/.gitignore index 00d4b5e..f5ad3b8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -odoo/ -v14_avancys_agofer/ -Community/ -Extended/ +community/ +core/ +custom/ +vendor/ diff --git a/README.md b/README.md index ac919db..6f60fb4 100644 --- a/README.md +++ b/README.md @@ -17,63 +17,21 @@ To be installed into this directory structure: └── vendor [Developed by an Odoo partner under contract] ``` -## Repositories - -### Odoo 14.0 core - -**Location:** `/odoo` - -To clone from source: +## To download or update code from repositories: ```sh -git clone --single-branch --depth 1 --branch 14.0 https://github.com/odoo/odoo.git -``` - -### Avancys v14 for Agofer - -**Location:** `/v14_avancys_agofer` - -To clone from source: - -```sh -git clone git@gitlab.com:mgarcia.avancys/v14_avancys_agofer.git -``` - -### Custom in-house modules - -**Location:** `/Extended` - -To clone from source: - -```sh -git clone ssh://git@gitea.agofer.net:22001/Agofer/Extended.git -``` - -### Modules by Odoo Community Association - -**Location:** `/Community` - -To clone from source: - -```sh -git clone --recurse-submodules \ - ssh://git@gitea.agofer.net:22001/Agofer/Community.git -``` - -Subsequent updates: -``` -git pull --recurse-submodules +./update_from_repo.sh [-h] -o={all|core|community|vendor|custom} ``` ## To install into the production structure: ```sh -sudo ./install_all.sh +sudo ./install_odoo_code.sh [-h] -o={all|core|community|vendor|custom} ``` -### To apply patches to installed modules: +## To apply patches to installed code: ```sh -sudo ./apply_patches.sh +sudo ./apply_patches.sh [-h] -o={all|core|community|vendor} ``` diff --git a/install_odoo_code.sh b/install_odoo_code.sh index 8d13406..21d8fd9 100755 --- a/install_odoo_code.sh +++ b/install_odoo_code.sh @@ -25,7 +25,7 @@ Help () cp_core () { REPO="Odoo 14.0 core" - SRC=./odoo/ + SRC=./core/ DEST=$DESTDIR/core/ echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Install $REPO into production directory structure" @@ -37,7 +37,7 @@ cp_core () cp_community () { REPO="Modules by Odoo Community Association" - SRC=./Community/oca + SRC=./community/oca DEST=$DESTDIR/community/ echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Install $REPO into production directory structure" @@ -52,7 +52,7 @@ cp_community () cp_vendor () { REPO="Avancys v14 for Agofer" - SRC=./v14_avancys_agofer/ + SRC=./vendor/ DEST=$DESTDIR/vendor/ echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Install $REPO into production directory structure" @@ -66,7 +66,7 @@ cp_vendor () cp_custom () { REPO="Custom in-house modules " - SRC=./Extended/ + SRC=./custom/ DEST=$DESTDIR/custom/ echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Install $REPO into production directory structure" diff --git a/update_from_repo.sh b/update_from_repo.sh new file mode 100755 index 0000000..f0aa99d --- /dev/null +++ b/update_from_repo.sh @@ -0,0 +1,152 @@ +#!/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_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;; + 'custom') # Download from repo Custom modules developed in-house + gt_custom + exit;; + *) # Invalid option + echo "Error: Invalid module" + echo + Help + exit;; +esac +