moving to submodules

This commit is contained in:
Paolo Asperti 2021-09-14 16:52:40 +02:00
parent ae075ea741
commit 453b577123
Signed by: paspo
GPG Key ID: 06D46905D19D5182
39 changed files with 0 additions and 739 deletions

View File

@ -1,128 +0,0 @@
kind: pipeline
type: docker
name: docmaster
steps:
- name: build_and_publish_docmaster
image: plugins/docker:linux-amd64
settings:
dockerfile: docmaster/Dockerfile
context: docmaster
password:
from_secret: docker_password
registry: docker.asperti.com
repo: docker.asperti.com/paspo/hassio-docmaster
tags:
- latest
- 0.1.2
username:
from_secret: docker_username
trigger:
event:
- tag
- push
---
kind: pipeline
type: docker
name: ot-recorder
steps:
- name: build_and_publish_ot-recorder
image: plugins/docker:linux-amd64
settings:
dockerfile: ot-recorder/Dockerfile
context: ot-recorder
password:
from_secret: docker_password
registry: docker.asperti.com
repo: docker.asperti.com/paspo/hassio-ot-recorder
tags:
- latest
- 0.2.2
username:
from_secret: docker_username
trigger:
event:
- tag
- push
---
kind: pipeline
type: docker
name: upsmon
steps:
- name: build_and_publish_upsmon
image: plugins/docker:linux-amd64
settings:
dockerfile: upsmon/Dockerfile
context: upsmon
password:
from_secret: docker_password
registry: docker.asperti.com
repo: docker.asperti.com/paspo/hassio-upsmon
tags:
- latest
- 0.2.0
username:
from_secret: docker_username
trigger:
event:
- tag
- push
---
kind: pipeline
type: docker
name: zabbix-agent
steps:
- name: build_and_publish_zabbix-agent
image: plugins/docker:linux-amd64
settings:
dockerfile: zabbix-agent/Dockerfile
context: zabbix-agent
password:
from_secret: docker_password
registry: docker.asperti.com
repo: docker.asperti.com/paspo/hassio-zabbix-agent
tags:
- latest
- 0.1.4
username:
from_secret: docker_username
trigger:
event:
- tag
- push
---
kind: pipeline
type: docker
name: zabbix-agent2
steps:
- name: build_and_publish_zabbix-agent2
image: plugins/docker:linux-amd64
settings:
dockerfile: zabbix-agent2/Dockerfile
context: zabbix-agent2
password:
from_secret: docker_password
registry: docker.asperti.com
repo: docker.asperti.com/paspo/hassio-zabbix-agent2
tags:
- latest
- 0.1.2
username:
from_secret: docker_username
trigger:
event:
- tag
- push

View File

@ -1,14 +0,0 @@
ARG BUILD_FROM
FROM $BUILD_FROM
ENV LANG C.UTF-8
# Copy scripts for add-on
COPY run.sh /
COPY backup.sh /
RUN apk add -U jq bc curl && \
chmod a+x /run.sh && \
chmod a+x /backup.sh
CMD [ "/run.sh" ]

View File

@ -1,4 +0,0 @@
## Auto Backup
This plugins takes a backup of your hassio instance based on the timing you specify in config. Just use standard cron format (min hour day month weekday).
You can specify how many backups you want to mantain (should be >= 1). Note that backups are deleted after a new one is taken, so if something goes wrong, you end up with no recent backup and the oldest valid ones.

View File

