diff options
author | A Farzat <a@farzat.xyz> | 2024-10-24 23:31:41 +0900 |
---|---|---|
committer | A Farzat <a@farzat.xyz> | 2024-11-04 23:31:41 +0900 |
commit | 7e905e33bc55d142b4fd32c28cc2be99dfdd3f0b (patch) | |
tree | 2c838df08dfb827ae4d554c576e5052ad0326fa6 /bin/wrappers | |
parent | d8ae1706a62b23b6071d8f46ace9523fbbb1adac (diff) | |
download | dotfiles-7e905e33bc55d142b4fd32c28cc2be99dfdd3f0b.tar.gz dotfiles-7e905e33bc55d142b4fd32c28cc2be99dfdd3f0b.zip |
Add useful wrapper scripts
Diffstat (limited to 'bin/wrappers')
-rwxr-xr-x | bin/wrappers/cryptsetup_mount | 7 | ||||
-rwxr-xr-x | bin/wrappers/cryptsetup_umount | 5 | ||||
-rwxr-xr-x | bin/wrappers/dwm_watch_binary | 17 |
3 files changed, 29 insertions, 0 deletions
diff --git a/bin/wrappers/cryptsetup_mount b/bin/wrappers/cryptsetup_mount new file mode 100755 index 0000000..e755daf --- /dev/null +++ b/bin/wrappers/cryptsetup_mount @@ -0,0 +1,7 @@ +#!/usr/bin/env sh + +# Mounts encrypted volume into dm-crypt +# First argument is the device name - /dev/* +# Second argument is the directory name desired + +cryptsetup open "$1" "$2" && mount --mkdir "/dev/mapper/$2" "/mnt/dm-crypt/$2" diff --git a/bin/wrappers/cryptsetup_umount b/bin/wrappers/cryptsetup_umount new file mode 100755 index 0000000..b186ad5 --- /dev/null +++ b/bin/wrappers/cryptsetup_umount @@ -0,0 +1,5 @@ +#!/usr/bin/env sh + +# Unmount the encrypted volume mounted at the given directory name + +umount "/mnt/dm-crypt/$1" && rmdir "/mnt/dm-crypt/$1" && cryptsetup close "$1" diff --git a/bin/wrappers/dwm_watch_binary b/bin/wrappers/dwm_watch_binary new file mode 100755 index 0000000..ebe34f0 --- /dev/null +++ b/bin/wrappers/dwm_watch_binary @@ -0,0 +1,17 @@ +#!/usr/bin/env sh + +# relaunch DWM if the binary changes, otherwise bail +csum="" +new_csum="$(sha1sum "$(which dwm)")" +while true +do + if [ "$csum" != "$new_csum" ] + then + csum=$new_csum + dwm + else + exit + fi + new_csum="$(sha1sum "$(which dwm)")" + sleep 5 +done |