aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.bashrc_distr
blob: f5736535e71aee9fc72a90b5b6d9988b770d09f0 (plain) (blame)
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
#!/usr/bin/env bash

if [ -n "${BASHRC_DISTR+x}" ]; then
    return 0
else
    readonly BASHRC_DISTR=1
fi

checksums_path='sha1sums.txt'

update_checksums() {
    sha1sum -- "$@" > "$checksums_path"
}

update_checksums_distr() (
    set -o errexit -o nounset -o pipefail

    local -a paths
    local path

    while IFS= read -d '' -r path; do
        paths+=("$path")
    done < <( find . -type f -\( -iname '*.exe' -o -iname '*.iso' -\) -print0 )

    update_checksums "${paths[@]+"${paths[@]}"}"
)

verify_checksums() {
    sha1sum --check "$checksums_path"
}