#!/bin/sh
set -e
do_hash() {
HASH_NAME=$1
HASH_CMD=$2
echo "${HASH_NAME}:"
for f in $(find -type f); do
f=$(echo $f | cut -c3-) # remove ./ prefix
if [ "$f" = "Release" ]; then
continue
fi
echo " $(${HASH_CMD} ${f} | cut -d" " -f1) $(wc -c $f)"
done
}
cat << EOF
Origin: Example Repository
Label: Example
Suite: stable
Codename: stable
Version: 1.0
Architectures: amd64 arm64 arm7
Components: main
Description: An example software repository
Date: $(date -Ru)
EOF
do_hash "MD5Sum" "md5sum"
do_hash "SHA1" "sha1sum"
do_hash "SHA256" "sha256sum"
上記のスクリプトでは、16行目にNo such file or Directoryエラーが発生し、その後はこのように失敗しますが、実際にはすべてのファイルとディレクトリで発生します。
../../../generate-release.sh: line 16: 8f7de0d9ea0d8b17d28bde898153b0b8 225 ./Release: No such file or directory
../../../generate-release.sh: line 16: 7060eb1b50d13e3eb8d5c0e5319bf43f 456 ./main/binary-amd64/Packages.gz: No such file or directory
../../../generate-release.sh: line 16: a23fbad7c8307a7c33abd897859c30bf 610 ./main/binary-amd64/Packages: No such file or directory
../../../generate-release.sh: line 16: 383aec4711ae3f30b52cad172229e09876681c88 234 ./Release: No such file or directory
../../../generate-release.sh: line 16: b56b0bed2cac870a660bcdce72a6f1aa7706ac11 456 ./main/binary-amd64/Packages.gz: No such file or directory
../../../generate-release.sh: line 16: 152016c4f49b6bfc252559425c15039b2676bda2 610 ./main/binary-amd64/Packages: No such file or directory
../../../generate-release.sh: line 16: 15779397e55fb2728b88e7e8a1b353774c0605704d60a6b7ea20e700c0ae9747 245 ./Release: No such file or directory
../../../generate-release.sh: line 16: 2c8179e55703cb3251e4e2c01e6a0026c52787bd79c8f91e65b2ca94892daa3c 456 ./main/binary-amd64/Packages.gz: No such file or directory
../../../generate-release.sh: line 16: 6892a40e30918494a72057d684a0857324c17d4a744d5760882528d94a64a511 610 ./main/binary-amd64/Packages: No such file or directory