[arch-projects] [RFC 03/23] Add warning if dependencies are missing

Matthew Monaco dgbaley27 at 0x01b.net
Fri May 18 12:21:57 EDT 2012


From: Matthew Monaco <matthew.monaco at 0x01b.net>

I don't really like this, it would be better to check only for
cryptsetup here, other checks can go where they're used or not at all.

The best might be to not do anything like this at all.
---
 cryptmount.sh |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/cryptmount.sh b/cryptmount.sh
index bd3ed86..fa25fdf 100755
--- a/cryptmount.sh
+++ b/cryptmount.sh
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 SHORTOPTS="LMUc:w:nqvho:O:"
+DEPS="cryptsetup blkid findmnt mkswap mktemp"
 
 LOGLEVEL=1
 DRYRUN=0
@@ -134,6 +135,11 @@ ct_main() {
 
 	shift $(( OPTIND - 1 ))
 
+	# Warn if any of the dependencies are missing
+	for dep in $DEPS; do
+		type $dep &> /dev/null || info "$dep not found, some functionality may fail"
+	done
+
 	if [ -z "$action" -o "$action" = "list" ]; then
 
 		:
-- 
1.7.10.2



More information about the arch-projects mailing list