add the script

This commit is contained in:
primardj 2024-03-24 23:41:47 +00:00
parent 557ede0c0c
commit 663e96d3aa

56
print_yuck_disks_mounted Executable file
View file

@ -0,0 +1,56 @@
#!/bin/sh
output="(box :class \"disks_box\" :orientation 'v' "
field="$(ls -l /dev/mapper/cryptdata-* 2> /dev/null| cut -d " " -f 9)
$(ls -l /dev/mapper/cryptlvm-root 2> /dev/null| cut -d " " -f 9)
$(ls -l /dev/mapper/cryptlvm-home 2> /dev/null| cut -d " " -f 9)"
all_values=""
for i in $field
do
if [ ! "${all_values}" == "" ]
then
all_values="${all_values}\n"
fi
result=$(df "$i" -h --output="target,size,used,pcent" | tail -n 1)
all_values="${all_values}${result///home\/primardj/\~}"
#echo $(df "$i" -h --output="source,size,used,pcent" | tail -n 1)
done
echo -e $all_values > /tmp/disk_opens
while read inp
do
v1="$(echo ${inp} | cut -d " " -f 1 )"
v2="$(echo ${inp} | cut -d " " -f 2 )"
v3="$(echo ${inp} | cut -d " " -f 3 )"
v4="$(echo ${inp} | cut -d " " -f 4 )"
v4="${v4/\%/}"
output="${output} (box :orientation \"h\" :halign \"fill\" :space-evenly false "
output="${output} (box :orientation \"h\" :halign \"start\" :hexpand true :space-evenly false "
output="${output} (label :class \"val_disks\" :halign \"start\" :text \"${v1:0:17}\" )"
output="${output} ) (box :orientation \"h\" :halign \"end\" :space-evenly false "
#output="${output} (label :class \"val_disks\" :halign \"end\" :text \"${v3}/${v2}\" )"
output="${output} (progress :valign \"center\" :halign \"end\" :width 25 :class \"disk_bar\" :value \"${v4}\" )"
output="${output} ))"
#output="${output} (box :orientation \"h\" (label :class \"val_label\":halign \"fill\" :text \"${inp}\" ))"
#echo $inp
done < /tmp/disk_opens
output="${output} )"
#echo -e $all_values
echo $output
#output="${output}${field})"
#echo "${output}"