Skip to content

Commit

Permalink
applied changes of 2.2.0 version
Browse files Browse the repository at this point in the history
  • Loading branch information
jens-maus committed Dec 8, 2018
1 parent 66ef50f commit 8f7963a
Show file tree
Hide file tree
Showing 26 changed files with 350 additions and 5 deletions.
Binary file modified ccu1/cuxd/cuxd
Binary file not shown.
77 changes: 77 additions & 0 deletions ccu1/rc.d/cuxdaemon
@@ -0,0 +1,77 @@
#!/bin/sh
CUXDIR=/usr/local/addons/cuxd
CONFIG_URL=/addons/cuxd/index.ccc
PIDFILE=/var/run/cuxd.pid
export LD_LIBRARY_PATH=/usr/local/addons/cuxd
export CURL_CA_BUNDLE=$CUXDIR/extra/cacert.pem

case "$1" in
""|start)
if [ ! -h /usr/local/etc/config/addons/www/cuxd ]
then ln -sf /usr/local/addons/cuxd /usr/local/etc/config/addons/www/cuxd
fi
if [ -f /usr/local/addons/cuxd/cuxd.ini ]
then
grep -v "^HM-SCRIPTHOST=\|^HM-SCRIPTPORT=\|^HM-REGAPORT=" /usr/local/addons/cuxd/cuxd.ini >/tmp/cuxd.ini
diff -q /usr/local/addons/cuxd/cuxd.ini /tmp/cuxd.ini >/dev/null
if [ $? -ne 0 ]
then mv /tmp/cuxd.ini /usr/local/addons/cuxd/cuxd.ini
fi
fi
chmod 0755 $CUXDIR/cuxd
$CUXDIR/cuxd >/dev/null 2>&1
logger -t homematic -p user.info "started cux-daemon"
;;

stop)
kill -TERM `cat $PIDFILE` 2>/dev/null
sleep 1
kill -0 `cat $PIDFILE` 2>/dev/null
if [ $? = 0 ]
then
sleep 10
kill -KILL `cat $PIDFILE` 2>/dev/null
fi
logger -t homematic -p user.info "stopped cux-daemon"
;;

restart)
kill -HUP `cat $PIDFILE` 2>/dev/null
logger -t homematic -p user.info "stopped (restart) cux-daemon"
sleep 1
kill -0 `cat $PIDFILE` 2>/dev/null
if [ $? = 0 ]
then
sleep 5
kill -KILL `cat $PIDFILE` 2>/dev/null
fi
chmod 0755 $CUXDIR/cuxd
$CUXDIR/cuxd >/dev/null 2>&1
logger -t homematic -p user.info "started cux-daemon"
;;

info)
VER=`/usr/local/addons/cuxd/cuxd -v`
echo "Info: <center><b>CUx-Daemon $VER</b><br><img src="../addons/cuxd/CUXD.PNG"></center>"
echo "Name: CUx-Daemon"
echo "Version: $VER"
echo "Operations: uninstall restart"
echo "Config-Url: $CONFIG_URL"
echo "Update: http://cuxd.de/cuxd-ccu1.php"
;;

uninstall)
logger -t homematic -p user.info "removing cux-daemon"
killall -KILL cuxd >/dev/null 2>&1 || true
$CUXDIR/update_addon cuxd
rm /usr/local/etc/config/addons/www/cuxd
rm -rf $CUXDIR
;;

*)
echo "Usage: $0 {start|stop|restart|uninstall}" >&2
exit 1
;;
esac

exit 0
53 changes: 53 additions & 0 deletions ccu1/update_script
@@ -0,0 +1,53 @@
#!/bin/sh

ADDON_DIR=/usr/local/addons/cuxd
RCD_DIR=/usr/local/etc/config/rc.d
CONFIG_DIR=/usr/local/etc/config
LCDTOOL=/bin/lcdtool
$LCDTOOL "installing CUxD "

if [ "`mount | grep mtdblock3 | wc -l`" -eq 0 ]; then
mount /dev/mtdblock3
fi

mkdir -p $ADDON_DIR
chmod 775 $ADDON_DIR
mkdir -p $RCD_DIR
chmod 755 $RCD_DIR

