Skip to content

Commit

Permalink
add emonpi bash-rw-inidcator and motd
Browse files Browse the repository at this point in the history
  • Loading branch information
glynhudson committed Oct 31, 2016
1 parent c3bee09 commit c21e61c
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
17 changes: 17 additions & 0 deletions bash-rw-indicator
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

# emonPi bash RW / RO prompt
# Thanks to Andy Taylor: https://community.openenergymonitor.org/t/increase-emonsd-pre-built-sd-ca$

set_bash_prompt(){
fs_mode=$(mount | sed -n -e "s/^\/dev\/mmcblk0p2 on \/ .*(\(r[w|o]\).*/\1/p")

if [ $(id -u) -eq 0 ];
then
PS1='\[\033[01;31m\]\u@\h${fs_mode:+($fs_mode)}\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]\$
else
PS1='\[\033[01;32m\]\u@\h${fs_mode:+($fs_mode)}\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]\$
fi
}

# setup fancy prompt
PROMPT_COMMAND=set_bash_prompt
15 changes: 13 additions & 2 deletions emonpiupdate
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ echo "================================="
echo
echo "EUID: $EUID"
echo

# Needed for emonPi LCD Hi-Link 3G dongle support
sudo pip install xmltodict
sudo pip install requests
# ALLREADY INSTALLED
# sudo pip install xmltodict
# sudo pip install requests

sudo /etc/init.d/emonhub stop

Expand All @@ -24,3 +26,12 @@ avrdude -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:/home/pi/e

# RFM69Pi with RFM69CW Update
# avrdude -v -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 38400 -U flash:w:/home/pi/RFM2Pi/firmware/RFM69CW_RF_Demo_ATmega328/RFM69CW_RF12_Demo_ATmega328.cpp.hex

sudo /etc/init.d/emonhub start
###############################################################################################################

# Add bash prompt RW / RO emonPi file-system indicator
if ! grep -Fxq "# emonPi bash RW / RO prompt" /etc/bash.bashrc ; then
echo "Add RW bash prompt indicator"
sudo bash -c 'cat bash-rw-indicator >> /etc/bash.bashrc'
fi
Empty file removed master
Empty file.
12 changes: 12 additions & 0 deletions motd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

Welcome to emonPi shell. The file system is in Read Only (RO) mode. If you need to make changes,
use the command 'rpi-rw' to put the file system in Read Write (RW) mode.
Use 'rpi-ro' to return to RO mode. The /home/pi/data directory is always in RW mode.

0 comments on commit c21e61c

Please sign in to comment.