Add 'mounter' and 'umounter' scripts

This commit is contained in:
samedami 2020-05-15 13:00:36 +02:00
parent 5bd2886fe2
commit db48d32b56
No known key found for this signature in database
GPG Key ID: FCB4A9A20D00E894
3 changed files with 28 additions and 0 deletions

View File

@ -47,6 +47,10 @@ super + shift + e
fawesome
F11
[ $(pgrep ffmpeg) ] && blaze -s || blaze
F1
mounter
F2
umounter
#~~~~~~~~~~~

14
.local/bin/scripts/mounter Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
data() { lsblk -r | sed '/.*k $/d; /t \//d; 1d' | awk '{ print $1 " - " $4 }' ;}
[ ! "$(data)" ] && { rofi -e "Nothing to mount!"; exit 1 ;}
m() { rofi -dmenu -i "$@" ;}
part="$(data | m -p "Partition" -l "$(data | wc -l)" | awk '{ print $1 }')"
[ ! "$part" ] && exit 1
mpoints() { find /mnt /media -type d ;}
mountpoint="$(mpoints | m -p "Mountpoint" -l "$(mpoints | wc -l)")"
[ ! "$mountpoint" ] && exit 1
pass="$(m -l 0 -p "Password" -password)"
echo "$pass" | sudo -S -v && sudo mount /dev/"$part" "$mountpoint"

10
.local/bin/scripts/umounter Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
data() { lsblk -r | awk '/t \// { print $1 " - " $7 }' ;}
m() { rofi -dmenu -i "$@" ;}
part="$(data | m -p "Partition" -l "$(data | wc -l)" | awk '{ print $1 }')"
[ ! "$part" ] && exit 1
pass="$(m -l 0 -p "Password" -password)"
echo "$pass" | sudo -S -v && sudo umount /dev/"$part"