Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated truecrypt.sh to accept encrypted drives #164

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions addons/system/truecrypt/source/bin/truecrypt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,23 @@ getMountedFiles() {
}

# Function will print all partitions on the system. Devices with following format are retruned:
# sdXY and hdXY.
# It won't return whole disk like sda or hda.
# sdX[Y] and hdX[Y].
# Because TrueCrypt can encrypt entire drives, this script is modified to accept mounting of entire drives like sda, sdb, hda etc.
getPartitions() {
ls /dev 2>/dev/null | awk "/sd[a-z]?[0-9]+$|hd[a-z]?[0-9]+$/"'{print $1}' 2>/dev/null
ls /dev 2>/dev/null | awk "/sd[a-z]?[0-9]?+$|hd[a-z]?[0-9]?+$/"'{print $1}' 2>/dev/null

}

# Function returns corespnding label to the partition. Only name of the partition should be supplied e.g. sda1
# Function returns coresponding label to the partition if found.
# If the label is not found (which you won't get from an encrypted drive), it will use the less nicer ID instead.
# Only name of the partition should be supplied e.g. sda, sda1
getPartitionLabel() {
if [ "$1" != "" ] ; then
ls /dev/disk/by-label -l 2>/dev/null | awk "/$1\$/"'{printf $9}'
GET_LABEL="$(ls /dev/disk/by-label -l 2>/dev/null | awk "/$1\$/"'{printf $9}')"
if [ "$GET_LABEL" == "" ] ; then
GET_LABEL="$(ls /dev/disk/by-id -l 2>/dev/null | awk "/$1\$/"'{printf $9}')"
fi
echo -n "$GET_LABEL"
# more "d:\test.txt" | awk "/$1\$/"'{print $9}'
fi

Expand Down