Skip to content

Commit

Permalink
Improve connected display
Browse files Browse the repository at this point in the history
  • Loading branch information
NEMS Linux committed Mar 2, 2019
1 parent 8fde8c2 commit c4fd1ba
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 8 deletions.
60 changes: 52 additions & 8 deletions bootscreen.sh
@@ -1,11 +1,30 @@
#!/bin/bash
ver=$(/usr/local/bin/nems-info nemsver)
dialog --title "NEMS Linux $ver" --infobox "\
Refreshing...
" 20 72
veravail=$(/usr/local/bin/nems-info nemsveravail)

# Global variables
ver=$(/usr/local/bin/nems-info nemsver)
host=$(/bin/hostname)

display_screen() {
if [[ $2 == 'warning' ]]; then
conf=/usr/local/share/nems/nems-scripts/settings/dialog.warning
else
conf=/usr/local/share/nems/nems-scripts/settings/dialog.normal
fi
env DIALOGRC=$conf dialog --title "$1" \
--no-collapse \
--infobox "$output" 20 72
}

# Loading screen
output="Loading..."
display_screen "NEMS Linux $ver"


while :
do

alias=$(/usr/local/bin/nems-info alias)
veravail=$(/usr/local/bin/nems-info nemsveravail)
users=$(/usr/local/bin/nems-info users)
cpupercent=$(/usr/local/bin/nems-info cpupercent)
diskusage=$(/usr/local/bin/nems-info diskusage)
Expand All @@ -29,7 +48,14 @@ if [[ $init == "0" ]]; then
output_init="Your NEMS server is not yet initialized. Please run: sudo nems-init"
fi

dialog --title "NEMS Linux $ver" --infobox "\
if (( $ver < $veravail )); then
current="- $veravail is Available."
else
current=""
fi
output="\
NEMS Version: $ver $current\n\
Server Alias: $alias\n\
Platform: $platform_name\n\
Hostname: $host.local\n\
IP Address: $ip\n\
Expand All @@ -41,5 +67,23 @@ Internet Status: $internet\n\
\n\
To login, use SSH or press CTRL-ALT-F2\n\
\n\
For help, visit: docs.nemslinux.com" 20 72 # make these number match the refreshing note
sleep 30
For help, visit: docs.nemslinux.com"
display_screen "NEMS Server Overview"

sleep 10

# NEMS Warning Light Current State Screen
if [[ -e /var/log/nems/nems-tools/currentstate ]]; then
output=$(cat /var/log/nems/nems-tools/currentstate)
if [[ $output == *"CRITICAL"* ]]; then
conf="warning"
timer=45
else
conf="normal"
timer=10
fi
display_screen "NEMS Current State" $conf
sleep $timer
fi

done
16 changes: 16 additions & 0 deletions settings/dialog.normal
@@ -0,0 +1,16 @@
aspect = 0
separate_widget = ""
tab_len = 0
visit_items = OFF
use_shadow = OFF
use_colors = ON
screen_color = (WHITE,DEFAULT,OFF)
shadow_color = (WHITE,WHITE,OFF)
dialog_color = (WHITE,BLACK,OFF)
title_color = (GREEN,BLACK,OFF)
border_color = (WHITE,BLACK,OFF)
button_active_color = (BLACK,YELLOW,OFF)
button_inactive_color = (WHITE,BLACK,OFF)
button_key_active_color = (BLACK,GREEN,OFF)
button_key_inactive_color = (RED,BLACK,OFF)
button_label_active_color = (BLACK,YELLOW,OFF)
16 changes: 16 additions & 0 deletions settings/dialog.warning
@@ -0,0 +1,16 @@
aspect = 0
separate_widget = ""
tab_len = 0
visit_items = OFF
use_shadow = OFF
use_colors = ON
screen_color = (WHITE,RED,OFF)
shadow_color = (WHITE,WHITE,OFF)
dialog_color = (WHITE,BLACK,OFF)
title_color = (GREEN,BLACK,OFF)
border_color = (WHITE,BLACK,OFF)
button_active_color = (BLACK,YELLOW,OFF)
button_inactive_color = (WHITE,BLACK,OFF)
button_key_active_color = (BLACK,GREEN,OFF)
button_key_inactive_color = (RED,BLACK,OFF)
button_label_active_color = (BLACK,YELLOW,OFF)

0 comments on commit c4fd1ba

Please sign in to comment.