First sync.
This commit is contained in:
23
lctopen
Executable file
23
lctopen
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
blargityblargblarg &> /dev/null
|
||||
while [ ${?} != 0 ]; do
|
||||
sudo echo 'test' > /dev/null
|
||||
done
|
||||
|
||||
COUNT=$(sudo grep -c "${1}" /etc/crypttab)
|
||||
|
||||
[[ ${COUNT} -eq 0 ]] && echo "Identifier '${1}' not found." && exit 1
|
||||
[[ ${COUNT} -gt 1 ]] && echo "Identifier '${1}' is not unique." && exit 1
|
||||
|
||||
CTLINE=$(sudo grep "${1}" /etc/crypttab)
|
||||
|
||||
echo "Identifier '${1}' found in the following line:"
|
||||
echo "${CTLINE}"
|
||||
|
||||
MPNAME=$(sudo grep "${1}" /etc/crypttab | sed 's/#//g;s/ */ /g;s/ /\t/g' | awk '{ print $1 }')
|
||||
DEVICE=$(sudo grep "${1}" /etc/crypttab | sed 's/#//g;s/ */ /g;s/ /\t/g;s/UUID=/\/dev\/disk\/by-uuid\//g' | awk '{ print $2 }')
|
||||
KEYFIL=$(sudo grep "${1}" /etc/crypttab | sed 's/#//g;s/ */ /g;s/ /\t/g' | awk '{ print $3 }')
|
||||
|
||||
set -x
|
||||
sudo cryptsetup open "${DEVICE}" "${MPNAME}" --key-file "${KEYFIL}"
|
||||
Reference in New Issue
Block a user