-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c84ae04
commit ee5b5b0
Showing
35 changed files
with
638 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/sh | ||
WEBMATICDIR=/usr/local/etc/config/addons/www/wmalpha | ||
CONFIG_URL=/addons/wmalpha/index.html | ||
|
||
case "$1" in | ||
|
||
""|start|restart|stop) | ||
exit 0 | ||
;; | ||
|
||
info) | ||
VER=$(cat ${WEBMATICDIR}/VERSION) | ||
echo "Info: <center>" | ||
echo "Info: <b>WebMatic (TEST) ${VER}</b><br>" | ||
echo "Info: <img src='/addons/webmatic/img/misc/webmatic.png'><br>" | ||
echo "Info: <a href='https://github.com/jens-maus/webmatic'>Weitere Infos</a>" | ||
echo "Info: </center>" | ||
echo "Name: WebMatic (TEST)" | ||
echo "Version: ${VER}" | ||
echo "Operations: uninstall" | ||
echo "Config-Url: ${CONFIG_URL}" | ||
echo "Update: /addons/wmalpha/cgi/update-check-alpha.cgi" | ||
;; | ||
|
||
uninstall) | ||
${WEBMATICDIR}/update_addon wmalpha | ||
rm -rf ${WEBMATICDIR} | ||
rm -rf ${WEBMATICDIR}_user | ||
;; | ||
|
||
*) | ||
echo "Usage: wmalpha {info|uninstall}" >&2 | ||
exit 1 | ||
;; | ||
|
||
esac | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
#!/bin/sh | ||
|
||
echo "BEGINN" | ||
|
||
ADDONNAME=wmalpha | ||
WWWDIR=/usr/local/etc/config/addons/www/${ADDONNAME} | ||
RCDDIR=/usr/local/etc/config/rc.d | ||
USERDIR=/usr/local/etc/config/addons/www/${ADDONNAME}_user | ||
USERCSS=${USERDIR}/themes/wm-user-theme.css | ||
USERLANG=${USERDIR}/lang.json | ||
|
||
if [ "$1" = "" ]; then | ||
echo "CCU1" | ||
mount -t yaffs /dev/mtdblock3 /usr/local | ||
elif [ "$1" = "CCU2" ]; then | ||
echo "CCU2" | ||
mount -t ubifs ubi1:user /usr/local | ||
elif [ "$1" = "HM-RASPBERRYMATIC" ]; then | ||
echo "HM-RASPBERRYMATIC" | ||
mount /usr/local | ||
fi | ||
|
||
echo "Installationsumgebung: $1" | ||
|
||
# create | ||
echo "Verzeichnisse erstellen" | ||
mkdir -p ${WWWDIR} | ||
chmod 755 ${WWWDIR} | ||
mkdir -p ${RCDDIR} | ||
chmod 755 ${RCDDIR} | ||
mkdir -p ${USERDIR}/themes | ||
mkdir -p ${USERDIR}/img/ids/favorites | ||
mkdir -p ${USERDIR}/img/ids/functions | ||
mkdir -p ${USERDIR}/img/ids/rooms | ||
mkdir -p ${USERDIR}/img/ids/programs | ||
mkdir -p ${USERDIR}/img/ids/variables | ||
mkdir -p ${USERDIR}/img/ids/devices | ||
chmod 755 ${USERDIR} | ||
|
||
if [ ! -e "$USERCSS" ] | ||
then | ||
echo "User CSS Datei erstellen" | ||
touch -- "$USERCSS" | ||
else | ||
echo "User CSS Datei vorhanden" | ||
fi | ||
|
||
# cleanup | ||
echo "Alte Version entfernen" | ||
rm -rf ${WWWDIR}/* | ||
rm -f ${RCDDIR}/webmatic-dlg | ||
|
||
# lang | ||
if [ -e "$USERLANG" ] | ||
then | ||
echo "Sprachdatei vorhanden" | ||
LANG=$(cat ${USERLANG}) | ||
echo "Installationssprache: $LANG" | ||
if [ "$LANG" != "de" ] | ||
then | ||
echo "Dateien auf $LANG stellen" | ||
sed -i 's/html lang=\"de\"/html lang=\"'"$LANG"'\"/' ${ADDONNAME}/index.html | ||
sed -i 's/html lang=\"de\"/html lang=\"'"$LANG"'\"/' ${ADDONNAME}/get.html | ||
sed -i 's/wmmap.de.min.js/wmmap.'"$LANG"'.min.js/' ${ADDONNAME}/webmatic.appcache | ||
sed -i 's/wmmap.de.min.js/wmmap.'"$LANG"'.min.js/' ${ADDONNAME}/index.html | ||
sed -i 's/wmmap.de.min.js/wmmap.'"$LANG"'.min.js/' ${ADDONNAME}/get.html | ||
sed -i 's/jtsage-datebox.i18n.de.utf8.min.js/jtsage-datebox.i18n.'"$LANG"'.utf8.min.js/' ${ADDONNAME}/webmatic.appcache | ||
sed -i 's/jtsage-datebox.i18n.de.utf8.min.js/jtsage-datebox.i18n.'"$LANG"'.utf8.min.js/' ${ADDONNAME}/index.html | ||
sed -i 's/jtsage-datebox.i18n.de.utf8.min.js/jtsage-datebox.i18n.'"$LANG"'.utf8.min.js/' ${ADDONNAME}/get.html | ||
sed -i 's/wmLang=\"de\"/wmLang=\"'"$LANG"'\"/' ${ADDONNAME}/js/wmhelper.min.js | ||
else | ||
echo "Installationssprache ist deutsch" | ||
fi | ||
else | ||
echo "Sprachdatei $USERLANG nicht vorhanden" | ||
fi | ||
|
||
# copy | ||
echo "Dateien in den richtigen Ordner kopieren" | ||
cp -R ${ADDONNAME}/* ${WWWDIR}/ | ||
cp VERSION ${WWWDIR}/ | ||
cp rc.d/${ADDONNAME} ${RCDDIR}/ | ||
chmod +x ${RCDDIR}/${ADDONNAME} | ||
|
||
# copy update_addon program | ||
if [ "$1" = "" ]; then | ||
cp -a ccu1/update_addon ${WWWDIR}/ | ||
elif [ "$1" = "CCU2" ]; then | ||
cp -a ccu2/update_addon ${WWWDIR}/ | ||
elif [ "$1" = "HM-RASPBERRYMATIC" ]; then | ||
cp -a ccurm/update_addon ${WWWDIR}/ | ||
fi | ||
|
||
# add menu entry | ||
echo "Menueintrag erstellen" | ||
touch /usr/local/etc/config/hm_addons.cfg | ||
${WWWDIR}/update_addon wmalpha ${WWWDIR}/wmalpha_addon.cfg | ||
|
||
# sync filesystem to make sure all changes are written to disk | ||
sync | ||
|
||
if [ "$1" = "" ]; then | ||
echo "CCU1" | ||
elif [ "$1" = "CCU2" ]; then | ||
echo "CCU2" | ||
# CCU2 always reboots after Addon/Firmware Update | ||
elif [ "$1" = "HM-RASPBERRYMATIC" ]; then | ||
echo "HM-RASPBERRYMATIC" | ||
# RASPBERRYMATIC always reboots after Addon/Firmware Update | ||
fi | ||
|
||
echo "ENDE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/tclsh | ||
|
||
set checkURL "https://raw.githubusercontent.com/jens-maus/webmatic/master/VERSIONALPHA" | ||
set downloadURL "https://github.com/jens-maus/webmatic/releases" | ||
|
||
|
||
catch { | ||
set input $env(QUERY_STRING) | ||
set pairs [split $input &] | ||
foreach pair $pairs { | ||
if {0 != [regexp "^(\[^=]*)=(.*)$" $pair dummy varname val]} { | ||
set $varname $val | ||
} | ||
} | ||
} | ||
|
||
if { [info exists cmd ] && $cmd == "download"} { | ||
puts "<meta http-equiv='refresh' content='0; url=$downloadURL' />" | ||
} else { | ||
catch { | ||
set newversion [ exec /usr/bin/wget -qO- --no-check-certificate $checkURL ] | ||
} | ||
if { [info exists newversion] } { | ||
puts $newversion | ||
} else { | ||
puts "n/a" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/bin/tclsh | ||
|
||
load tclrega.so | ||
source [file join $env(DOCUMENT_ROOT) once.tcl] | ||
source [file join $env(DOCUMENT_ROOT) cgi.tcl] | ||
|
||
cgi_eval { | ||
cgi_input | ||
cgi_content_type "text/html; charset=iso-8859-1" | ||
|
||
set name "" | ||
set type "" | ||
set description "" | ||
set unit "" | ||
set state "" | ||
set val1 "" | ||
set val2 "" | ||
|
||
catch { import name } | ||
catch { import type } | ||
catch { import description } | ||
catch { import unit } | ||
catch { import state } | ||
catch { import val1 } | ||
catch { import val2 } | ||
|
||
array set res [rega_script { | ||
string varName = "} $name {"; | ||
string varType = "} $type {"; | ||
string varDesc = "} $description {"; | ||
string varUnit = "} $unit {"; | ||
string varState = "} $state {"; | ||
string varVal1 = "} $val1 {"; | ||
string varVal2 = "} $val2 {"; | ||
|
||
object svObj = dom.GetObject(varName); | ||
|
||
if (!svObj){ | ||
object svObjects = dom.GetObject(ID_SYSTEM_VARIABLES); | ||
svObj = dom.CreateObject(OT_VARDP); | ||
svObjects.Add(svObj.ID()); | ||
|
||
svObj.Name(varName); | ||
svObj.DPInfo(varDesc); | ||
svObj.ValueUnit(varUnit); | ||
|
||
if(varType == "2"){ | ||
svObj.ValueType(ivtBinary); | ||
svObj.ValueSubType(istBool); | ||
|
||
svObj.State(varState == "true"); | ||
svObj.ValueName0(varVal1); | ||
svObj.ValueName1(varVal2); | ||
} | ||
if(varType == "4"){ | ||
svObj.ValueType(ivtFloat); | ||
svObj.ValueSubType(istGeneric); | ||
|
||
svObj.State(varState.ToReal()); | ||
svObj.ValueMin(varVal1.ToReal()); | ||
svObj.ValueMax(varVal2.ToReal()); | ||
} | ||
if(varType == "16"){ | ||
svObj.ValueType(ivtBinary); | ||
svObj.ValueSubType(istEnum); | ||
|
||
svObj.ValueList(varVal1); | ||
svObj.State(varState.ToInteger()); | ||
} | ||
if(varType == "20"){ | ||
svObj.ValueType(ivtString); | ||
svObj.ValueSubType(istChar8859); | ||
|
||
svObj.State(varState); | ||
} | ||
|
||
svObj.Internal(false); | ||
svObj.Visible(true); | ||
dom.RTUpdate(false); | ||
|
||
WriteLine ('{ "id" : "' # svObj.ID() # '" }'); | ||
WriteLine ('{ "name" : "' # svObj.Name() # '" }'); | ||
} | ||
}] | ||
|
||
puts -nonewline $res(STDOUT) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.