mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-29 11:36:16 +01:00
Improve gpg-key
Signed-off-by: main <magic_rb@redalder.org>
This commit is contained in:
parent
5a72bdc630
commit
c7f252f1f0
|
@ -5,7 +5,7 @@ final: prev:
|
|||
name = "gpg-key";
|
||||
file = ./gpg-key;
|
||||
substitutes = with prev; {
|
||||
inherit cryptsetup busybox findutils;
|
||||
inherit cryptsetup busybox findutils gnupg sudo;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- mode: shell-script; -*-
|
||||
|
||||
export PATH=@findutils@/bin:@busybox@/bin:@cryptsetup@/bin
|
||||
export PATH=@findutils@/bin:@busybox@/bin:@cryptsetup@/bin:@gnupg@/bin:@sudo@/bin
|
||||
|
||||
command="$1"
|
||||
|
||||
|
@ -13,14 +13,17 @@ fi
|
|||
set -e
|
||||
case "$command" in
|
||||
"open")
|
||||
cryptsetup open /dev/disk/by-label/secret secret
|
||||
cryptsetup open /dev/disk/by-label/addhe addhe
|
||||
mkdir -p /mnt/key
|
||||
|
||||
mount /dev/mapper/secret /mnt/key
|
||||
mount /dev/mapper/addhe /mnt/key
|
||||
sudo -u $SUDO_USER gpg-agent --daemon
|
||||
;;
|
||||
"close")
|
||||
sudo -u $SUDO_USER pkill gpg-agent
|
||||
|
||||
umount /mnt/key
|
||||
cryptsetup close secret
|
||||
cryptsetup close addhe
|
||||
|
||||
rm -r /mnt/key
|
||||
if [ -n "$(find /mnt -maxdepth 0 -empty)" ]
|
||||
|
|
Loading…
Reference in a new issue