OSDN Git Service

[update] : Supports directory specification
authorhayao <shun819.mail@gmail.com>
Wed, 30 Sep 2020 08:56:20 +0000 (17:56 +0900)
committerhayao <shun819.mail@gmail.com>
Wed, 30 Sep 2020 08:56:20 +0000 (17:56 +0900)
tools/channel.sh

index 3412c50..18c9bf0 100755 (executable)
@@ -66,6 +66,17 @@ check() {
     fi
     if [[ $(printf '%s\n' "${channellist[@]}" | grep -qx "${1}"; echo -n ${?} ) -eq 0 ]]; then
         echo "true"
+    elif [[ -d "${1}" ]]; then
+        if [[ -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" ]]; then
+                if [[ $(echo "${_channel_name}" | sed 's/^.*\.\([^\.]*\)$/\1/') = "add" ]] || [[ ! -d "${script_path}/channels/${_dirname}.add" ]] && [[ "${opt_only_add}" = false ]]; then
+                    echo "true"
+                fi
+            fi
+        else
+            echo "false"
+        fi
     else
         echo "false"
     fi