Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbyquaker committed Jul 29, 2018
0 parents commit d79e829
Show file tree
Hide file tree
Showing 15 changed files with 1,227 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
addon_tmp
dist
.idea
.DS_Store
live
CHANGELOG.md
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# ccu-addon-redis

[![Current Release](https://img.shields.io/github/release/hobbyquaker/ccu-addon-redis.svg?colorB=4cc61e)](https://github.com/hobbyquaker/ccu-addon-redis/releases/latest)
[![Github Releases](https://img.shields.io/github/downloads/hobbyquaker/ccu-addon-redis/total.svg)](https://github.com/hobbyquaker/ccu-addon-redis/releases)

[redis](https://redis.io/) als Addon für die
[Homematic CCU3](https://www.eq-3.de/produkte/homematic/zentralen-und-gateways/smart-home-zentrale-ccu3.html) und
[RaspberryMatic](https://github.com/jens-maus/RaspberryMatic)

Unter [Releases](https://github.com/hobbyquaker/ccu-addon-redis/releases) steht die Datei
`redis-<version>.tar.gz` zum Download zur Verfügung, diese kann über das CCU WebUI als Zusatzsoftware installiert
werden.

Eigene Konfigurationen können in `/usr/local/addons/redis/etc/local.conf` vorgenommen werden, der Inhalt dieser Datei
wird bei Updates nicht überschrieben.
Binary file added addon_files/redis/bin/redis-benchmark
Binary file not shown.
Binary file added addon_files/redis/bin/redis-check-aof
Binary file not shown.
Binary file added addon_files/redis/bin/redis-check-rdb
Binary file not shown.
Binary file added addon_files/redis/bin/redis-cli
Binary file not shown.
Binary file added addon_files/redis/bin/redis-sentinel
Binary file not shown.
Binary file added addon_files/redis/bin/redis-server
Binary file not shown.
1,054 changes: 1,054 additions & 0 deletions addon_files/redis/etc/redis.conf

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions addon_files/redis/rc.d/redis
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/sh

CONF_DIR=/usr/local/etc/config
ADDON_DIR=/usr/local/addons/redis

BIN_DIR=/usr/local/bin
CONF_DIR=/usr/local/etc/config

Stop () {
echo -n "Stopping redis: "
killall redis-server && echo "OK"
}

Start () {
echo -n "Starting redis: "
$ADDON_DIR/bin/redis-server $ADDON_DIR/etc/redis.conf && echo "OK"
}

case "$1" in

stop)
Stop
;;

start)
Start
;;

restart)
Stop
sleep 3
Start
;;

info)
echo "Info: <center><a href=\"https://redis.io/\" target=\"_blank\"><img width=\"240\" src="/addons/redis/redis.png"></a></center>"
echo "Name: redis"
echo "Version: 3.2.11+0"
echo "Update: /addons/redis/update_check.cgi"
echo "Operations: uninstall"
;;

uninstall)
/usr/bin/killall redis-server
rm $CONF_DIR/rc.d/redis
rm $BIN_DIR/redis*
rm $CONF_DIR/addons/www/redis
rm -r $ADDON_DIR
;;

*)
echo "Usage: redis {start|stop|restart|info|uninstall}" >&2
exit 1
;;

esac
Empty file.
Binary file added addon_files/redis/www/redis.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions addon_files/redis/www/update_check.cgi
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env tclsh

set checkURL "https://api.github.com/repos/hobbyquaker/ccu-addon-redis/releases/latest"
set downloadURL "https://github.com/hobbyquaker/ccu-addon-redis/releases/latest"

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 "<html><head><meta http-equiv='refresh' content='0; url=$downloadURL' /></head></html>"
} else {
catch {
[regexp "tag_name\": \"v?(\[0-9\]+\.\[0-9\]+\.\[0-9\]+.\[0-9\]+)" [ exec /usr/bin/env wget -qO- --no-check-certificate $checkURL ] dummy newversion]
}
if { [info exists newversion] } {
puts -nonewline $newversion
} else {
puts -nonewline "n/a"
}
}
36 changes: 36 additions & 0 deletions addon_files/update_script
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh

ADDONS_DIR=/usr/local/addons
REDIS_DIR=$ADDONS_DIR/redis


BIN_DIR=/usr/local/bin
LIB_DIR=/usr/local/lib
CONF_DIR=/usr/local/etc/config

mount | grep /usr/local 2>&1 >/dev/null
if [ $? -eq 1 ]; then
mount /usr/local
fi

mkdir -p $ADDONS_DIR && chmod 755 $ADDONS_DIR
mkdir -p $BIN_DIR && chmod 755 $BIN_DIR
mkdir -p $LIB_DIR && chmod 755 $LIB_DIR

if [ -f $CONF_DIR/rc.d/redis ]; then
$CONF_DIR/rc.d/redis stop
fi

cp -af redis $ADDONS_DIR/

if [ ! -f $REDIS_DIR/etc/local.conf ]; then
touch $REDIS_DIR/etc/local.conf
fi

ln -sf $REDIS_DIR/bin/* /usr/local/bin/
ln -sf $REDIS_DIR/rc.d/redis $CONF_DIR/rc.d/redis
ln -sf $REDIS_DIR/www $CONF_DIR/addons/www/redis

sync

exit 0
33 changes: 33 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

BUILD_DIR=`cd ${0%/*} && pwd -P`

ADDON_FILES=$BUILD_DIR/addon_files
ADDON_TMP=$BUILD_DIR/addon_tmp

mkdir $ADDON_TMP 2> /dev/null || rm -r $ADDON_TMP/*

echo "copying files to tmp dir..."
cp -r $ADDON_FILES/* $ADDON_TMP/

cd $BUILD_DIR


ADDON_FILE=redis-3.2.11+0.tar.gz
echo "compressing addon package $ADDON_FILE ..."

mkdir $BUILD_DIR/dist 2> /dev/null
cd $ADDON_TMP
cd $ADDON_TMP
if [[ "$OSTYPE" == "darwin"* ]]; then
if [[ -f /usr/local/bin/gtar ]]; then
gtar --exclude=.DS_Store --owner=root --group=root -czf $BUILD_DIR/dist/$ADDON_FILE *
else
tar --exclude=.DS_Store -czf $BUILD_DIR/dist/$ADDON_FILE *
fi
else
tar --owner=root --group=root -czf $BUILD_DIR/dist/$ADDON_FILE *
fi
cd $BUILD_DIR

echo "done."

0 comments on commit d79e829

Please sign in to comment.