From efcddce80adcf7db789ea847638b2a489fc99150 Mon Sep 17 00:00:00 2001 From: reese sapphire Date: Fri, 23 Sep 2022 17:58:38 +0000 Subject: [PATCH 1/2] add motd.sh --- motd.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 motd.sh diff --git a/motd.sh b/motd.sh new file mode 100644 index 0000000..847d09e --- /dev/null +++ b/motd.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +progress() { + value=$1 + width=10 + step_size=$((100 / $width)) + num_of_progress_items=$(($value / $step_size)) + + printf '[' + # if >= 90%, make it red + if [ $value -ge 90 ]; then printf '\033[1;31m'; fi + for i in $(seq 0 $width); do + [ $i -le $num_of_progress_items ] && printf '■' || printf ' ' + done + printf '\033[0m' # reset color + printf ']' +} + +space=$(zfs get -Ho value used,quota $HOME | paste - -) +used=$(echo $space | awk '{ print $1 }') +quota=$(echo $space | awk '{ print $2 }') + +space_raw=$(zfs get -Hpo value used,quota $HOME | paste - -) +used_raw=$(echo $space_raw | awk '{ print $1 }') +quota_raw=$(echo $space_raw | awk '{ print $2 }') +pcent=$(((used_raw * 100) / quota_raw)) + +echo +echo "Welcome to your LayerZero backup server! ^(;.;)^" +echo "Please read suggestions.md to see how you can use it." +echo "Your disk usage: $used / $quota $(progress $pcent) $pcent%" +echo -- 2.45.2 From bb35a8c8d0a260d94534c1939aa320d2c4c270d1 Mon Sep 17 00:00:00 2001 From: Reese Sapphire Date: Sun, 25 Sep 2022 00:04:54 -0500 Subject: [PATCH 2/2] rename motd.sh to .bash_profile - update to reference the suggestions manpage - remove crunchbang line --- motd.sh => .bash_profile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) rename motd.sh => .bash_profile (92%) diff --git a/motd.sh b/.bash_profile similarity index 92% rename from motd.sh rename to .bash_profile index 847d09e..7d03e25 100644 --- a/motd.sh +++ b/.bash_profile @@ -1,5 +1,3 @@ -#!/bin/sh - progress() { value=$1 width=10 @@ -27,6 +25,6 @@ pcent=$(((used_raw * 100) / quota_raw)) echo echo "Welcome to your LayerZero backup server! ^(;.;)^" -echo "Please read suggestions.md to see how you can use it." +echo "Use the command `man suggestions` to see what you can do." echo "Your disk usage: $used / $quota $(progress $pcent) $pcent%" echo -- 2.45.2