From 03f5c6322b944711494f91a7bf750b08dc1ecf62 Mon Sep 17 00:00:00 2001 From: hayao Date: Wed, 30 Sep 2020 18:34:58 +0900 Subject: [PATCH] [update] : Enabled to specify directory in build.sh --- build.sh | 20 +++++++++++++++----- tools/channel.sh | 6 +++--- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/build.sh b/build.sh index b576158a..ac5fff26 100755 --- a/build.sh +++ b/build.sh @@ -1561,14 +1561,26 @@ if [[ "${sfs_comp_opt}" = "-Xcompression-level 20" && ! "${sfs_comp}" = "zstd" ] # Parse channels set +eu -[[ -n "${1}" ]] && channel_name="${1}" # Check for a valid channel name -[[ "$(bash "${script_path}/tools/channel.sh" check "${channel_name}")" = false ]] && msg_error "Invalid channel ${channel_name}" "1" +case "$(bash "${script_path}/tools/channel.sh" check "${1}")" in + "incorrect") + msg_error "Invalid channel ${1}" "1" + ;; + "directory") + channel_dir="${1}" + channel_name="$(basename "${1%/}")" + ;; + "correct") + channel_dir="${script_path}/channels/${1}" + channel_name="${1}" + ;; +esac # Set for special channels if [[ -d "${channel_dir}.add" ]]; then - channel_name="${channel_name}.add" + channel_name="${1}" + channel_dir="${channel_dir}.add" elif [[ "${channel_name}" = "rebuild" ]]; then if [[ -f "${rebuildfile}" ]]; then rebuild=true @@ -1586,8 +1598,6 @@ elif [[ "${channel_name}" = "clean" ]]; then exit 0 fi -channel_dir="${script_path}/channels/${channel_name}" - # Check channel version if [[ ! "${channel_name}" = "rebuild" ]]; then msg_debug "channel path is ${channel_dir}" diff --git a/tools/channel.sh b/tools/channel.sh index e12fe94e..4b901c2c 100755 --- a/tools/channel.sh +++ b/tools/channel.sh @@ -75,14 +75,14 @@ check() { exit 1 fi if [[ $(printf '%s\n' "${channellist[@]}" | grep -qx "${1}"; echo -n ${?} ) -eq 0 ]]; then - echo "true" + echo "correct" elif [[ -d "${1}" ]] && [[ -n $(ls "${1}") ]] && [[ "$(cat "${1}/alteriso" 2> /dev/null)" = "alteriso=${alteriso_version}" ]] || [[ "${opt_nochkver}" = true ]]; then local _channel_name="$(basename "${1%/}")" if [[ ! "${_channel_name}" = "share" ]] && [[ $(echo "${_channel_name}" | sed 's/^.*\.\([^\.]*\)$/\1/') = "add" ]] || [[ ! -d "${script_path}/channels/${_dirname}.add" ]] && [[ "${opt_only_add}" = false ]]; then - echo "true" + echo "directory" fi else - echo "false" + echo "incorrect" fi } -- 2.11.0