Commit aba5bfa2 authored by Philipp's avatar Philipp

Added some (yet undocumented and hastily tested) helper scripts for installation and updating.

Also changed link on contact and info pages (private)
parent d23ef2b8
...@@ -290,7 +290,7 @@ ...@@ -290,7 +290,7 @@
</a> </a>
</p> </p>
<p> <p>
<a href="https://wow.metoffice.gov.uk/observations/details/20180410y7uumj3hzwe6tkbnyyb96sp15e" target="_blank"> <a href="http://wow.metoffice.gov.uk/observations/details?site_id=74ea0cdd-7812-e811-90cf-0003ff597480" target="_blank">
<img src="assets/img/metoffice.jpg" alt="MetOffice" /> <img src="assets/img/metoffice.jpg" alt="MetOffice" />
</a> </a>
</p> </p>
......
...@@ -221,7 +221,7 @@ ...@@ -221,7 +221,7 @@
</a> </a>
</p> </p>
<p> <p>
<a href="https://wow.metoffice.gov.uk/observations/details/20180410y7uumj3hzwe6tkbnyyb96sp15e" target="_blank"> <a href="http://wow.metoffice.gov.uk/observations/details?site_id=74ea0cdd-7812-e811-90cf-0003ff597480" target="_blank">
<img src="assets/img/metoffice.jpg" alt="MetOffice" /> <img src="assets/img/metoffice.jpg" alt="MetOffice" />
</a> </a>
</p> </p>
......
#!/bin/sh
#
# RabenwetterInstaller v0.1
# (C) 2019 by Philipp Giebel <info@rabenwetter.de>
#
# This script can help new users to automatically install the Rabenwetter
# template.
# It's pretty new and only tested working on Raspbian Stretch using the .deb
# package of weewx available at http://weewx.com/
#
# However: It should work with most linux based systems. Have a try, but do a
# complete backup of your weewx configuration first.
#
# Prequisites:
# - weewx (obviously..)
# - git
# - patch
#
#
# Rabenwetter is free template for weewx (weewx.com)
# by Philipp Giebel <info@rabenwetter.de>
#
# For more info check out
# https://www.rabenwetter.de or
# https://gitlab.ambhost.net/stimpy/template_rabenwetter
#
if [ "$( whoami )" != "root" ]
then
echo "You need to run this script as root."
exit 1
fi
GIT=$( which git )
if [ $? -gt 0 ]
then
echo "You need git and patch to run this script."
exit 2
fi
PATCH=$( which patch )
if [ $? -gt 0 ]
then
echo "You need git and patch to run this script."
exit 3
fi
if [ -z "$2" ]
then
echo "use: $0 <path/to/your/weewx/installation> <language> [--dry]"
echo " eg: $0 /etc/weewx en"
echo ""
exit 4
fi
if [ ! -d "$1" ]
then
echo "use: $0 <path/to/your/weewx/installation> <language> [--dry]"
echo " eg: $0 /etc/weewx en"
echo ""
echo "Skin directory not found: $1"
echo ""
exit 5
fi
echo "*** Rabenwetter Installer ***"
echo " - initializing"
if [ -n "$3" ] && [ "$3" != "--dry" ]
then
CHEETAHPATH="$3"
else
CHEETAHPATH="/usr/share/weewx/weewx/cheetahgenerator.py"
fi
if [ "$3" = "--dry" ] || [ "$4" = "--dry" ]
then
DRY=1
else
DRY=0
fi
olddir=$(pwd)
rm -rf /tmp/rwi
mkdir -p /tmp/rwi
cd /tmp/rwi
echo " - downloading"
git clone https://gitlab.ambhost.net/stimpy/template_rabenwetter.git -q
if [ ! -d "template_rabenwetter/dist/i18n/$2" ]
then
echo ""
echo "use: $0 <path/to/your/weewx/installation> <language> [--dry]"
echo " eg: $0 /etc/weewx en"
echo ""
echo "Language not found: $2"
echo "Available languages: $( ls -m template_rabenwetter/dist/i18n/ )"
echo ""
exit 6
fi
echo " - preparing"
cp -r template_rabenwetter/dist/i18n/$2/* template_rabenwetter/dist/
rm -rf template_rabenwetter/dist/i18n
chmod -R 755 template_rabenwetter/dist
find template_rabenwetter/dist/ -type f -exec chmod 644 "{}" \;
if [ $DRY -eq 0 ]
then
echo " - installing skin"
mkdir -p "$1/skins/Rabenwetter"
cp -r template_rabenwetter/dist/* "$1/skins/Rabenwetter/"
else
echo " - Not actually copying template_rabenwetter/dist/* to $1/skins/Rabenetter/ (--dry)"
fi
if [ -e $CHEETAHPATH ]
then
if [ $DRY -eq 0 ]
then
echo -n " - patching $CHEETAHPATH "
patch -r - -sNp1 "$CHEETAHPATH" template_rabenwetter/cheetahgenerator.patch >/dev/null
if [ $? -gt 0 ]
then
echo "error!"
echo " ! cannot apply patch. Maybe, it is already applied?"
echo " ! Continuing for now..."
echo ""
else
echo "done"
fi
else
echo " - Not actually patching cheetahgenerator.py (--dry)"
fi
else
echo " - patching $CHEETAHPATH error!"
echo " ! cannot apply patch. Please rerun the installer and provide a full path"
echo " ! to your existing cheetahgenerator.py:"
echo " ! $0 $1 $2 $CHEETAHPATH [--dry]"
echo ""
exit 7
fi
if [ $( grep -ci '^\s*skin\s*=\s*standard' "$1/weewx.conf" ) -gt 0 ]
then
if [ $DRY -eq 0 ]
then
echo " - updating weewx.conf to use Rabenwetter skin."
sed -i 's/^\(\s*\)skin\s*=\s*standard.*/\1skin = Rabenwetter/i' "$1/weewx.conf"
else
echo " - Not actually updating weewx.conf to use Rabenwetter skin. (--dry)"
fi
else
echo " - non-standard-skin detected!"
echo " ! non-standard skin installed. please manually update your weewx.conf to"
echo " ! use the skin \"Rabenwetter\"."
echo " ! Look for the section starting with \"[[StandardReport]]\" and change"
echo " ! the parameter \"skin\" below. E.g:"
echo " ! [[StandardReport]]"
echo " ! skin = Rabenwetter"
echo ""
fi
echo " - done."
echo ""
cd "$olddir"
rm -rf /tmp/rwi
echo "Please update the configuration at $1/skins/Rabenwetter/skin.conf "
echo "to match your system, then restart weewx."
echo ""
#!/bin/sh
#
# RabenwetterUpdate v0.1
# (C) 2019 by Philipp Giebel <info@rabenwetter.de>
#
# This script can help existing users to automatically update their Rabenwetter
# template.
# It's pretty new and only tested working on Raspbian Stretch using the .deb
# package of weewx available at http://weewx.com/
#
# However: It should work with most linux based systems. Have a try, but do a
# complete backup of your weewx configuration first.
#
# Prequisites:
# - weewx (obviously..)
# - existing installation of the Rabenwetter skin
# - git
# - diff
# - GNU stat
#
#
# Rabenwetter is free template for weewx (weewx.com)
# by Philipp Giebel <info@rabenwetter.de>
#
# For more info check out
# https://www.rabenwetter.de or
# https://gitlab.ambhost.net/stimpy/template_rabenwetter
#
if [ "$( whoami )" != "root" ]
then
echo "You need to run this script as root."
exit 1
fi
GIT=$( which git )
if [ $? -gt 0 ]
then
echo "You need git, diff and GNU stat to run this script."
exit 2
fi
STAT=$( which stat )
if [ $? -gt 0 ]
then
echo "You need git, diff and GNU stat to run this script."
exit 3
fi
DIFF=$( which diff )
if [ $? -gt 0 ]
then
echo "You need git, diff and GNU stat to run this script."
exit 4
fi
if [ -z "$2" ]
then
echo "use: $0 <path/to/your/rabenwetter/skin> <language> [--dry]"
echo " eg: $0 /etc/weewx/skins/Rabenwetter en"
echo ""
exit 5
fi
if [ ! -d "$1" ]
then
echo "use: $0 <path/to/your/rabenwetter/skin> <language> [--dry]"
echo " eg: $0 /etc/weewx/skins/Rabenwetter en"
echo ""
echo "Skin directory not found: $1"
echo ""
exit 6
fi
echo "*** Rabenwetter Update script ***"
echo " - initializing"
olddir=$(pwd)
rm -rf /tmp/rwu
mkdir -p /tmp/rwu
cd /tmp/rwu
echo " - downloading"
git clone https://gitlab.ambhost.net/stimpy/template_rabenwetter.git -q
if [ ! -d "template_rabenwetter/dist/i18n/$2" ]
then
echo ""
echo "use: $0 <path/to/your/rabenwetter/skin> <language> [--dry]"
echo " eg: $0 /etc/weewx/skins/Rabenwetter en"
echo ""
echo "Language not found: $2"
echo "Available languages: $( ls -m template_rabenwetter/dist/i18n/ )"
echo ""
exit 7
fi
echo " - preparing"
cp -r template_rabenwetter/dist/i18n/$2/* template_rabenwetter/dist/
rm -rf template_rabenwetter/dist/i18n
mv template_rabenwetter/dist/skin.conf template_rabenwetter/dist/skin.conf.dist
chmod -R 755 template_rabenwetter/dist
find template_rabenwetter/dist/ -type f -exec chmod 644 "{}" \;
if [ "$3" != "--dry" ]
then
echo " - updating skin"
cp -r template_rabenwetter/dist/* "$1/"
else
echo " - Not actually copying template_rabenwetter/dist/* to $1/ (--dry)"
fi
WWW=$( grep HTML_ROOT "$1/../../weewx.conf" |grep -v '^\s*#' |cut -d'=' -f2 |sed -e 's/^[[:space:]]*//' )
if [ -d "$WWW" ]
then
WWWUSER=$( $STAT -c '%U' "$WWW/assets" )
WWWGROUP=$( $STAT -c '%G' "$WWW/assets" )
if [ "$3" != "--dry" ]
then
echo " - updating website"
cp -r template_rabenwetter/dist/assets "$www/"
chown -R $WWWUSER:$WWWGROUP "$WWW/assets"
chmod -R 775 "$WWW/assets"
find "$WWW/assets/" -type f -exec chmod 664 "{}" \;
else
echo " - Not actually copying template_rabenwetter/dist/assets to $www/ (--dry)"
fi
fi
echo " - done."
echo ""
echo "=== New and changed configuration variables: ================================"
$DIFF -wn "$1/skin.conf.dist" "$1/skin.conf" |sed -e '1,2d'
echo "============================================================================="
echo ""
cd "$olddir"
rm -rf /tmp/rwu
echo "Please check your existing config at $1/skin.conf for changes against "
echo "the updated config at $1/skin.conf.dist, then restart weewx."
echo ""
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