mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-05 04:47:56 +00:00
added feature #25: an user can now specify a key name when creating tomb, using the -k flag
This commit is contained in:
parent
ce7edc1b63
commit
9fbb620c60
16
src/tomb
16
src/tomb
@ -365,9 +365,15 @@ create_tomb() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e ${tombdir}/${tombfile}.key ]; then
|
if option_is_set -k; then
|
||||||
|
tombkey=`option_value -k`
|
||||||
|
else
|
||||||
|
tombkey="${tombdir}/${tombfile}.key"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e "${tombkey}" ]; then
|
||||||
error "tomb key already exists. Quitting."
|
error "tomb key already exists. Quitting."
|
||||||
ls -lh ${tombdir}/${tombfile}.key
|
ls -lh ${tombkey}
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -456,7 +462,7 @@ create_tomb() {
|
|||||||
|
|
||||||
print "${tombpass}" | gpg \
|
print "${tombpass}" | gpg \
|
||||||
--openpgp --batch --no-options --no-tty --passphrase-fd 0 2>/dev/null \
|
--openpgp --batch --no-options --no-tty --passphrase-fd 0 2>/dev/null \
|
||||||
-o "${tombdir}/${tombname}.tomb.key" -c -a ${keytmp}/tomb.tmp
|
-o "${tombkey}" -c -a ${keytmp}/tomb.tmp
|
||||||
|
|
||||||
# if [ $? != 0 ]; then
|
# if [ $? != 0 ]; then
|
||||||
# error "setting password failed: gnupg returns 2"
|
# error "setting password failed: gnupg returns 2"
|
||||||
@ -504,7 +510,7 @@ create_tomb() {
|
|||||||
chown $(id -u $ME):$(id -g $ME) ${tombfile}
|
chown $(id -u $ME):$(id -g $ME) ${tombfile}
|
||||||
|
|
||||||
act "done creating $tombname encrypted storage (using Luks dm-crypt AES/SHA256)"
|
act "done creating $tombname encrypted storage (using Luks dm-crypt AES/SHA256)"
|
||||||
notice "Your tomb is ready in ${tombdir}/${tombfile} and secured with key ${tombfile}.key"
|
notice "Your tomb is ready in ${tombdir}/${tombfile} and secured with key ${tombkey}"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1227,7 +1233,7 @@ main() {
|
|||||||
subcommands_opts[__default]=""
|
subcommands_opts[__default]=""
|
||||||
subcommands_opts[open]="n -nohook=n k: -key=k o: -mount-options=o -ignore-swap"
|
subcommands_opts[open]="n -nohook=n k: -key=k o: -mount-options=o -ignore-swap"
|
||||||
subcommands_opts[mount]=${subcommands_opts[open]}
|
subcommands_opts[mount]=${subcommands_opts[open]}
|
||||||
subcommands_opts[create]="s: -size=s -ignore-swap"
|
subcommands_opts[create]="s: -size=s -ignore-swap k: -key=k"
|
||||||
subcommands_opts[close]=""
|
subcommands_opts[close]=""
|
||||||
subcommands_opts[help]=""
|
subcommands_opts[help]=""
|
||||||
subcommands_opts[slam]=""
|
subcommands_opts[slam]=""
|
||||||
|
Loading…
Reference in New Issue
Block a user