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
Showing
26 changed files
with
350 additions
and
5 deletions.
There are no files selected for viewing
Binary file not shown.
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,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 |
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,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 not shown.
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,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 |
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,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 not shown.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Oops, something went wrong.