secrets: Try to improve size estimates for the tmpfs

When creating the tmpfs we need to specify a size.  Calculate the size
based on the size of the tarball of the encrypted files, multiplied by
10.
This commit is contained in:
Peter Jones 2019-01-04 11:19:15 -07:00
parent 4964d95974
commit c5dc7d83be
No known key found for this signature in database
GPG key ID: 9DAFAA8D01941E49

View file

@ -64,12 +64,13 @@ calculate_mount_point() {
}
################################################################################
# Figure out how much space we need in the tmpfs.
calculate_fs_size() {
local directory=$1
local size
size=$(du --bytes --summarize "$directory" | awk '{print $1}')
echo $((size * 2))
size=$(tar -cf - "$directory" | wc -c)
echo $((size * 10 / 1024))k
}
################################################################################
@ -191,7 +192,7 @@ mount_secrets() {
while IFS= read -r -d '' file; do
decrypt_file "$file" "$option_secrets" "$option_mount_point" "$symmetric_key"
done < <(find "$option_secrets" -type f -print0)
done < <(find "$option_secrets"/ -type f -print0)
}
################################################################################