From 3307a0a08ac6c9736669c7303c16ef9327cd2e21 Mon Sep 17 00:00:00 2001 From: Jesus Alvarez Date: Sun, 17 Apr 2016 13:43:28 -0700 Subject: [PATCH] lib.sh: Fix bash regex --- build.sh | 8 +++++--- lib.sh | 42 +++++++++++++++++++++++------------------- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/build.sh b/build.sh index d25e44c..46da059 100755 --- a/build.sh +++ b/build.sh @@ -23,9 +23,9 @@ trap 'trap_abort' INT QUIT TERM HUP trap 'trap_exit' EXIT usage() { - echo "build.sh - A build script for archzfs" + echo "build.sh - A build script for archzfs" echo - echo "Usage: build.sh [options] [mode] [command [command option] [...]" + echo "Usage: build.sh [options] [mode] [command [command option] [...]" echo echo "Options:" echo @@ -49,7 +49,7 @@ usage() { echo " update-test Update all git PKGBUILDs using the testing conf.sh variables." echo " sign GPG detach sign all compiled packages (default)." echo - echo "Examples:" + echo "Examples:" echo echo " build.sh -C :: Remove all compiled packages" echo " build.sh git make -u :: Update the chroot and build all of the packages" @@ -348,8 +348,10 @@ if [[ $AZB_UPDPKGSUMS == 1 && $AZB_MODE_LTS == 1 ]]; then fi if [[ $AZB_UPDATE_PKGBUILDS == 1 && $AZB_MODE_GIT == 1 ]]; then + debug "Updating git pkgbuilds" update_git_pkgbuilds elif [[ $AZB_UPDATE_PKGBUILDS == 1 && $AZB_MODE_LTS == 1 ]]; then + debug "Updating lts pkgbuilds" update_lts_pkgbuilds fi diff --git a/lib.sh b/lib.sh index c189140..675fd5b 100644 --- a/lib.sh +++ b/lib.sh @@ -14,28 +14,28 @@ WHITE="${BOLD}$(tput setaf 7 2> /dev/null)" readonly ALL_OFF BOLD BLUE GREEN RED YELLOW plain() { - local mesg=$1; shift - printf "${WHITE} ○ ${ALL_OFF}${BOLD}${mesg}${ALL_OFF}\n" "$@" + local mesg=$1; shift + printf "${WHITE} ○ ${ALL_OFF}${BOLD}${mesg}${ALL_OFF}\n" "$@" } msg() { - local mesg=$1; shift - printf "${GREEN}==== ${ALL_OFF}${WHITE}${BOLD} ${mesg}${ALL_OFF}\n" "$@" + local mesg=$1; shift + printf "${GREEN}==== ${ALL_OFF}${WHITE}${BOLD} ${mesg}${ALL_OFF}\n" "$@" } msg2() { - local mesg=$1; shift - printf "${BLUE}++++ ${ALL_OFF}${WHITE}${BOLD}${mesg}${ALL_OFF}\n" "$@" + local mesg=$1; shift + printf "${BLUE}++++ ${ALL_OFF}${WHITE}${BOLD}${mesg}${ALL_OFF}\n" "$@" } warning() { - local mesg=$1; shift - printf "${YELLOW}==== WARNING: ${ALL_OFF}${WHITE}${BOLD} ${mesg}${ALL_OFF}\n" "$@" + local mesg=$1; shift + printf "${YELLOW}==== WARNING: ${ALL_OFF}${WHITE}${BOLD} ${mesg}${ALL_OFF}\n" "$@" } error() { - local mesg=$1; shift - printf "${RED}==== ERROR: ${ALL_OFF}${BOLD}${WHITE}${mesg}${ALL_OFF}\n" "$@" >&2 + local mesg=$1; shift + printf "${RED}==== ERROR: ${ALL_OFF}${BOLD}${WHITE}${mesg}${ALL_OFF}\n" "$@" >&2 } send_email() { @@ -74,23 +74,23 @@ cleanup() { } abort() { - msg 'Aborting...' - cleanup 0 + msg 'Aborting...' + cleanup 0 } trap_abort() { - trap - EXIT INT QUIT TERM HUP - abort + trap - EXIT INT QUIT TERM HUP + abort } trap_exit() { - trap - EXIT INT QUIT TERM HUP - cleanup + trap - EXIT INT QUIT TERM HUP + cleanup } die() { - (( $# )) && error "$@" - cleanup 1 + (( $# )) && error "$@" + cleanup 1 } package_arch_from_path() { @@ -119,13 +119,17 @@ package_version_from_syncdb() { full_kernel_git_version() { # Determine if the kernel version has the format 3.14 or 3.14.1 - [[ ${AZB_GIT_KERNEL_VERSION} =~ ^[[:digit:]]+\.[[:digit:]]+\.([[:digit:]]+) ]] + if [[ ${AZB_GIT_KERNEL_VERSION} =~ ^[[:digit:]]+\.[[:digit:]]+\.([[:digit:]]+) ]]; then + debug "full_kernel_git_version: Have kernel with minor version!" + fi + debug "full_kernel_git_version: BASH_REMATCH[1] == '${BASH_REMATCH[1]}'" if [[ ${BASH_REMATCH[1]} != "" ]]; then AZB_GIT_KERNEL_X32_VERSION_FULL=${AZB_GIT_KERNEL_X32_VERSION} AZB_GIT_KERNEL_X64_VERSION_FULL=${AZB_GIT_KERNEL_X64_VERSION} AZB_GIT_KERNEL_X32_VERSION_CLEAN=$(echo ${AZB_GIT_KERNEL_X32_VERSION} | sed s/-/_/g) AZB_GIT_KERNEL_X64_VERSION_CLEAN=$(echo ${AZB_GIT_KERNEL_X64_VERSION} | sed s/-/_/g) else + debug "full_kernel_git_version: Have kernel without minor version!'" # Kernel version has the format 3.14, so add a 0. AZB_GIT_KERNEL_X32_VERSION_FULL=${AZB_GIT_KERNEL_VERSION}.0-${AZB_GIT_KERNEL_X32_PKGREL} AZB_GIT_KERNEL_X64_VERSION_FULL=${AZB_GIT_KERNEL_VERSION}.0-${AZB_GIT_KERNEL_X64_PKGREL}