@ -1,47 +0,0 @@
#!/bin/sh
echo
echo "Taking a new backup"
CONFIG_PATH=/data/options.json
NUM_BACKUPS=$(jq --raw-output ".num_backups" $CONFIG_PATH)
if [ $NUM_BACKUPS -lt 1 ] ; then
NUM_BACKUPS=1
fi
# retrieve current backup list
CURRENT_BACKUPS=$( curl -s -H "X-HASSIO-KEY: $HASSIO_TOKEN" http://hassio/backups )
STATUS=$(echo "$CURRENT_BACKUPS" | jq --raw-output '.result')
if [ ! "$STATUS" = "ok" ] ; then
echo "ERROR: Can't retrieve current backup list."
exit 1
fi
# take backup (this can take a long time)
START_TIMESTAMP=$(date "+%s")
RESULT=$( curl -s -H "X-HASSIO-KEY: $HASSIO_TOKEN" --data '{"name":"Automatic Backup"}' -X POST http://hassio/backups/new/full )
BACKUP_TIMESTAMP=$(date "+%s")
BACKUP_TIME=$(echo "$BACKUP_TIMESTAMP - $START_TIMESTAMP" | bc)
# check if backup is ok
STATUS=$(echo "$RESULT" | jq --raw-output '.result')
if [ ! "$STATUS" = "ok" ] ; then
echo "Backup FAILED after $BACKUP_TIME seconds."
exit 1
fi
SLUG=$(echo "$RESULT" | jq --raw-output '.data.slug')
echo "Backup $SLUG taken SUCCESSFULLY in $BACKUP_TIME seconds."
# housekeeping:
# we take the list of backups (which was taken before this backup)
# we sort by date (reversed), remove the protected backups and take
# only a list of slugs
# then we skip the first NUM_BACKUPS slugs and delete all the rest
FIRST_SLUG_TO_DELETE=$(echo "1 + $NUM_BACKUPS" | bc)
echo $CURRENT_BACKUPS | jq --raw-output ".data.backups | sort_by(.date) | reverse[] | select(.slug != \"$SLUG\") | select (.protected==false) | .slug " | tail -n +$FIRST_SLUG_TO_DELETE | while read SLUG_TO_DELETE
do
echo "Removing backup $SLUG_TO_DELETE"
curl -s -H "X-HASSIO-KEY: $HASSIO_TOKEN" -X POST http://hassio/backups/$SLUG_TO_DELETE/remove
done

View File

@ -1,26 +0,0 @@
{
"name": "Auto Backup",
"url": "https://git.asperti.com/paspo/hassio-addons",
"version": "0.2.0",
"slug": "auto-backup",
"description": "Take hassio backups with fixed timings and manage retention",
"startup": "application",
"boot": "auto",
"arch": [
"aarch64",
"amd64",
"armhf",
"i386"
],
"homeassistant": "2021.9",
"hassio_api": true,
"hassio_role": "backup",
"options": {
"cron": "15 3 * * *",
"num_backups": 10
},
"schema": {
"cron": "str",
"num_backups": "int"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

View File

@ -1,16 +0,0 @@
#!/bin/bash
set -e
CONFIG_PATH=/data/options.json
CRON=$(jq --raw-output ".cron" $CONFIG_PATH)
echo "$CRON /backup.sh >> /var/log/cron.log" > /var/spool/cron/crontabs/root
# change perms
chmod 600 /var/spool/cron/crontabs/root
echo "Auto backup ready."
crond
touch /var/log/cron.log
tail -f /var/log/cron.log

View File

@ -1,19 +0,0 @@
ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:9.2.2
FROM ${BUILD_FROM}
# --no-cache
RUN \
apk -U upgrade && \
apk add ghostscript py3-flask py3-gunicorn && \
apk add py3-unoconv --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ && \
apk add font-noto-all ttf-ubuntu-font-family ttf-freefont ttf-font-awesome ttf-opensans && \
apk add samba-client jq
COPY start.sh /app/
COPY app.py /app/
EXPOSE 6000
HEALTHCHECK CMD curl --fail http://localhost:6000/ || exit 1
ENTRYPOINT ["/app/start.sh"]

View File

@ -1,91 +0,0 @@
#!/usr/bin/env python3
from flask import Flask, jsonify, request, send_from_directory
import tempfile
import subprocess
import os
import sys
app = Flask(__name__)
@app.route('/')
def helloWorld():
return "Hi! Please check usage docs.\n"
@app.route('/status')
def getStatus():
PRINTER_HOST = os.environ.get("PRINTER_HOST")
return jsonify({"status": "OK", "printer_host": PRINTER_HOST})
def getFile(tmpDir):
if request.files.get('file', None):
f = request.files['file']
infile = tmpDir.name + '/' + f.name
f.save(infile)
elif request.form.get('smbfile'):
smbhost = request.form.get('smbhost', None)
smbuser = request.form.get('smbuser', None)
smbpass = request.form.get('smbpass', None)
smbworkgroup = request.form.get('smbworkgroup', None)
smbshare = request.form.get('smbshare', None)
smbdir = request.form.get('smbdir', None)
smbfile = request.form.get('smbfile', None)
v = [ smbhost, smbuser, smbpass, smbworkgroup, smbshare, smbdir, smbfile ]
if (all(v)):
os.chdir(tmpDir.name)
r = subprocess.run(['smbclient',
'--user', smbuser,
'--workgroup', smbworkgroup,
'--directory', smbdir,
'--command', 'get "%s"' % (smbfile),
'//%s/%s' % (smbhost, smbshare),
smbpass ] )
if r.returncode != 0:
return None
infile = tmpDir.name + '/' + smbfile
else:
return None
return infile
@app.route('/convert/pdf', methods=["POST"])
def toPDF():
tmpDir = tempfile.TemporaryDirectory()
infile = getFile(tmpDir)
pdffile = infile + '.pdf'
r = subprocess.run(['/usr/bin/unoconv', '--output', pdffile, infile])
if r.returncode != 0:
return jsonify({"status": "conversion error"})
return send_from_directory(directory=tmpDir.name,
filename=os.path.basename(pdffile),
mimetype='application/pdf',
as_attachment=True)
@app.route('/print', methods=["POST"])
def print():
PRINTER_HOST = os.environ.get("PRINTER_HOST")
if not PRINTER_HOST:
raise ValueError("You have to set the PRINTER_HOST environment variable")
tmpDir = tempfile.TemporaryDirectory()
infile = getFile(tmpDir)
unoconv = subprocess.Popen(['/usr/bin/unoconv','--stdout',infile], stdout=subprocess.PIPE)
pdf2ps = subprocess.Popen(['/usr/bin/pdf2ps','-','-'], stdin=unoconv.stdout, stdout=subprocess.PIPE)
unoconv.wait()
unoconv.stdout.close()
printer = subprocess.Popen(['/usr/bin/nc','-w','1', PRINTER_HOST,'9100'], stdin=pdf2ps.stdout)
pdf2ps.wait()
pdf2ps.stdout.close()
printer.wait()
return jsonify({"status": "ok"})
if __name__ == '__main__':
app.run(port=6000)

View File

@ -1,24 +0,0 @@
{
"name": "DocMaster",
"url": "https://git.asperti.com/paspo/hassio-addons",
"image": "docker.asperti.com/paspo/hassio-docmaster",
"version": "0.1.2",
"slug": "docmaster",
"description": "document conversion and print",
"startup": "services",
"boot": "auto",
"audio": false,
"gpio": false,
"arch": [
"amd64"
],
"ports": {
"6000/tcp": 6000
},
"options": {
"printer_host": "192.168.1.30"
},
"schema": {
"printer_host": "str"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

View File

@ -1,11 +0,0 @@
#!/bin/sh
set -e
CONFIG_PATH=/data/options.json
PRINTER_HOST=$(jq --raw-output ".printer_host" $CONFIG_PATH)
echo "PRINTER_HOST: $PRINTER_HOST"
cd /app
export PRINTER_HOST
gunicorn app:app --bind 0.0.0.0:6000 --workers=2

View File

@ -1,34 +0,0 @@
ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:10.0.2
FROM $BUILD_FROM AS builder
ENV LANG C.UTF-8
RUN apk add --no-cache \
abuild linux-headers musl-dev mosquitto-dev \
lmdb-dev curl-dev libconfig-dev gcc make libsodium-dev && \
wget -q https://github.com/owntracks/recorder/archive/0.8.7.tar.gz -O - | tar xvzC /tmp
COPY config.mk /tmp/recorder-0.8.7/
RUN cd /tmp/recorder-0.8.7/ && \
make
ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:10.0.2
FROM $BUILD_FROM
ENV LANG C.UTF-8
RUN apk -U --no-cache upgrade && \
apk --no-cache add jq && \
apk --no-cache add libcurl lmdb libconfig libsodium mosquitto-libs
EXPOSE 8083
COPY --from=builder /tmp/recorder-0.8.7/ocat /usr/sbin/
COPY --from=builder /tmp/recorder-0.8.7/ot-recorder /usr/sbin/
COPY --from=builder /tmp/recorder-0.8.7/docroot /var/spool/owntracks/recorder/htdocs
COPY run.sh /
RUN chmod a+x /run.sh
CMD [ "/run.sh" ]

View File

@ -1,3 +0,0 @@
## Owntracks Recorder
[Owntracks Recorder](https://github.com/owntracks/recorder) packaged for hass.io.

View File

@ -1,38 +0,0 @@
{
"name": "Owntracks Recorder",
"url": "https://git.asperti.com/paspo/hassio-addons",
"image": "docker.asperti.com/paspo/hassio-ot-recorder",
"version": "0.2.2",
"slug": "ot-recorder",
"description": "Owntracks Recorder - connects to your mqtt broker and consumes owntracks locations",
"startup": "services",
"boot": "auto",
"ports": {
"8083": 8083
},
"arch": [
"aarch64",
"amd64",
"armhf",
"i386"
],
"webui": "http://[HOST]:[PORT:8083]/",
"map": ["share:rw"],
"options": {
"topics": "owntracks/#",
"host": "IPADDRESS_OR_HOSTNAME",
"port": 1883,
"user": "DVES_USER",
"pass": "DVES_PASS",
"qos": 2
},
"schema": {
"topics": "str",
"host": "str",
"port": "port",
"user": "str",
"pass": "str",
"qos": "int"
}
}

View File

@ -1,23 +0,0 @@
FREEBSD ?= no
INSTALLDIR = /usr
WITH_MQTT ?= yes
WITH_HTTP ?= yes
WITH_LUA ?= no
WITH_PING ?= yes
WITH_KILL ?= no
WITH_ENCRYPT ?= yes
WITH_GREENWICH ?= no
STORAGEDEFAULT = /share/ot-recorder/
DOCROOT = /var/spool/owntracks/recorder/htdocs
GHASHPREC = 7
JSON_INDENT ?= no
CONFIGFILE = /etc/ot-recorder.cfg
MOSQUITTO_INC = -I/usr/include
MOSQUITTO_LIB = -L/usr/lib
MORELIBS += # -lssl
LUA_CFLAGS = `pkg-config --cflags lua`
LUA_LIBS = `pkg-config --libs lua`
SODIUM_CFLAGS = `pkg-config --cflags libsodium`
SODIUM_LIBS = `pkg-config --libs libsodium`
GEOCODE_TIMEOUT = 4000

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

View File

@ -1,32 +0,0 @@
#!/bin/sh
set -e
CONFIG_PATH=/data/options.json
TOPICS=$(jq --raw-output ".topics" $CONFIG_PATH)
HOST=$(jq --raw-output ".host" $CONFIG_PATH)
PORT=$(jq --raw-output ".port" $CONFIG_PATH)
USER=$(jq --raw-output ".user" $CONFIG_PATH)
PASS=$(jq --raw-output ".pass" $CONFIG_PATH)
QOS=$(jq --raw-output ".qos" $CONFIG_PATH)
echo "
OTR_STORAGEDIR = \"/share/ot-recorder\"
OTR_TOPICS = \"$TOPICS\"
OTR_HOST = \"$HOST\"
OTR_PORT = $PORT
OTR_USER = \"$USER\"
OTR_PASS = \"$PASS\"
OTR_QOS = $QOS
" > /etc/ot-recorder.cfg
if [ ! -d /share/ot-recorder ] ; then
mkdir /share/ot-recorder
fi
if [ ! -f /share/ot-recorder/ghash/data.mdb ] ; then
/usr/sbin/ot-recorder --initialize
fi
/usr/sbin/ot-recorder --http-host 0.0.0.0

View File

@ -1,17 +0,0 @@
ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:10.0.2
FROM $BUILD_FROM
ENV LANG C.UTF-8
COPY run.sh shutdown.sh /
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories && \
echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \
echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
apk add -U jq nut curl util-linux && \
mkdir /var/run/nut && \
chown root:nut /var/run/nut && \
chmod 770 /var/run/nut && \
chmod a+x /run.sh /shutdown.sh
CMD [ "/run.sh" ]

View File

@ -1,4 +0,0 @@
## Network UPS Tools - netclient
[Network UPS Tools](http://networkupstools.org/) is used to connect to another machine running the same software.
You just need to specify some connection parameters. You can also configure the shutdown delay (in minutes).

View File

@ -1,40 +0,0 @@
{
"name": "Network UPS Tools - netclient",
"url": "https://git.asperti.com/paspo/hassio-addons",
"image": "docker.asperti.com/paspo/hassio-upsmon",
"version": "0.2.0",
"slug": "upsmon",
"description": "Connect to a remote NUT server",
"startup": "services",
"boot": "auto",
"arch": [
"aarch64",
"amd64",
"armhf",
"i386"
],
"hassio_api": true,
"hassio_role": "admin",
"options": {
"credentials": {
"user": "monuser",
"pass": "secret"
},
"ups": {
"upsname": "ups",
"host": "IPADDR"
},
"delay": 5
},
"schema": {
"credentials": {
"user": "str",
"pass": "str"
},
"ups": {
"upsname": "str",
"host": "str"
},
"delay": "int"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

View File

@ -1,3 +0,0 @@
http://dl-cdn.alpinelinux.org/alpine/edge/main
http://dl-cdn.alpinelinux.org/alpine/edge/community
http://dl-cdn.alpinelinux.org/alpine/edge/testing

View File

@ -1,30 +0,0 @@
#!/bin/bash
set -e
CONFIG_PATH=/data/options.json
UPSNAME=$(jq --raw-output ".ups.upsname" $CONFIG_PATH)
HOST=$(jq --raw-output ".ups.host" $CONFIG_PATH)
USER=$(jq --raw-output ".credentials.user" $CONFIG_PATH)
PASS=$(jq --raw-output ".credentials.pass" $CONFIG_PATH)
DELAY=$(jq --raw-output ".delay" $CONFIG_PATH)
echo "
MONITOR ${UPSNAME}@${HOST} 1 ${USER} ${PASS} slave
MINSUPPLIES 1
SHUTDOWNCMD \"/shutdown.sh\"
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG /etc/killpower
RBWARNTIME 43200
NOCOMMWARNTIME 300
" > /etc/nut/upsmon.conf
echo "MODE=netclient" > /etc/nut/nut.conf
# change perms on config files
chmod 660 /etc/nut/*
upsmon -D

View File

@ -1,3 +0,0 @@
#!/bin/sh
curl -H "X-HASSIO-KEY: $HASSIO_TOKEN" -X POST http://hassio/host/shutdown

View File

@ -1,12 +0,0 @@
ARG BUILD_FROM=hassioaddons/base:8.0.6
FROM $BUILD_FROM
ENV LANG C.UTF-8
# Copy scripts for add-on
COPY run.sh /
RUN apk add -U jq zabbix-agent sudo && \
chmod a+x /run.sh
CMD [ "/run.sh" ]

View File

@ -1,32 +0,0 @@
{
"name": "Zabbix Agent",
"url": "https://git.asperti.com/paspo/hassio-addons",
"image": "docker.asperti.com/paspo/hassio-zabbix-agent",
"version": "0.1.4",
"slug": "zabbix-agent",
"description": "Zabbix Agent for hass.io",
"startup": "services",
"boot": "auto",
"audio": false,
"gpio": false,
"arch": [
"aarch64",
"amd64",
"armhf",
"i386"
],
"ports": {
"10050/tcp": 10050
},
"map": [
"share"
],
"options": {
"server": "zabbix-server",
"hostname": "hassio"
},
"schema": {
"server": "str",
"hostname": "str"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 632 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -1,22 +0,0 @@
#!/bin/bash
set -e
CONFIG_PATH=/data/options.json
CUSTOM_CFG_PATH=/share/zabbix-agent
SERVER=$(jq --raw-output ".server" $CONFIG_PATH)
HOSTNAME=$(jq --raw-output ".hostname" $CONFIG_PATH)
if [ ! -d "$CUSTOM_CFG_PATH" ] ; then
mkdir -p "$CUSTOM_CFG_PATH"
fi
echo "
Server=$SERVER
ServerActive=$SERVER
Hostname=$HOSTNAME
LogType=console
Include=${CUSTOM_CFG_PATH}/*.conf
" > /etc/zabbix/zabbix_agentd.conf
sudo -u zabbix zabbix_agentd -f

View File

@ -1,12 +0,0 @@
ARG BUILD_FROM=hassioaddons/base:8.0.6
FROM $BUILD_FROM
ENV LANG C.UTF-8
# Copy scripts for add-on
COPY run.sh /
RUN apk add -U jq zabbix-agent2=5.0.14-r1 sudo && \
chmod a+x /run.sh
CMD [ "/run.sh" ]

View File

@ -1,32 +0,0 @@
{
"name": "Zabbix Agent 2",
"url": "https://git.asperti.com/paspo/hassio-addons",
"image": "docker.asperti.com/paspo/hassio-zabbix-agent2",
"version": "0.1.2",
"slug": "zabbix-agent2",
"description": "Zabbix Agent 2 for hass.io",
"startup": "services",
"boot": "auto",
"audio": false,
"gpio": false,
"arch": [
"aarch64",
"amd64",
"armhf",
"i386"
],
"ports": {
"10050/tcp": 10050
},
"map": [
"share"
],
"options": {
"server": "zabbix-server",
"hostname": "hassio"
},
"schema": {
"server": "str",
"hostname": "str"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 632 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -1,22 +0,0 @@
#!/bin/bash
set -e
CONFIG_PATH=/data/options.json
CUSTOM_CFG_PATH=/share/zabbix-agent2
SERVER=$(jq --raw-output ".server" $CONFIG_PATH)
HOSTNAME=$(jq --raw-output ".hostname" $CONFIG_PATH)
if [ ! -d "$CUSTOM_CFG_PATH" ] ; then
mkdir -p "$CUSTOM_CFG_PATH"
fi
echo "
Server=$SERVER
ServerActive=$SERVER
Hostname=$HOSTNAME
LogType=console
Include=${CUSTOM_CFG_PATH}/*.conf
" > /etc/zabbix/zabbix_agent2.conf
sudo -u zabbix zabbix_agent2 -f