Commit e279f278 authored by Philipp's avatar Philipp

Updated install script for weewx 3.9

parent 81b80cb9
......@@ -9,6 +9,7 @@ For an even more complete changelog check the commits at
https://gitlab.ambhost.net/stimpy/template_rabenwetter/commits/master
February 2019
! Updated installscript for weewx 3.9
+ Added (optional) support for second cam timelapses
+ Added support for automatically switching summer and winter themed colors
- Removed private info and contact files from repo and
......
#!/bin/sh
#
# RabenwetterInstaller v0.1b
# RabenwetterInstaller v0.2b
# (C) 2019 by Philipp Giebel <info@rabenwetter.de>
#
# This script can help new users to automatically install the Rabenwetter
......@@ -118,11 +118,26 @@ else
DRY=0
fi
VERSION=$( grep -i version ${weepath}/weewx.conf |sed 's/version = \([0-9\.]\+\)/\1/' |sed 's/\.//g' )
if [ $? -gt 0 ]
then
echo ""
echo "ERROR: Weewx config not found. Please install weewx first and/or provide the "
echo " full, physical path to your weewx configuration directory."
echo " For detailed help on all the parameters, please run:"
echo " ./install.sh $weepath $lang </full/path/to/cheetahgenerator.py>"
echo " ./install.sh $weepath $lang $cheetahpath"
fi
if [ -n "$3" ] && [ "$3" != "--dry" ]
then
cheetahpath="$3"
else
echo " ! No cheetah path provided. Assuming: $cheetahpath"
if [ $VERSION -lt 390 ]
then
echo " ! No cheetah path provided. Assuming: $cheetahpath"
fi
fi
if [ ! -d "$weepath" ]
......@@ -192,9 +207,9 @@ else
echo " to $weepath/skins/Rabenetter/ (--dry)"
fi
if [ -e $cheetahpath ]
if [ -e $cheetahpath ] && [ $VERSION -lt 390 ]
then
if [ $DRY -eq 0 ]
if [ $DRY -eq 0 ]
then
echo " - patching $cheetahpath"
$PATCH -r - -sNp1 "$cheetahpath" template_rabenwetter/cheetahgenerator.patch >/dev/null
......@@ -207,14 +222,15 @@ then
else
echo " - Not actually patching cheetahgenerator.py (--dry)"
fi
else
elif [ $VERSION -lt 390 ]
then
echo ""
echo "ERROR: Cannot find $cheetahpath for patching."
echo "This file comes with weewx and needs to be patched."
echo "Please find its location on your system, rerun the installer"
echo "and provide the full path to your cheetahgenerator.py as a"
echo "parameter. e.g:"
echo -n " $0 $weepath $lang $cheetahpath"
echo -n " ./install.sh $weepath $lang $cheetahpath"
if [ $DRY -gt 0 ]
then
echo " --dry"
......@@ -233,6 +249,32 @@ then
then
echo " - updating weewx.conf to use Rabenwetter skin."
sed -i 's/^\(\s*\)skin\s*=\s*standard.*/\1skin = Rabenwetter/i' "$weepath/weewx.conf"
flag=0
echo -n "" >/tmp/rwi/new.conf
while IFS="" read -r line || [ -n "$line" ]
do
if [ $( echo "$line" | grep -c '\[\[StandardReport\]\]' ) -gt 0 ]
then
flag=1
elif [ $( echo "$line" | grep -c '\[\[SeasonsReport\]\]' ) -gt 0 ] ||
[ $( echo "$line" | grep -c '\[\[SmartphoneReport\]\]' ) -gt 0 ] ||
[ $( echo "$line" | grep -c '\[\[MobileReport\]\]' ) -gt 0 ]
then
flag=2
elif [ $( echo "$line" | grep -c '\[' ) -gt 0 ]
then
flag=0
fi
if [ $flag -eq 1 ] && [ $( echo "$line" | grep -c 'enable =' ) -gt 0 ]
then
line=$(echo "$line" |sed 's/^\(\s*\)enable\s*=\s*false.*/\1enable = true/i')
elif [ $flag -eq 2 ] && [ $( echo "$line" | grep -c 'enable =' ) -gt 0 ]
then
line=$(echo "$line" |sed 's/^\(\s*\)enable\s*=\s*true.*/\1enable = false/i')
fi
echo "$line" >>/tmp/rwi/new.conf
done <$weepath/weewx.conf
cp /tmp/rwi/new.conf "$weepath/weewx.conf"
else
echo " - Not actually updating weewx.conf to use Rabenwetter skin. (--dry)"
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment