mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-01-30 09:48:11 +01:00
Small improvements
This commit is contained in:
parent
3aac111668
commit
4107cb2fb6
@ -32,8 +32,8 @@ test -b /dev/mapper/"${cryptid##*/}" &&
|
||||
mntline=$(echo "$lsblkoutput" | tac | grep -m1 -n "/${chosen#*/}" | cut -d':' -f1)
|
||||
[ -n "$mntline" ] &&
|
||||
devlabel=$(echo "$lsblkoutput" | tac | tail -n +"$mntline" | grep -m1 '[^ ]* disk' | cut -d'/' -f3 | cut -d' ' -f1) &&
|
||||
samedrivemounts=$(echo "$lsblkoutput" | tac | awk "\$1~/$devlabel/&&!devfound{devfound=1;cnt=0}devfound{if(\$2~/disk/||cnt>1){print cnt;exit}if(\$4){cnt+=1}}") &&
|
||||
samedrivemounts=$(echo "$lsblkoutput" | tac | awk '$1~/'"$devlabel"'/&&!cnt{cnt=1}cnt{if($2~/disk/||cnt>2){cnt-=1;print cnt;exit}if($4){cnt+=1}}') &&
|
||||
[ "$samedrivemounts" = 1 ] &&
|
||||
[ $(printf "No\nYes" | dmenu -p 'Device fully unmounted. Eject this drive?') == 'Yes' ] &&
|
||||
sudo -A sh -c "echo 'offline' > /sys/block/$devlabel/device/state; echo '1' > /sys/block/$devlabel/device/delete" &&
|
||||
sudo -A sh -c "echo offline > /sys/block/$devlabel/device/state; echo 1 > /sys/block/$devlabel/device/delete" &&
|
||||
notify-send "Device ejected." "Drive can now be removed safely."
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user