|
@@ -25,6 +25,12 @@ _MOUNT () {
|
|
|
echo "Succesfully Mounted ${1} into ${2}"
|
|
echo "Succesfully Mounted ${1} into ${2}"
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+_LUKS_OPEN () {
|
|
|
|
|
+ echo "Opening Encrypted file: ${1} as ${2}"
|
|
|
|
|
+ TRY_AND_RETRY "${sudo_prog} cryptsetup luksOpen ${1} ${2}" "Failed to open luks file: ${1}."
|
|
|
|
|
+ echo "Succesfully Opened Encrypted file: ${1} as ${2}"
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
file_path="$1"
|
|
file_path="$1"
|
|
|
test -n "$file_path" || { echo 'No file given'; exit 1; }
|
|
test -n "$file_path" || { echo 'No file given'; exit 1; }
|
|
|
file="$(basename "$file_path")"
|
|
file="$(basename "$file_path")"
|
|
@@ -94,9 +100,7 @@ else
|
|
|
TRY_AND_RETRY "cryptsetup luksFormat -c aes-xts-plain64 -s 512 -y ${file_path}" "Failed to format file: ${file_path}"
|
|
TRY_AND_RETRY "cryptsetup luksFormat -c aes-xts-plain64 -s 512 -y ${file_path}" "Failed to format file: ${file_path}"
|
|
|
echo "Succesfully Encrypted file: ${file_path}"
|
|
echo "Succesfully Encrypted file: ${file_path}"
|
|
|
|
|
|
|
|
- echo "Opening Encrypted file: ${file_path} as ${_name}"
|
|
|
|
|
- TRY_AND_RETRY "${sudo_prog} cryptsetup luksOpen ${file_path} ${_name}" "Failed to open luks file: ${file_path}."
|
|
|
|
|
- echo "Succesfully Opened Encrypted file: ${file_path} as ${_name}"
|
|
|
|
|
|
|
+ _LUKS_OPEN "$file_path" "$_name"
|
|
|
|
|
|
|
|
echo "Formating ${_name} as ext4"
|
|
echo "Formating ${_name} as ext4"
|
|
|
TRY_AND_RETRY "${sudo_prog} mkfs.ext4 -m0 ${block_dev}" "Failed to format block dev: ${block_dev}"
|
|
TRY_AND_RETRY "${sudo_prog} mkfs.ext4 -m0 ${block_dev}" "Failed to format block dev: ${block_dev}"
|
|
@@ -124,8 +128,7 @@ else
|
|
|
exit 0
|
|
exit 0
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
-echo "Opening luks file: ${file_path} as ${_name}."
|
|
|
|
|
-$sudo_prog cryptsetup luksOpen "$file_path" "$_name" || ERR "Failed to open luks file: ${file_path}." 1
|
|
|
|
|
|
|
+_LUKS_OPEN "$file_path" "$_name"
|
|
|
|
|
|
|
|
_MOUNT "$block_dev" "./${name}"
|
|
_MOUNT "$block_dev" "./${name}"
|
|
|
|
|
|