From c833f67b5970dcd4f7e69ddabe4cb15300ef6749 Mon Sep 17 00:00:00 2001 From: Sam Chudnick Date: Fri, 17 Jun 2022 06:07:10 -0400 Subject: Consolidated encrypted USB scripts and removed redundancy Removed the mount-cryptusb and unmount-cryptusb scripts which are now redundant that mount-device and unmount-device handle LUKS devices. Consolidated encrypted USB script into sync-cryptusb, which now calls mount-device and unmount-device. --- .local/bin/cryptusb/handle-cryptusb | 8 -------- .local/bin/cryptusb/mount-cryptusb | 9 --------- .local/bin/cryptusb/sync-cryptusb | 6 ++++-- .local/bin/cryptusb/umount-cryptusb | 5 ----- 4 files changed, 4 insertions(+), 24 deletions(-) delete mode 100755 .local/bin/cryptusb/handle-cryptusb delete mode 100755 .local/bin/cryptusb/mount-cryptusb delete mode 100755 .local/bin/cryptusb/umount-cryptusb diff --git a/.local/bin/cryptusb/handle-cryptusb b/.local/bin/cryptusb/handle-cryptusb deleted file mode 100755 index 63d6ef4..0000000 --- a/.local/bin/cryptusb/handle-cryptusb +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# Single script for easy handling of encrypted USB -# Calls mount, sync, and umount scripts to automatically handle what is commonly -# run for encrypted USBs - -mount-cryptusb && notify-send "Encrypted USB mounted" -sync-cryptusb && notify-send "Encrypted USB synced" -umount-cryptusb && notify-send "Encrypted USB unmounted" diff --git a/.local/bin/cryptusb/mount-cryptusb b/.local/bin/cryptusb/mount-cryptusb deleted file mode 100755 index 299ad15..0000000 --- a/.local/bin/cryptusb/mount-cryptusb +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -# Mounts LUKS encrypted USB - -devs="$(lsblk -lp | grep -E "(disk|part) $" | awk '{print $1,"-",$4}')" -[ "$devs" = "" ] && exit 0 -dev="$(echo "$devs" | dmenu -i -p "Select device" | cut -d ' ' -f 1)" -[ "$dev" = "" ] && exit 0 -lsblk | grep -q "cryptusb" || sudo cryptsetup open $dev cryptusb -sudo mount /dev/mapper/cryptusb /mnt/cryptusb diff --git a/.local/bin/cryptusb/sync-cryptusb b/.local/bin/cryptusb/sync-cryptusb index e9d3f1a..6ba2737 100755 --- a/.local/bin/cryptusb/sync-cryptusb +++ b/.local/bin/cryptusb/sync-cryptusb @@ -1,6 +1,8 @@ #!/bin/sh # Syncs important files to encrypted USB -rsync -avP --exclude=".steam*" --exclude="virtual_machines*" --exclude="media*" \ +mount-device && \ +rsync -avP --exclude="virtual_machines*" --exclude="media*" \ --exclude="*.iso" --exclude="*.qcow2" \ - $HOME/ /mnt/cryptusb/$USER@$(hostname)/ + $HOME/ /mnt/cryptusb/$USER@$(hostname)/ && \ +unmount-device diff --git a/.local/bin/cryptusb/umount-cryptusb b/.local/bin/cryptusb/umount-cryptusb deleted file mode 100755 index c3c4b93..0000000 --- a/.local/bin/cryptusb/umount-cryptusb +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# Unmounts LUKS encrypted USB - -sudo umount /mnt/cryptusb -sudo cryptsetup close cryptusb -- cgit v1.2.3