소스 검색

Testing that file is LUKS encrypted

Vinicius Teshima 10 달 전
부모
커밋
dd617bc627
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      luks.sh

+ 3 - 0
luks.sh

@@ -91,6 +91,9 @@ fi
 if test -e "$file_path"
 then
 	test -f "$file_path" || ERR "${file_path} Is not a regular file" 1
+
+	file_type="$(file -b ${file_path} | cut -d' ' -f-2)"
+	test "$file_type" = 'LUKS encrypted' || ERR "${file_path} is not a LUKS encrypted file." 1
 else
 	echo -n "File ${file_path} does not exist. Want to create? (Y/n) "
 	read choose