aboutsummaryrefslogtreecommitdiff
path: root/submodules/command_hash.zsh
blob: 8d38b444c3c95cba07ada8d376d6bbaabc60005d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Copyright (C) 2024-2025 Maria Lisina
# Copyright (C) 2024-2025 Danil Lisin
# SPDX-License-Identifier: Apache-2.0

board_table=(a d g i k s y)

if [[ -n "${1}" ]]
then
    ib_post_md5="${1}"
    shift
else
    output_text="You must specify the MD5 h.zsh"
    return 0
fi

if ! [[ ${#ib_post_md5} -eq 32 ]]
then
    output_text="Invalid MD5 h.zsh"
    return 0
fi

ib_posts="${cache}/${update_id}_${ib_post_md5}.txt"

until mkdir "${ib_posts%.*}.lock"
do
    sleep 1
done

for ib_board in ${board_table[@]}
do
    . "${units}/ib_hash.sh" &

    if [[ -z "${threaded_hash}" ]]
    then
        wait
    fi
done

if [[ -n "${threaded_hash}" ]]
then
    wait
fi

if [[ -s "${ib_posts}" ]]
then
    output_text="$(cat "${ib_posts}" | sort)"
else
    output_text="No results found"
fi

rm -fr "${ib_posts%.*}.lock"