From e548819388ceb93f20ded9ea8b02bf921e01b758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20E=2E=20G=C3=B3mez?= Date: Thu, 13 Oct 2022 18:24:38 -0500 Subject: [PATCH] Applies some best practices to bash scripts --- apply_patches.sh | 4 +++- install_odoo_code.sh | 3 ++- update_from_repo.sh | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/apply_patches.sh b/apply_patches.sh index 7580d98..cac900d 100755 --- a/apply_patches.sh +++ b/apply_patches.sh @@ -1,7 +1,8 @@ -#!/bin/bash +#!/usr/bin/env bash # # Installs selected content from the downloaded repos into a production folder # +# Warning: git apply may fail if /opt/odoo/.git/ exists if [ $UID != 0 ]; then echo "You need administration privileges to run this script." @@ -119,6 +120,7 @@ pt_all () pt_community # Apply patches to OCA modules } +set -ueo pipefail if (($# == 0)) then Help diff --git a/install_odoo_code.sh b/install_odoo_code.sh index 9b09ce5..f4088dc 100755 --- a/install_odoo_code.sh +++ b/install_odoo_code.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Installs selected content from the downloaded repos into a production folder # @@ -137,6 +137,7 @@ cp_all () cp_custom # Install Custom modules } +set -ueo pipefail if (($# == 0)) then Help diff --git a/update_from_repo.sh b/update_from_repo.sh index 96c00bc..e81f0c4 100755 --- a/update_from_repo.sh +++ b/update_from_repo.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Updates code from the git repositories selected # @@ -150,6 +150,7 @@ gt_all () gt_custom # Custom in-house modules } +set -ueo pipefail if (($# == 0)) then Help