diff --git a/.github/workflows/build_helper.sh b/.github/workflows/build_helper.sh index 3f2ca07..26b2583 100755 --- a/.github/workflows/build_helper.sh +++ b/.github/workflows/build_helper.sh @@ -1350,7 +1350,7 @@ if [ "${RUN_SHELLCHECK}" -eq 1 ]; then # Fedora # if ({ RUNCMD "${INSTALLER_BIN}" "${INSTALL_CMD}" "${INSTALL_CMD_ARG}" "${INSTALL_AUTO_ARG}" ShellCheck || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then - PRNERR "Failed to install cppcheck" + PRNERR "Failed to install shellcheck" exit 1 fi @@ -1377,7 +1377,7 @@ if [ "${RUN_SHELLCHECK}" -eq 1 ]; then # Ubuntu or Debian # if ({ RUNCMD "${INSTALLER_BIN}" "${INSTALL_CMD}" "${INSTALL_CMD_ARG}" "${INSTALL_AUTO_ARG}" shellcheck || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then - PRNERR "Failed to install cppcheck" + PRNERR "Failed to install shellcheck" exit 1 fi @@ -1386,7 +1386,7 @@ if [ "${RUN_SHELLCHECK}" -eq 1 ]; then # Alpine # if ({ RUNCMD "${INSTALLER_BIN}" "${INSTALL_CMD}" "${INSTALL_CMD_ARG}" "${INSTALL_AUTO_ARG}" shellcheck || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then - PRNERR "Failed to install cppcheck" + PRNERR "Failed to install shellcheck" exit 1 fi diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc4fab4..e5662eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,16 +58,15 @@ jobs: container: - ubuntu:24.04 - ubuntu:22.04 - - ubuntu:20.04 - debian:bookworm - debian:bullseye - rockylinux:9 - rockylinux:8 - fedora:41 - fedora:40 + - alpine:3.21 - alpine:3.20 - alpine:3.19 - - alpine:3.18 container: image: ${{ matrix.container }} diff --git a/.github/workflows/ostypevars.sh b/.github/workflows/ostypevars.sh index b33b92d..f096e86 100644 --- a/.github/workflows/ostypevars.sh +++ b/.github/workflows/ostypevars.sh @@ -116,20 +116,6 @@ elif echo "${CI_OSTYPE}" | grep -q -i -e "ubuntu:22.04" -e "ubuntu:jammy"; then PKG_EXT="deb" IS_OS_UBUNTU=1 -elif echo "${CI_OSTYPE}" | grep -q -i -e "ubuntu:20.04" -e "ubuntu:focal"; then - DIST_TAG="ubuntu/focal" - INSTALL_PKG_LIST="git autoconf autotools-dev make dh-make fakeroot dpkg-dev devscripts pkg-config ruby-dev rubygems rubygems-integration procps" - INSTALLER_BIN="apt-get" - UPDATE_CMD="update" - UPDATE_CMD_ARG="" - INSTALL_CMD="install" - INSTALL_CMD_ARG="" - INSTALL_AUTO_ARG="-y" - INSTALL_QUIET_ARG="-qq" - PKG_OUTPUT_DIR="debian_build" - PKG_EXT="deb" - IS_OS_UBUNTU=1 - elif echo "${CI_OSTYPE}" | grep -q -i -e "debian:12" -e "debian:bookworm"; then DIST_TAG="debian/bookworm" INSTALL_PKG_LIST="git autoconf autotools-dev make dh-make fakeroot dpkg-dev devscripts pkg-config ruby-dev rubygems rubygems-integration procps" @@ -214,8 +200,8 @@ elif echo "${CI_OSTYPE}" | grep -q -i "fedora:40"; then PKG_EXT="rpm" IS_OS_FEDORA=1 -elif echo "${CI_OSTYPE}" | grep -q -i "alpine:3.20"; then - DIST_TAG="alpine/v3.20" +elif echo "${CI_OSTYPE}" | grep -q -i "alpine:3.21"; then + DIST_TAG="alpine/v3.21" INSTALL_PKG_LIST="bash sudo alpine-sdk automake autoconf util-linux-misc musl-locales ruby-dev procps coreutils k2hr3-cli" INSTALLER_BIN="apk" UPDATE_CMD="update" @@ -228,8 +214,8 @@ elif echo "${CI_OSTYPE}" | grep -q -i "alpine:3.20"; then PKG_EXT="apk" IS_OS_ALPINE=1 -elif echo "${CI_OSTYPE}" | grep -q -i "alpine:3.19"; then - DIST_TAG="alpine/v3.19" +elif echo "${CI_OSTYPE}" | grep -q -i "alpine:3.20"; then + DIST_TAG="alpine/v3.20" INSTALL_PKG_LIST="bash sudo alpine-sdk automake autoconf util-linux-misc musl-locales ruby-dev procps coreutils k2hr3-cli" INSTALLER_BIN="apk" UPDATE_CMD="update" @@ -242,8 +228,8 @@ elif echo "${CI_OSTYPE}" | grep -q -i "alpine:3.19"; then PKG_EXT="apk" IS_OS_ALPINE=1 -elif echo "${CI_OSTYPE}" | grep -q -i "alpine:3.18"; then - DIST_TAG="alpine/v3.18" +elif echo "${CI_OSTYPE}" | grep -q -i "alpine:3.19"; then + DIST_TAG="alpine/v3.19" INSTALL_PKG_LIST="bash sudo alpine-sdk automake autoconf util-linux-misc musl-locales ruby-dev procps coreutils k2hr3-cli" INSTALLER_BIN="apk" UPDATE_CMD="update" diff --git a/AUTHORS b/AUTHORS index 909569f..896215c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -2,6 +2,6 @@ Wrote from scratch the initial version of k2hdkc dbaas cli. -3. Hirotaka Wakabayashi +2. Hirotaka Wakabayashi Technical engineer of k2hdkc dbaas cli product. diff --git a/README.md b/README.md index 4140d4b..bf574b7 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,9 @@ K2HDKC DBaaS Command Line Interface(K2HR3 CLI Plugin) [![GitHub forks](https://img.shields.io/github/forks/yahoojapan/k2hdkc_dbaas_cli.svg)](https://github.com/yahoojapan/k2hdkc_dbaas_cli/network) [![GitHub stars](https://img.shields.io/github/stars/yahoojapan/k2hdkc_dbaas_cli.svg)](https://github.com/yahoojapan/k2hdkc_dbaas_cli/stargazers) [![GitHub issues](https://img.shields.io/github/issues/yahoojapan/k2hdkc_dbaas_cli.svg)](https://github.com/yahoojapan/k2hdkc_dbaas_cli/issues) -[![debian packages](https://img.shields.io/badge/deb-packagecloud.io-844fec.svg)](https://packagecloud.io/antpickax/stable) [![RPM packages](https://img.shields.io/badge/rpm-packagecloud.io-844fec.svg)](https://packagecloud.io/antpickax/stable) +[![debian packages](https://img.shields.io/badge/deb-packagecloud.io-844fec.svg)](https://packagecloud.io/antpickax/stable) +[![ALPINE packages](https://img.shields.io/badge/apk-packagecloud.io-844fec.svg)](https://packagecloud.io/antpickax/stable) ### **K2HDKC** **DBaaS** @@ -46,37 +47,33 @@ The overall **K2HDKC DBaaS CLI** overview diagram is shown below. ![K2HDKC DBaaS system](https://dbaas.k2hdkc.antpick.ax/images/overview_cli.png) ### Documents -[K2HDKC DBaaS Document](https://dbaas.k2hdkc.antpick.ax/index.html) -[Github wiki page](https://github.com/yahoojapan/k2hdkc_dbaas_cli/wiki) - -[About k2hdkc Document](https://k2hdkc.antpick.ax/index.html) -[About chmpx Document](https://chmpx.antpick.ax/index.html) -[About k2hr3 Document](https://k2hr3.antpick.ax/index.html) + - [K2HDKC DBaaS Document](https://dbaas.k2hdkc.antpick.ax/index.html) + - [Github wiki page](https://github.com/yahoojapan/k2hdkc_dbaas_cli/wiki) -[About AntPickax](https://antpick.ax/) + - [About k2hdkc Document](https://k2hdkc.antpick.ax/index.html) + - [About chmpx Document](https://chmpx.antpick.ax/index.html) + - [About k2hr3 Document](https://k2hr3.antpick.ax/index.html) + - [About AntPickax](https://antpick.ax/) ### Repositories -[k2hdkc_dbaas](https://github.com/yahoojapan/k2hdkc_dbaas) -[k2hdkc_dbaas_k8s_cli](https://github.com/yahoojapan/k2hdkc_dbaas_k8s_cli) -[k2hr3](https://github.com/yahoojapan/k2hr3) -[k2hr3_app](https://github.com/yahoojapan/k2hr3_app) -[k2hr3_api](https://github.com/yahoojapan/k2hr3_api) -[k2hr3_cli](https://github.com/yahoojapan/k2hr3_cli) -[k2hr3_get_resource](https://github.com/yahoojapan/k2hr3_get_resource) -[k2hdkc](https://github.com/yahoojapan/k2hdkc) -[k2hdkc_dbaas_override_conf](https://github.com/yahoojapan/k2hdkc_dbaas_override_conf) -[chmpx](https://github.com/yahoojapan/chmpx) + - [k2hdkc](https://github.com/yahoojapan/k2hdkc) + - [chmpx](https://github.com/yahoojapan/chmpx) + - [k2hdkc_dbaas](https://github.com/yahoojapan/k2hdkc_dbaas) + - [k2hdkc_dbaas_k8s_cli](https://github.com/yahoojapan/k2hdkc_dbaas_k8s_cli) + - [k2hdkc_dbaas_cli](https://github.com/yahoojapan/k2hdkc_dbaas_cli) + - [k2hdkc_dbaas_override_conf](https://github.com/yahoojapan/k2hdkc_dbaas_override_conf) + - [k2hdkc_dbaas_trove](https://github.com/yahoojapan/k2hdkc_dbaas_trove) + - [k2hr3](https://github.com/yahoojapan/k2hr3) + - [k2hr3_app](https://github.com/yahoojapan/k2hr3_app) + - [k2hr3_api](https://github.com/yahoojapan/k2hr3_api) + - [k2hr3_cli](https://github.com/yahoojapan/k2hr3_cli) + - [k2hr3_get_resource](https://github.com/yahoojapan/k2hr3_get_resource) + - [k2hr3client_python](https://github.com/yahoojapan/k2hr3client_python) ### Packages -[k2hdkc(packagecloud.io)](https://packagecloud.io/app/antpickax/stable/search?q=k2hdkc) -[chmpx(packagecloud.io)](https://packagecloud.io/app/antpickax/stable/search?q=chmpx) -[k2hdkc-dbaas-cli(packagecloud.io)](https://packagecloud.io/app/antpickax/stable/search?q=k2hdkc-dbaas-cli) -[k2hdkc-dbaas-k8s-cli(packagecloud.io)](https://packagecloud.io/app/antpickax/stable/search?q=k2hdkc-dbaas-k8s-cli) -[k2hdkc-dbaas-override-conf(packagecloud.io)](https://packagecloud.io/app/antpickax/stable/search?q=k2hdkc-dbaas-override-conf) -[k2hr3-cli(packagecloud.io)](https://packagecloud.io/app/antpickax/stable/search?q=k2hr3-cli) -[k2hr3-app(npm packages)](https://www.npmjs.com/package/k2hr3-app) -[k2hr3-api(npm packages)](https://www.npmjs.com/package/k2hr3-api) -[k2hr3-get-resource(packagecloud.io)](https://packagecloud.io/app/antpickax/stable/search?q=k2hr3-get-resource) + - [RPM packages(packagecloud.io)](https://packagecloud.io/app/antpickax/stable/search?q=k2hdkc-dbaas-cli&filter=rpm&dist=&arch=) + - [Debian packages(packagecloud.io)](https://packagecloud.io/app/antpickax/stable/search?q=k2hdkc-dbaas-cli&filter=deb&dist=&arch=) + - [ALPINE packages(packagecloud.io)](https://packagecloud.io/app/antpickax/stable/search?q=k2hdkc-dbaas-cli&filter=all&dist=alpine&arch=) ### License This software is released under the MIT License, see the license file. diff --git a/autogen.sh b/autogen.sh index 3d4170f..a4ac58a 100755 --- a/autogen.sh +++ b/autogen.sh @@ -54,18 +54,18 @@ while [ $# -ne 0 ]; do echo "[ERROR] Parameters are something wrong." exit 1 - elif [ "$1" = "-h" ] || [ "$1" = "-H" ] || [ "$1" = "--help" ] || [ "$1" = "--HELP" ]; then + elif echo "$1" | grep -q -i -e "^-h$" -e "^--help$"; then echo "Usage: ${AUTOGEN_NAME} [--help(-h)] [--no_update_version_file(-nu)] [--no_aclocal_force(-na)] [--no_check_ver_diff(-nc)]" exit 0 - elif [ "$1" = "-nu" ] || [ "$1" = "-NU" ] || [ "$1" = "--no_update_version_file" ] || [ "$1" = "--NO_UPDATE_VERSION_FILE" ]; then + elif echo "$1" | grep -q -i -e "^-nu$" -e "^--no_update_version_file$"; then UPDATE_VERSION_FILE=0 FORCEPARAM="" # do not need force - elif [ "$1" = "-na" ] || [ "$1" = "-NA" ] || [ "$1" = "--no_aclocal_force" ] || [ "$1" = "--NO_ACLOCAL_FORCE" ]; then + elif echo "$1" | grep -q -i -e "^-na$" -e "^--no_aclocal_force$"; then FORCEPARAM="" - elif [ "$1" = "-nc" ] || [ "$1" = "-NC" ] || [ "$1" = "--no_check_ver_diff" ] || [ "$1" = "--NO_CHECK_VER_DIFF" ]; then + elif echo "$1" | grep -q -i -e "^-nc$" -e "^--no_check_ver_diff$"; then PARAMETERS="$1" else diff --git a/buildutils/alpine_build.sh b/buildutils/alpine_build.sh index 013a111..d0a5680 100755 --- a/buildutils/alpine_build.sh +++ b/buildutils/alpine_build.sh @@ -99,11 +99,11 @@ while [ $# -ne 0 ]; do if [ -z "$1" ]; then break - elif [ "$1" = "-h" ] || [ "$1" = "-H" ] || [ "$1" = "--help" ] || [ "$1" = "--HELP" ]; then + elif echo "$1" | grep -q -i -e "^-h$" -e "^--help$"; then func_usage "${PRGNAME}" exit 0 - elif [ "$1" = "-b" ] || [ "$1" = "-B" ] || [ "$1" = "--buildnum" ] || [ "$1" = "--BUILDNUM" ]; then + elif echo "$1" | grep -q -i -e "^-b$" -e "^--buildnum$"; then if [ -n "${BUILD_NUMBER}" ]; then echo "[ERROR] Already --buildnum(-b) option is specified(${BUILD_NUMBER})." 1>&2 exit 1 @@ -119,7 +119,7 @@ while [ $# -ne 0 ]; do fi BUILD_NUMBER="$1" - elif [ "$1" = "-p" ] || [ "$1" = "-P" ] || [ "$1" = "--product" ] || [ "$1" = "--PRODUCT" ]; then + elif echo "$1" | grep -q -i -e "^-p$" -e "^--product$"; then if [ -n "${PACKAGE_NAME}" ]; then echo "[ERROR] Already --product(-p) option is specified(${PACKAGE_NAME})." 1>&2 exit 1 @@ -131,7 +131,7 @@ while [ $# -ne 0 ]; do fi PACKAGE_NAME="$1" - elif [ "$1" = "-y" ] || [ "$1" = "-Y" ] || [ "$1" = "--yes" ] || [ "$1" = "--YES" ]; then + elif echo "$1" | grep -q -i -e "^-y$" -e "^--yes$"; then if [ "${NO_INTERACTIVE}" -ne 0 ]; then echo "[ERROR] Already --yes(-y) option is specified." 1>&2 exit 1 diff --git a/buildutils/debian_build.sh b/buildutils/debian_build.sh index f407dc3..727456a 100755 --- a/buildutils/debian_build.sh +++ b/buildutils/debian_build.sh @@ -104,11 +104,11 @@ while [ $# -ne 0 ]; do if [ -z "$1" ]; then break - elif [ "$1" = "-h" ] || [ "$1" = "-H" ] || [ "$1" = "--help" ] || [ "$1" = "--HELP" ]; then + elif echo "$1" | grep -q -i -e "^-h$" -e "^--help$"; then func_usage "${PRGNAME}" exit 0 - elif [ "$1" = "-b" ] || [ "$1" = "-B" ] || [ "$1" = "--buildnum" ] || [ "$1" = "--BUILDNUM" ]; then + elif echo "$1" | grep -q -i -e "^-b$" -e "^--buildnum$"; then if [ "${BUILD_NUMBER}" -ne 0 ]; then echo "[ERROR] Already --buildnum(-b) option is specified(${BUILD_NUMBER})." 1>&2 exit 1 @@ -128,7 +128,7 @@ while [ $# -ne 0 ]; do fi BUILD_NUMBER="$1" - elif [ "$1" = "-p" ] || [ "$1" = "-P" ] || [ "$1" = "--product" ] || [ "$1" = "--PRODUCT" ]; then + elif echo "$1" | grep -q -i -e "^-p$" -e "^--product$"; then if [ -n "${PACKAGE_NAME}" ]; then echo "[ERROR] Already --product(-p) option is specified(${PACKAGE_NAME})." 1>&2 exit 1 @@ -140,7 +140,7 @@ while [ $# -ne 0 ]; do fi PACKAGE_NAME="$1" - elif [ "$1" = "-c" ] || [ "$1" = "-C" ] || [ "$1" = "--class" ] || [ "$1" = "--CLASS" ]; then + elif echo "$1" | grep -q -i -e "^-c$" -e "^--class$"; then if [ -n "${PKG_CLASS_NAME}" ]; then echo "[ERROR] Already --class(-c) option is specified(${PKG_CLASS_NAME})." 1>&2 exit 1 @@ -152,7 +152,7 @@ while [ $# -ne 0 ]; do fi PKG_CLASS_NAME="$1" - elif [ "$1" = "-dt" ] || [ "$1" = "-DT" ] || [ "$1" = "--disttype" ] || [ "$1" = "--DISTTYPE" ]; then + elif echo "$1" | grep -q -i -e "^-dt$" -e "^--disttype$"; then if [ -n "${OS_VERSION_NAME}" ]; then echo "[ERROR] Already --disttype(-dt) option is specified(${OS_VERSION_NAME})." 1>&2 exit 1 @@ -164,14 +164,14 @@ while [ $# -ne 0 ]; do fi OS_VERSION_NAME="$1" - elif [ "$1" = "-r" ] || [ "$1" = "-R" ] || [ "$1" = "--rootdir" ] || [ "$1" = "--ROOTDIR" ]; then + elif echo "$1" | grep -q -i -e "^-r$" -e "^--rootdir$"; then if [ "${IS_ROOTDIR}" -ne 0 ]; then echo "[ERROR] Already --rootdir(-r) option is specified." 1>&2 exit 1 fi IS_ROOTDIR=1 - elif [ "$1" = "-y" ] || [ "$1" = "-Y" ] || [ "$1" = "--yes" ] || [ "$1" = "--YES" ]; then + elif echo "$1" | grep -q -i -e "^-y$" -e "^--yes$"; then if [ "${NO_INTERACTIVE}" -ne 0 ]; then echo "[ERROR] Already --yes(-y) option is specified." 1>&2 exit 1 @@ -255,9 +255,9 @@ if [ "${NO_INTERACTIVE}" -eq 0 ]; then printf '[INPUT] Confirm (y/n) : ' read -r CONFIRM - if [ "${CONFIRM}" = "y" ] || [ "${CONFIRM}" = "Y" ] || [ "${CONFIRM}" = "yes" ] || [ "${CONFIRM}" = "YES" ]; then + if echo "${CONFIRM}" | grep -q -i -e "^y$" -e "^yes$"; then IS_CONFIRMED=1 - elif [ "${CONFIRM}" = "n" ] || [ "${CONFIRM}" = "N" ] || [ "${CONFIRM}" = "no" ] || [ "${CONFIRM}" = "NO" ]; then + elif echo "${CONFIRM}" | grep -q -i -e "^n$" -e "^no$"; then echo "Interrupt this processing, bye..." exit 0 fi diff --git a/buildutils/make_release_version_file.sh b/buildutils/make_release_version_file.sh index 41ba79b..1416080 100755 --- a/buildutils/make_release_version_file.sh +++ b/buildutils/make_release_version_file.sh @@ -68,31 +68,31 @@ while [ $# -ne 0 ]; do if [ -z "$1" ]; then break - elif [ "$1" = "-h" ] || [ "$1" = "-H" ] || [ "$1" = "--help" ] || [ "$1" = "--HELP" ]; then + elif echo "$1" | grep -q -i -e "^-h$" -e "^--help$"; then func_usage "${PRGNAME}" exit 0 - elif [ "$1" = "-ng" ] || [ "$1" = "-NG" ] || [ "$1" = "--not_use_git" ] || [ "$1" = "--NOT_USE_GIT" ]; then + elif echo "$1" | grep -q -i -e "^-ng$" -e "^--not_use_git$"; then if [ "${NOT_USE_GIT}" -ne 0 ]; then echo "[ERROR] already --not_use_git(-ng) option is specified." 1>&2 exit 1 fi NOT_USE_GIT=1 - elif [ "$1" = "-nd" ] || [ "$1" = "-ND" ] || [ "$1" = "--no_check_ver_diff" ] || [ "$1" = "--NO_CHECK_VER_DIFF" ]; then + elif echo "$1" | grep -q -i -e "^-nd$" -e "^--no_check_ver_diff$"; then if [ "${NO_CHECK_VER_DIFF}" -ne 0 ]; then echo "[ERROR] already --no_check_ver_diff(-nd) option is specified." 1>&2 exit 1 fi NO_CHECK_VER_DIFF=1 - elif [ "$1" = "-f" ] || [ "$1" = "-F" ] || [ "$1" = "--file" ] || [ "$1" = "--FILE" ]; then + elif echo "$1" | grep -q -i -e "^-f$" -e "^--file$"; then if [ -n "${CHANGELOG_FILE}" ]; then echo "[ERROR] already --file(-f) option is specified(${CHANGELOG_FILE})." 1>&2 exit 1 fi shift - if [ $# -eq 0 ] || [ -z "$1" ]; then + if [ $# -eq 0 ]; then echo "[ERROR] Must set changelog file path after -file(-f) option." 1>&2 exit 1 fi @@ -289,4 +289,3 @@ exit 0 # vim600: noexpandtab sw=4 ts=4 fdm=marker # vim<600: noexpandtab sw=4 ts=4 # - diff --git a/buildutils/make_rpm_changelog.sh b/buildutils/make_rpm_changelog.sh index 37c5e9e..5a1875a 100755 --- a/buildutils/make_rpm_changelog.sh +++ b/buildutils/make_rpm_changelog.sh @@ -61,7 +61,7 @@ while [ $# -ne 0 ]; do if [ -z "$1" ]; then break - elif [ "$1" = "-h" ] || [ "$1" = "-H" ] || [ "$1" = "--help" ] || [ "$1" = "--HELP" ]; then + elif echo "$1" | grep -q -i -e "^-h$" -e "^--help$"; then func_usage "${PRGNAME}" exit 0 diff --git a/buildutils/make_variables.sh b/buildutils/make_variables.sh index 7eb1cbb..d230f62 100755 --- a/buildutils/make_variables.sh +++ b/buildutils/make_variables.sh @@ -65,11 +65,11 @@ while [ $# -ne 0 ]; do if [ -z "$1" ]; then break - elif [ "$1" = "-h" ] || [ "$1" = "-H" ] || [ "$1" = "--help" ] || [ "$1" = "--HELP" ]; then + elif echo "$1" | grep -q -i -e "^-h$" -e "^--help$"; then func_usage "${PRGNAME}" exit 0 - elif [ "$1" = "-pv" ] || [ "$1" = "-PV" ] || [ "$1" = "--pkg_version" ] || [ "$1" = "--PKG_VERSION" ]; then + elif echo "$1" | grep -q -i -e "^-pv$" -e "^--pkg_version$"; then if [ "${EXCLUSIVE_OPT}" -eq 1 ]; then echo "[ERROR] already one of eclusive options( --pkg_version(-pv), --lib_version_info(-lvi), --lib_version_for_link(-lvl), --major_number(-mn), --debhelper_dep(-dd), --debhelper_dep_with_systemd(-dds), --rpmpkg_group(-rg) ) is specified." 1>&2 printf '0' @@ -78,7 +78,7 @@ while [ $# -ne 0 ]; do PRGMODE="PKG" EXCLUSIVE_OPT=1 - elif [ "$1" = "-lvi" ] || [ "$1" = "-LVI" ] || [ "$1" = "--lib_version_info" ] || [ "$1" = "--LIB_VERSION_INFO" ]; then + elif echo "$1" | grep -q -i -e "^-lvi$" -e "^--lib_version_info$"; then if [ "${EXCLUSIVE_OPT}" -eq 1 ]; then echo "[ERROR] already one of eclusive options( --pkg_version(-pv), --lib_version_info(-lvi), --lib_version_for_link(-lvl), --major_number(-mn), --debhelper_dep(-dd), --debhelper_dep_with_systemd(-dds), --rpmpkg_group(-rg) ) is specified." 1>&2 printf '0' @@ -87,7 +87,7 @@ while [ $# -ne 0 ]; do PRGMODE="LIB" EXCLUSIVE_OPT=1 - elif [ "$1" = "-lvl" ] || [ "$1" = "-LVL" ] || [ "$1" = "--lib_version_for_link" ] || [ "$1" = "--LIB_VERSION_FOR_LINK" ]; then + elif echo "$1" | grep -q -i -e "^-lvl$" -e "^--lib_version_for_link$"; then if [ "${EXCLUSIVE_OPT}" -eq 1 ]; then echo "[ERROR] already one of eclusive options( --pkg_version(-pv), --lib_version_info(-lvi), --lib_version_for_link(-lvl), --major_number(-mn), --debhelper_dep(-dd), --debhelper_dep_with_systemd(-dds), --rpmpkg_group(-rg) ) is specified." 1>&2 printf '0' @@ -96,7 +96,7 @@ while [ $# -ne 0 ]; do PRGMODE="LINK" EXCLUSIVE_OPT=1 - elif [ "$1" = "-mn" ] || [ "$1" = "-MN" ] || [ "$1" = "--major_number" ] || [ "$1" = "--MAJOR_NUMBER" ]; then + elif echo "$1" | grep -q -i -e "^-mn$" -e "^--major_number$"; then if [ "${EXCLUSIVE_OPT}" -eq 1 ]; then echo "[ERROR] already one of eclusive options( --pkg_version(-pv), --lib_version_info(-lvi), --lib_version_for_link(-lvl), --major_number(-mn), --debhelper_dep(-dd), --debhelper_dep_with_systemd(-dds), --rpmpkg_group(-rg) ) is specified." 1>&2 printf '0' @@ -105,7 +105,7 @@ while [ $# -ne 0 ]; do PRGMODE="MAJOR" EXCLUSIVE_OPT=1 - elif [ "$1" = "-dd" ] || [ "$1" = "-DD" ] || [ "$1" = "--debhelper_dep" ] || [ "$1" = "--DEBHELPER_DEP" ]; then + elif echo "$1" | grep -q -i -e "^-dd$" -e "^--debhelper_dep$"; then if [ "${EXCLUSIVE_OPT}" -eq 1 ]; then echo "[ERROR] already one of eclusive options( --pkg_version(-pv), --lib_version_info(-lvi), --lib_version_for_link(-lvl), --major_number(-mn), --debhelper_dep(-dd), --debhelper_dep_with_systemd(-dds), --rpmpkg_group(-rg) ) is specified." 1>&2 printf '0' @@ -115,7 +115,7 @@ while [ $# -ne 0 ]; do DEB_WITH_SYSTEMD=0 EXCLUSIVE_OPT=1 - elif [ "$1" = "-dds" ] || [ "$1" = "-DDS" ] || [ "$1" = "--debhelper_dep_with_systemd" ] || [ "$1" = "--DEBHELPER_DEP_WITH_SYSTEMD" ]; then + elif echo "$1" | grep -q -i -e "^-dds$" -e "^--debhelper_dep_with_systemd$"; then if [ "${EXCLUSIVE_OPT}" -eq 1 ]; then echo "[ERROR] already one of eclusive options( --pkg_version(-pv), --lib_version_info(-lvi), --lib_version_for_link(-lvl), --major_number(-mn), --debhelper_dep(-dd), --debhelper_dep_with_systemd(-dds), --rpmpkg_group(-rg) ) is specified." 1>&2 printf '0' @@ -125,7 +125,7 @@ while [ $# -ne 0 ]; do DEB_WITH_SYSTEMD=1 EXCLUSIVE_OPT=1 - elif [ "$1" = "-rg" ] || [ "$1" = "-RG" ] || [ "$1" = "--rpmpkg_group" ] || [ "$1" = "--RPMPKG_GROUP" ]; then + elif echo "$1" | grep -q -i -e "^-rg$" -e "^--rpmpkg_group$"; then if [ "${EXCLUSIVE_OPT}" -eq 1 ]; then echo "[ERROR] already one of eclusive options( --pkg_version(-pv), --lib_version_info(-lvi), --lib_version_for_link(-lvl), --major_number(-mn), --debhelper_dep(-dd), --debhelper_dep_with_systemd(-dds), --rpmpkg_group(-rg) ) is specified." 1>&2 printf '0' diff --git a/buildutils/rpm_build.sh b/buildutils/rpm_build.sh index 8ba71af..ffe69c2 100755 --- a/buildutils/rpm_build.sh +++ b/buildutils/rpm_build.sh @@ -86,11 +86,11 @@ while [ $# -ne 0 ]; do if [ -z "$1" ]; then break - elif [ "$1" = "-h" ] || [ "$1" = "-H" ] || [ "$1" = "--help" ] || [ "$1" = "--HELP" ]; then + elif echo "$1" | grep -q -i -e "^-h$" -e "^--help$"; then func_usage "${PRGNAME}" exit 0 - elif [ "$1" = "-b" ] || [ "$1" = "-B" ] || [ "$1" = "--buildnum" ] || [ "$1" = "--BUILDNUM" ]; then + elif echo "$1" | grep -q -i -e "^-b$" -e "^--buildnum$"; then if [ "${BUILD_NUMBER}" -ne 0 ]; then echo "[ERROR] Already --buildnum(-b) option is specified(${BUILD_NUMBER})." 1>&2 exit 1 @@ -110,7 +110,7 @@ while [ $# -ne 0 ]; do fi BUILD_NUMBER="$1" - elif [ "$1" = "-p" ] || [ "$1" = "-P" ] || [ "$1" = "--product" ] || [ "$1" = "--PRODUCT" ]; then + elif echo "$1" | grep -q -i -e "^-p$" -e "^--product$"; then if [ -n "${PACKAGE_NAME}" ]; then echo "[ERROR] Already --product(-p) option is specified(${PACKAGE_NAME})." 1>&2 exit 1 @@ -122,7 +122,7 @@ while [ $# -ne 0 ]; do fi PACKAGE_NAME="$1" - elif [ "$1" = "-y" ] || [ "$1" = "-Y" ] || [ "$1" = "--yes" ] || [ "$1" = "--YES" ]; then + elif echo "$1" | grep -q -i -e "^-y$" -e "^--yes$"; then if [ "${NO_INTERACTIVE}" -ne 0 ]; then echo "[ERROR] Already --yes(-y) option is specified." 1>&2 exit 1 @@ -172,9 +172,9 @@ if [ "${NO_INTERACTIVE}" -eq 0 ]; then printf '[INPUT] Confirm (y/n) : ' read -r CONFIRM - if [ "${CONFIRM}" = "y" ] || [ "${CONFIRM}" = "Y" ] || [ "${CONFIRM}" = "yes" ] || [ "${CONFIRM}" = "YES" ]; then + if echo "${CONFIRM}" | grep -q -i -e "^y$" -e "^yes$"; then IS_CONFIRMED=1 - elif [ "${CONFIRM}" = "n" ] || [ "${CONFIRM}" = "N" ] || [ "${CONFIRM}" = "no" ] || [ "${CONFIRM}" = "NO" ]; then + elif echo "${CONFIRM}" | grep -q -i -e "^n$" -e "^no$"; then echo "Interrupt this processing, bye..." exit 0 fi diff --git a/buildutils/setup_k2hr3_cli_component.sh b/buildutils/setup_k2hr3_cli_component.sh index 455ea40..2e0d749 100755 --- a/buildutils/setup_k2hr3_cli_component.sh +++ b/buildutils/setup_k2hr3_cli_component.sh @@ -44,11 +44,14 @@ GIT_CONFIG_FILE="${GIT_DIR}/config" # # k2hr3_cli default # +SPECIFIED_K2HR3_CLI_PATH_ENV=1 if [ -z "${DEFAULT_GIT_DOMAIN}" ]; then DEFAULT_GIT_DOMAIN="github.com" + SPECIFIED_K2HR3_CLI_PATH_ENV=0 fi if [ -z "${DEFAULT_K2HR3_CLI_ORG}" ]; then DEFAULT_K2HR3_CLI_ORG="yahoojapan" + SPECIFIED_K2HR3_CLI_PATH_ENV=0 fi if [ -z "${K2HR3_CLI_REPO_NAME}" ]; then K2HR3_CLI_REPO_NAME="k2hr3_cli" @@ -86,25 +89,32 @@ while [ $# -ne 0 ]; do if [ -z "$1" ]; then break; - elif [ "$1" = "-h" ] || [ "$1" = "-help" ]; then + elif echo "$1" | grep -q -i -e "^-h$" -e "^--help$"; then func_usage "${PRGNAME}" exit 0 - elif [ "$1" = "--clean" ] || [ "$1" = "--CLEAN" ] || [ "$1" = "-c" ] || [ "$1" = "-C" ]; then + elif echo "$1" | grep -q -i -e "^-c$" -e "^--clean$"; then if [ "${IS_CLEANUP}" -eq 1 ]; then echo "[ERROR] ${PRGNAME} - Already specified \"$1\" option." 1>&2 exit 1 fi IS_CLEANUP=1 - elif [ "$1" = "--force_archive" ] || [ "$1" = "--FORCE_ARCHIVE" ] || [ "$1" = "-f" ] || [ "$1" = "-F" ]; then + elif echo "$1" | grep -q -i -e "^-f$" -e "^--force_archive$"; then if [ "${USE_ARCHIVE}" -eq 1 ]; then echo "[ERROR] ${PRGNAME} - Already specified \"$1\" option." 1>&2 exit 1 fi USE_ARCHIVE=1 - elif [ "$1" = "--k2hr3_cli_repo" ] || [ "$1" = "--K2HR3_CLI_REPO" ]; then + # + # Force + # + if [ "${SPECIFIED_K2HR3_CLI_PATH_ENV}" -eq 1 ]; then + SPECIFIED_K2HR3_CLI_PATH_ENV=0 + fi + + elif echo "$1" | grep -q -i "^--k2hr3_cli_repo$"; then if [ -n "${_TMP_K2HR3_CLI_REPO_NAME}" ]; then echo "[ERROR] ${PRGNAME} - Already specified \"$1\" option." 1>&2 exit 1 @@ -175,7 +185,7 @@ if [ "${USE_GIT_CONFIG}" -eq 1 ]; then # echo "[INFO] ${PRGNAME} - Check .git/config for git domain and organaiztion" 1>&2 - GIT_URL_THIS_REPO=$(grep '^[[:space:]]*url[[:space:]]*=[[:space:]]*' .git/config | grep '.git$' | head -1 | sed -e 's/^[[:space:]]*url[[:space:]]*=[[:space:]]*//g') + GIT_URL_THIS_REPO=$(grep -i '^[[:space:]]*url[[:space:]]*=[[:space:]]*' .git/config | sed -e 's/^[[:space:]]*url[[:space:]]*=[[:space:]]*//gi') if [ -n "${GIT_URL_THIS_REPO}" ]; then # @@ -203,6 +213,13 @@ else GIT_ORG_NAME=${DEFAULT_K2HR3_CLI_ORG} fi +if [ "${USE_ARCHIVE}" -eq 1 ] && [ "${SPECIFIED_K2HR3_CLI_PATH_ENV}" -eq 1 ] && [ -n "${DEFAULT_GIT_DOMAIN}" ] && [ -n "${DEFAULT_K2HR3_CLI_ORG}" ]; then + echo "[INFO] ${PRGNAME} - Since the k2hr3_cli repository path is specified in the environment, use it to clone instead of downloading the archive." 1>&2 + USE_ARCHIVE=0 + GIT_DOMAIN_NAME=${DEFAULT_GIT_DOMAIN} + GIT_ORG_NAME=${DEFAULT_K2HR3_CLI_ORG} +fi + # # Git clone / Download archive #