OSDN Git Service

[update] : Enabled to specify directory in build.sh
authorhayao <shun819.mail@gmail.com>
Wed, 30 Sep 2020 09:34:58 +0000 (18:34 +0900)
committerhayao <shun819.mail@gmail.com>
Wed, 30 Sep 2020 09:34:58 +0000 (18:34 +0900)
build.sh
tools/channel.sh

index b576158..ac5fff2 100755 (executable)
--- 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}"
index e12fe94..4b901c2 100755 (executable)
@@ -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
 }