From 663e96d3aa3eb7c5aa8babe06f4fc9fceb7caa04 Mon Sep 17 00:00:00 2001 From: primardj Date: Sun, 24 Mar 2024 23:41:47 +0000 Subject: [PATCH] add the script --- print_yuck_disks_mounted | 56 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 print_yuck_disks_mounted diff --git a/print_yuck_disks_mounted b/print_yuck_disks_mounted new file mode 100755 index 0000000..4e2186d --- /dev/null +++ b/print_yuck_disks_mounted @@ -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}"