# remove old stuff
rm -f $ADDON_DIR/fw.tar.gz
rm -f $ADDON_DIR/*.ko
rm -f $ADDON_DIR/lib*.so*
rm -f $ADDON_DIR/*.ccc
rm -f $ADDON_DIR/hm_addons.cfg.*

# remove daemon
rm -f $ADDON_DIR/cuxd

# disable debugging
rm -f $ADDON_DIR/cuxd.dbg
# enable debugging after installation "LOGLEVEL LOGFILE"
#echo "10 /tmp/cuxddbglog.txt" >$ADDON_DIR/cuxd.dbg

# remove link to website
rm -f $CONFIG_DIR/addons/www/cuxd

# save current configuration
cp -af $ADDON_DIR/cuxd.ps $ADDON_DIR/cuxd.ps.old

# copy addon
cp -af cuxd/* $ADDON_DIR

# copy startup script
cp -af rc.d/* $RCD_DIR

# link to website
ln -sf $ADDON_DIR $CONFIG_DIR/addons/www/cuxd

# add menu
./update_addon cuxd cuxd_addon.cfg

sync

$LCDTOOL "completed CUxD "
Binary file modified ccu2/cuxd/cuxd
Binary file not shown.
4 changes: 3 additions & 1 deletion ccu2/cuxd/extra/ctl_startup
Expand Up @@ -91,7 +91,9 @@ if {($reboot == 1) && ($reboot_flag == 1)} {
exec mount -o remount,ro /
puts -nonewline "saving DOM..."
flush stdout
rega system.Save()
catch {
rega system.Save()
}
set result [exec /usr/bin/tail -1 /etc/config/homematic.regadom]
if {$result == "</dom>"} {
puts " OK!"
Expand Down
132 changes: 132 additions & 0 deletions ccu2/rc.d/cuxdaemon
@@ -0,0 +1,132 @@
#!/bin/sh
CUXDIR=/usr/local/addons/cuxd
CONFIG_URL=/addons/cuxd/index.ccc
CONFIG_DIR=/usr/local/etc/config
STARTRC=/etc/init.d/S55cuxd
STARTINIT=/etc/init.d/S55InitAddons
PSPID=`ps -o pid,comm | awk '{if($2=="cuxd"){print $1}}'`
export TZ=`cat /etc/config/TZ`
export LD_LIBRARY_PATH=$CUXDIR
export CURL_CA_BUNDLE=$CUXDIR/extra/cacert.pem

Start () {
echo -n "Starting CUxD: "
if [ ! -h $CONFIG_DIR/addons/www/cuxd ]
then
ln -sf $CUXDIR $CONFIG_DIR/addons/www/cuxd
fi
if [ -f $STARTINIT ]
then
if [ -h $STARTRC ]
then
mount -o remount,rw /
rm -f $STARTRC
mount -o remount,ro /
fi
else
if [ ! -h $STARTRC ]
then
mount -o remount,rw /
ln -sf $CONFIG_DIR/rc.d/cuxdaemon $STARTRC
mount -o remount,ro /
fi
fi
if [ "$PSPID" = "" ]
then
modprobe ehci_hcd 2>/dev/null
if [ -f /usr/local/addons/cuxd/cuxd.ini ]
then
grep -v "^HM-SCRIPTHOST=\|^HM-SCRIPTPORT=\|^HM-REGAPORT=" /usr/local/addons/cuxd/cuxd.ini >/tmp/cuxd.ini
diff -q /usr/local/addons/cuxd/cuxd.ini /tmp/cuxd.ini >/dev/null
if [ $? -ne 0 ]
then
mv /tmp/cuxd.ini /usr/local/addons/cuxd/cuxd.ini
fi
fi
chmod 0755 $CUXDIR/cuxd
$CUXDIR/cuxd >/dev/null 2>&1
logger -t homematic -p user.info "started cux-daemon"
fi
echo "OK"
}

Stop () {
echo -n "Stopping CUxD: "
if [ "$PSPID" != "" ]
then
kill $1 $PSPID 2>/dev/null
sleep 1
kill -0 $PSPID 2>/dev/null
if [ $? -eq 0 ]
then
sleep 10
kill -KILL $PSPID 2>/dev/null
fi
logger -t homematic -p user.info "stopped cux-daemon"
fi
echo "OK"
}

case "$1" in
""|init|start)
if [ -d $CUXDIR ]
then
Start
fi
;;

stop)
Stop -TERM
;;

restart)
Stop -HUP
if [ -d $CUXDIR ]
then
echo -n "Starting CUxD: "
chmod 0755 $CUXDIR/cuxd
$CUXDIR/cuxd >/dev/null 2>&1
logger -t homematic -p user.info "started (restart) cux-daemon"
echo "OK"
fi
;;

info)
if [ -d $CUXDIR ]
then
VER=`$CUXDIR/cuxd -v`
echo "Info: <center><b>CUx-Daemon $VER</b><br><img src="../addons/cuxd/CUXD.PNG"></center>"
echo "Name: CUx-Daemon"
echo "Version: $VER"
echo "Operations: uninstall restart"
echo "Config-Url: $CONFIG_URL"
echo "Update: http://cuxd.de/cuxd-ccu2.php"
fi
;;

uninstall)
logger -t homematic -p user.info "removing cux-daemon"
killall -KILL cuxd >/dev/null 2>&1 || true
if [ -d $CUXDIR ]
then
$CUXDIR/update_addon cuxd
$CUXDIR/extra/ctl_startup 1 0 rfd HMServer ReGaHss
rm $CONFIG_DIR/addons/www/cuxd
rm -rf $CUXDIR
fi
cp -f /etc/config_templates/InterfacesList.xml $CONFIG_DIR/InterfacesList.xml
if [ -h $STARTRC ]
then
mount -o remount,rw /
rm -f $STARTRC
mount -o remount,ro /
fi
;;

*)
echo "Usage: $0 {init|start|stop|restart|uninstall}" >&2
exit 1
;;
esac

exit 0
65 changes: 65 additions & 0 deletions ccu2/update_script
@@ -0,0 +1,65 @@
#!/bin/sh

ADDON_DIR=/usr/local/addons/cuxd
RCD_DIR=/usr/local/etc/config/rc.d
CONFIG_DIR=/usr/local/etc/config
STARTRC=/etc/init.d/S55cuxd
STARTINIT=/etc/init.d/S55InitAddons

if [ "$1" = "" ]
then
exit 1
fi

mount /usr/local

mkdir -p $ADDON_DIR
chmod 755 $ADDON_DIR
mkdir -p $RCD_DIR
chmod 755 $RCD_DIR

# remove daemon
rm -f $ADDON_DIR/cuxd

# disable debugging
rm -f $ADDON_DIR/cuxd.dbg
# enable debugging after installation "LOGLEVEL LOGFILE"
#echo "10 /tmp/cuxddbglog.txt" >$ADDON_DIR/cuxd.dbg

# remove link to website
rm -f $CONFIG_DIR/addons/www/cuxd

# save current configuration
cp -af $ADDON_DIR/cuxd.ps $ADDON_DIR/cuxd.ps.old

# copy addon
cp -af cuxd/* $ADDON_DIR

# copy startup script
cp -af rc.d/* $RCD_DIR

# link to website
ln -sf $ADDON_DIR $CONFIG_DIR/addons/www/cuxd

# add menu
./update_addon cuxd cuxd_addon.cfg

# create/check init.d symlink
if [ -d /oldroot ]
then
mount -t ubifs ubi0:root /oldroot
if [ -f /oldroot$STARTINIT ]
then
if [ -h /oldroot$STARTRC ]
then
rm -f /oldroot$STARTRC
fi
else
if [ ! -h /oldroot$STARTRC ]
then
ln -sf $RCD_DIR/cuxdaemon /oldroot$STARTRC
fi
fi
fi

sync
Binary file added ccu3/cuxd/cuxd
Binary file not shown.
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion ccurm/cuxd/extra/ctl_startup → ccu3/cuxd/extra/ctl_startup
Expand Up @@ -91,7 +91,9 @@ if {($reboot == 1) && ($reboot_flag == 1)} {
exec mount -o remount,ro /
puts -nonewline "saving DOM..."
flush stdout
rega system.Save()
catch {
rega system.Save()
}
set result [exec /usr/bin/tail -1 /etc/config/homematic.regadom]
if {$result == "</dom>"} {
puts " OK!"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -17,7 +17,6 @@ if { [info exists cmd ] && $cmd == "download"} {
puts -nonewline "Content-Type: text/html; charset=utf-8\r\n\r\n"
puts -nonewline "<html><head><meta http-equiv='refresh' content='0; url=$downloadURL' /></head><body></body></html>"
} else {
puts -nonewline "Content-Type: text/plain; charset=utf-8\r\n\r\n"
catch {
set newversion [ exec /usr/bin/wget -qO- --no-check-certificate $checkURL ]
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file removed ccurm/cuxd/cuxd
Binary file not shown.

0 comments on commit 8f7963a

Please sign in to comment.