#!/bin/bash

echo "Тест наличия файлов"

source library/sh_lib.sh

check=0

files=(
/usr/share/crypto-policies/policies/GOST-ONLY-PAM.pol
/usr/share/crypto-policies/policies/GOST-ONLY.pol
/usr/share/crypto-policies/policies/modules/GOST.pmod
/usr/share/crypto-policies/policies/modules/PAM-GOST.pmod
)

count=${#files[@]}
for (( i=0; i<count; i++ ))
do
    ls -l ${files[$i]}
    check=$(eq_is_success ${check} 0)

    filesize=$(stat -c%s ${files[$i]})
    if [ $filesize -eq 0 ]; then
        echo "File ${files[$i]} length == 0 -- Error"
        let check+=1
    else
        echo "File ${files[$i]} length == ${filesize} -- OK"
    fi
done

check_test_status ${check} "$0"
exit ${check}