mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-11 02:11:01 +01:00
initial build
This commit is contained in:
1
grav/CHANGELOG.md
Normal file
1
grav/CHANGELOG.md
Normal file
@@ -0,0 +1 @@
|
||||
- Initial release (nightly builds)
|
||||
67
grav/Dockerfile
Normal file
67
grav/Dockerfile
Normal file
@@ -0,0 +1,67 @@
|
||||
ARG BUILD_FROM
|
||||
ARG BUILD_VERSION
|
||||
FROM ${BUILD_FROM}
|
||||
ARG BASHIO_VERSION=0.13.1
|
||||
|
||||
RUN \
|
||||
################
|
||||
# Install apps #
|
||||
################
|
||||
apt-get clean \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y \
|
||||
jq \
|
||||
curl \
|
||||
cifs-utils \
|
||||
keyutils \
|
||||
samba \
|
||||
\
|
||||
###################
|
||||
# Install bashio #
|
||||
##################
|
||||
&& mkdir -p /tmp/bashio \
|
||||
&& curl -L -f -s "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" \
|
||||
| tar -xzf - --strip 1 -C /tmp/bashio \
|
||||
&& mv /tmp/bashio/lib /usr/lib/bashio \
|
||||
&& ln -s /usr/lib/bashio/bashio /usr/bin/bashio \
|
||||
&& rm -rf /tmp/bashio \
|
||||
\
|
||||
# use /data instead of /config for hass.io environment
|
||||
&& sed -i "s|/config|/share/grav|g" /etc/services.d/grav/run \
|
||||
&& sed -i "s|/config|/share/grav|g" /etc/cont-init.d/50-config \
|
||||
&& sed -i "s|/share/grav/nginx|/config/nginx|g" /etc/cont-init.d/50-config \
|
||||
\
|
||||
# Allow UID and GID setting
|
||||
&& sed -i 's/bash/bashio/g' /etc/cont-init.d/10-adduser \
|
||||
&& sed -i 's/{PUID:-911}/(bashio::config "PUID")/g' /etc/cont-init.d/10-adduser \
|
||||
&& sed -i 's/{PGID:-911}/(bashio::config "PGID")/g' /etc/cont-init.d/10-adduser
|
||||
|
||||
# copy local files
|
||||
COPY root/ /
|
||||
|
||||
### LABELS
|
||||
ARG BUILD_ARCH
|
||||
ARG BUILD_DATE
|
||||
ARG BUILD_DESCRIPTION
|
||||
ARG BUILD_NAME
|
||||
ARG BUILD_REF
|
||||
ARG BUILD_REPOSITORY
|
||||
ARG BUILD_VERSION
|
||||
LABEL \
|
||||
io.hass.name="${BUILD_NAME}" \
|
||||
io.hass.description="${BUILD_DESCRIPTION}" \
|
||||
io.hass.arch="${BUILD_ARCH}" \
|
||||
io.hass.type="addon" \
|
||||
io.hass.version=${BUILD_VERSION} \
|
||||
maintainer="alexbelgium (https://github.com/alexbelgium)" \
|
||||
org.opencontainers.image.title="${BUILD_NAME}" \
|
||||
org.opencontainers.image.description="${BUILD_DESCRIPTION}" \
|
||||
org.opencontainers.image.vendor="Home Assistant Add-ons" \
|
||||
org.opencontainers.image.authors="alexbelgium (https://github.com/alexbelgium)" \
|
||||
org.opencontainers.image.licenses="MIT" \
|
||||
org.opencontainers.image.url="https://github.com/alexbelgium" \
|
||||
org.opencontainers.image.source="https://github.com/${BUILD_REPOSITORY}" \
|
||||
org.opencontainers.image.documentation="https://github.com/${BUILD_REPOSITORY}/blob/main/README.md" \
|
||||
org.opencontainers.image.created=${BUILD_DATE} \
|
||||
org.opencontainers.image.revision=${BUILD_REF} \
|
||||
org.opencontainers.image.version=${BUILD_VERSION}
|
||||
61
grav/Readme.md
Normal file
61
grav/Readme.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# Home assistant add-on: grav
|
||||
|
||||
![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armhf Architecture][armhf-shield] ![Supports armv7 Architecture][armv7-shield]
|
||||
![Supports smb mounts][smb-shield]
|
||||
|
||||
# About
|
||||
|
||||
---
|
||||
|
||||
[grav](https://github.com/grav/grav) is a ebook collection manager for Usenet and BitTorrent users. It can monitor multiple RSS feeds for new books from your favorite authors and will interface with clients and indexers to grab, sort, and rename them.is book Manager and Automation (Sonarr for Ebooks).
|
||||
This addon is based on the docker image https://github.com/linuxserver/docker-grav
|
||||
|
||||
# Installation
|
||||
|
||||
---
|
||||
|
||||
The installation of this add-on is pretty straightforward and not different in comparison to installing any other add-on.
|
||||
|
||||
1. Add my add-ons repository to your home assistant instance (in supervisor addons store at top right, or click button below if you have configured my HA)
|
||||
[](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Falexbelgium%2Fhassio-addons)
|
||||
1. Install this add-on.
|
||||
1. Click the `Save` button to store your configuration.
|
||||
1. Set the add-on options to your preferences
|
||||
1. Start the add-on.
|
||||
1. Check the logs of the add-on to see if everything went well.
|
||||
1. Open the webUI and adapt the software options
|
||||
|
||||
# Configuration
|
||||
|
||||
---
|
||||
|
||||
Webui can be found at <http://your-ip:PORT>.
|
||||
The default username/password : described in the startup log.
|
||||
Configurations can be done through the app webUI, except for the following options
|
||||
|
||||
```yaml
|
||||
GUID: user
|
||||
GPID: user
|
||||
TZ: timezone
|
||||
localdisks: "sda1" # Optional
|
||||
networkdisks: "//SERVER/SHARE" # optional, list of smb servers to mount, separated by commas
|
||||
cifsusername: "username" # optional, smb username, same for all smb shares
|
||||
cifspassword: "password" # optional, smb password
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
Create an issue on github
|
||||
|
||||
# Illustration
|
||||
|
||||
---
|
||||
|
||||

|
||||
|
||||
[repository]: https://github.com/alexbelgium/hassio-addons
|
||||
[smb-shield]: https://img.shields.io/badge/smb-yes-green.svg
|
||||
[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg
|
||||
[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg
|
||||
[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg
|
||||
[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg
|
||||
48
grav/apparmor.txt
Normal file
48
grav/apparmor.txt
Normal file
@@ -0,0 +1,48 @@
|
||||
#include <tunables/global>
|
||||
|
||||
profile grav_addon flags=(attach_disconnected,mediate_deleted) {
|
||||
#include <abstractions/base>
|
||||
|
||||
capability,
|
||||
file,
|
||||
mount,
|
||||
umount,
|
||||
remount,
|
||||
|
||||
capability setgid,
|
||||
capability setuid,
|
||||
capability sys_admin,
|
||||
capability dac_read_search,
|
||||
# capability dac_override,
|
||||
# capability sys_rawio,
|
||||
|
||||
# S6-Overlay
|
||||
/bin/** ix,
|
||||
/usr/bin/** ix,
|
||||
/usr/lib/bashio/** ix,
|
||||
/etc/s6/** rix,
|
||||
/run/s6/** rix,
|
||||
/etc/services.d/** rwix,
|
||||
/etc/cont-init.d/** rwix,
|
||||
/etc/cont-finish.d/** rwix,
|
||||
/init rix,
|
||||
/var/run/** mrwkl,
|
||||
/var/run/ mrwkl,
|
||||
/dev/i2c-1 mrwkl,
|
||||
# Files required
|
||||
/dev/sda1 mrwkl,
|
||||
/dev/sdb1 mrwkl,
|
||||
/dev/mmcblk0p1 mrwkl,
|
||||
/dev/* mrwkl,
|
||||
/tmp/** mrkwl,
|
||||
|
||||
# Data access
|
||||
/data/** rw,
|
||||
|
||||
# suppress ptrace denials when using 'docker ps' or using 'ps' inside a container
|
||||
ptrace (trace,read) peer=docker-default,
|
||||
|
||||
# docker daemon confinement requires explict allow rule for signal
|
||||
signal (receive) set=(kill,term) peer=/usr/bin/docker,
|
||||
|
||||
}
|
||||
8
grav/build.json
Normal file
8
grav/build.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"build_from": {
|
||||
"armhf": "linuxserver/grav:arm32v7-nightly",
|
||||
"armv7": "linuxserver/grav:arm32v7-nightly",
|
||||
"aarch64": "linuxserver/grav:arm64v8-nightly",
|
||||
"amd64": "linuxserver/grav:amd64-nightly"
|
||||
}
|
||||
}
|
||||
51
grav/config.json
Normal file
51
grav/config.json
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"arch": ["aarch64", "amd64", "armv7", "armhf"],
|
||||
"boot": "auto",
|
||||
"description": "Fast, Simple, and Flexible, file-based Web-platform",
|
||||
"devices": [
|
||||
"/dev/sda1",
|
||||
"/dev/sdb1",
|
||||
"/dev/sdc1",
|
||||
"/dev/sdd1",
|
||||
"/dev/sde1",
|
||||
"/dev/sdf1",
|
||||
"/dev/sdg1",
|
||||
"/dev/sda2",
|
||||
"/dev/sdb2",
|
||||
"/dev/sdc2",
|
||||
"/dev/sdd2",
|
||||
"/dev/sde2",
|
||||
"/dev/sdf2",
|
||||
"/dev/sdg2"
|
||||
],
|
||||
"environment": {
|
||||
"PUID": "0",
|
||||
"PGID": "0"
|
||||
},
|
||||
"map": ["share:rw", "media:rw", "config:rw"],
|
||||
"name": "grav NAS",
|
||||
"options": {
|
||||
"networkdisks": "<//SERVER/SHARE>,<//SERVER2/SHARE2>",
|
||||
"cifsusername": "<username>",
|
||||
"cifspassword": "<password>"
|
||||
},
|
||||
"ports": {
|
||||
"80/tcp": 9191
|
||||
},
|
||||
"ports_description": {
|
||||
"80/tcp": "web interface"
|
||||
},
|
||||
"privileged": ["SYS_ADMIN", "DAC_READ_SEARCH"],
|
||||
"schema": {
|
||||
"TZ": "str?",
|
||||
"localdisks": "str?",
|
||||
"networkdisks": "str?",
|
||||
"cifsusername": "str?",
|
||||
"cifspassword": "str?"
|
||||
},
|
||||
"slug": "grav_nas",
|
||||
"upstream": "nightly-0.1.0.991-ls16",
|
||||
"url": "https://github.com/alexbelgium/hassio-addons",
|
||||
"version": "nightly-0.1.0.991-ls16",
|
||||
"webui": "http://[HOST]:[PORT:8787]"
|
||||
}
|
||||
BIN
grav/icon.png
Normal file
BIN
grav/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
BIN
grav/logo.png
Normal file
BIN
grav/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
39
grav/root/etc/cont-init.d/00-banner.sh
Normal file
39
grav/root/etc/cont-init.d/00-banner.sh
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: Base Images
|
||||
# Displays a simple add-on banner on startup
|
||||
# ==============================================================================
|
||||
if bashio::supervisor.ping; then
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
bashio::log.blue " Add-on: $(bashio::addon.name)"
|
||||
bashio::log.blue " $(bashio::addon.description)"
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
|
||||
bashio::log.blue " Add-on version: $(bashio::addon.version)"
|
||||
if bashio::var.true "$(bashio::addon.update_available)"; then
|
||||
bashio::log.magenta ' There is an update available for this add-on!'
|
||||
bashio::log.magenta \
|
||||
" Latest add-on version: $(bashio::addon.version_latest)"
|
||||
bashio::log.magenta ' Please consider upgrading as soon as possible.'
|
||||
else
|
||||
bashio::log.green ' You are running the latest version of this add-on.'
|
||||
fi
|
||||
|
||||
bashio::log.blue " System: $(bashio::info.operating_system)" \
|
||||
" ($(bashio::info.arch) / $(bashio::info.machine))"
|
||||
bashio::log.blue " Home Assistant Core: $(bashio::info.homeassistant)"
|
||||
bashio::log.blue " Home Assistant Supervisor: $(bashio::info.supervisor)"
|
||||
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
bashio::log.blue \
|
||||
' Please, share the above information when looking for help'
|
||||
bashio::log.blue \
|
||||
' or support in, e.g., GitHub, forums or the Discord chat.'
|
||||
bashio::log.green \
|
||||
' https://github.com/alexbelgium/hassio-addons'
|
||||
bashio::log.blue \
|
||||
'-----------------------------------------------------------'
|
||||
fi
|
||||
5
grav/root/etc/cont-init.d/00-ha-env
Normal file
5
grav/root/etc/cont-init.d/00-ha-env
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
for k in $(bashio::jq "${__BASHIO_ADDON_CONFIG}" 'keys | .[]'); do
|
||||
printf "$(bashio::config $k)" > /var/run/s6/container_environment/$k
|
||||
done
|
||||
7
grav/root/etc/cont-init.d/20-folders
Normal file
7
grav/root/etc/cont-init.d/20-folders
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
if [ ! -d /share/grav ]; then
|
||||
echo "Creating /share/grav"
|
||||
mkdir -p /share/grav
|
||||
chown -R abc:abc /share/grav
|
||||
fi
|
||||
26
grav/root/etc/cont-init.d/92-local_mounts_v1.1.sh
Normal file
26
grav/root/etc/cont-init.d/92-local_mounts_v1.1.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
######################
|
||||
# MOUNT LOCAL SHARES #
|
||||
######################
|
||||
|
||||
bashio::log.info 'Mounting external hdd...'
|
||||
|
||||
# Mount local Share if configured and if Protection Mode is active
|
||||
if bashio::config.has_value 'localdisks'; then
|
||||
MOREDISKS=$(bashio::config 'localdisks')
|
||||
bashio::log.info "Local Disks mounting.. ${MOREDISKS}" && \
|
||||
for disk in ${MOREDISKS//,/ } # Separate comma separated values
|
||||
do
|
||||
bashio::log.info "Mount ${disk}"
|
||||
mkdir -p /share/$disk && \
|
||||
if [ ! -d /share/$disk ]; then
|
||||
echo "Creating /share/$disk"
|
||||
mkdir -p /share/$disk
|
||||
chown -R abc:abc /share/$disk
|
||||
fi
|
||||
mount /dev/$disk /share/$disk && \
|
||||
bashio::log.info "Success!"
|
||||
done || \
|
||||
bashio::log.warning "Protection mode is ON. Unable to mount local drives!"
|
||||
fi
|
||||
72
grav/root/etc/cont-init.d/92-smb_mounts_v1.4.sh
Normal file
72
grav/root/etc/cont-init.d/92-smb_mounts_v1.4.sh
Normal file
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
####################
|
||||
# MOUNT SMB SHARES #
|
||||
####################
|
||||
if bashio::config.has_value 'networkdisks'; then
|
||||
|
||||
# Define variables
|
||||
MOREDISKS=$(bashio::config 'networkdisks')
|
||||
CIFS_USERNAME=$(bashio::config 'cifsusername')
|
||||
CIFS_PASSWORD=$(bashio::config 'cifspassword')
|
||||
MOUNTED=false
|
||||
SMBVERS=""
|
||||
SECVERS=""
|
||||
|
||||
# Dont execute if still default
|
||||
[ ${MOREDISKS::1} == "<" ] && exit 0
|
||||
|
||||
# Mount CIFS Share if configured and if Protection Mode is active
|
||||
bashio::log.info 'Mounting smb share(s)...'
|
||||
|
||||
if bashio::config.has_value 'cifsdomain'; then
|
||||
DOMAIN=",domain=$(bashio::config 'cifsdomain')"
|
||||
else
|
||||
DOMAIN=""
|
||||
fi
|
||||
|
||||
# Mounting disks
|
||||
for disk in ${MOREDISKS//,/ } # Separate comma separated values
|
||||
do
|
||||
# Clean name of network share
|
||||
disk=$(echo $disk | sed "s,/$,,") # Remove / at end of name
|
||||
diskname=${disk//\\//} #replace \ with /
|
||||
diskname=${diskname##*/} # Get only last part of the name
|
||||
# Prepare mount point
|
||||
mkdir -p /mnt/$diskname
|
||||
chown -R root:root /mnt/$diskname
|
||||
|
||||
#Tries to mount with default options
|
||||
mount -t cifs -o rw,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$DOMAIN $disk /mnt/$diskname 2>ERRORCODE && MOUNTED=true || MOUNTED=false
|
||||
|
||||
# if Fail test different smb and sec versions
|
||||
if [ $MOUNTED = false ]; then
|
||||
for SMBVERS in ",vers=3" ",vers=1.0" ",vers=2.1" ",vers=3.0" ",nodfs" ",uid=0,gid=0,forceuid,forcegid" ",noforceuid,noforcegid" ",${DOMAIN}"
|
||||
do
|
||||
mount -t cifs -o rw,file_mode=0777,dir_mode=0777,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$SMBVERS $disk /mnt/$diskname 2>/dev/null && MOUNTED=true && break || MOUNTED=false
|
||||
for SECVERS in ",sec=ntlmi" ",sec=ntlmv2" ",sec=ntlmv2i" ",sec=ntlmssp" ",sec=ntlmsspi" ",sec=ntlm" ",sec=krb5i" ",sec=krb5" ",iocharset=utf8"
|
||||
do
|
||||
mount -t cifs -o rw,file_mode=0777,dir_mode=0777,username=$CIFS_USERNAME,password=${CIFS_PASSWORD}$SMBVERS$SECVERS $disk /mnt/$disk name 2>/dev/null && MOUNTED=true && break 2 && break || MOUNTED=false
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
# Test smbclient if not mounted yet
|
||||
if [ $MOUNTED = false ]; then
|
||||
smbclient -L $disk -U $CIFS_USERNAME%$CIFS_PASSWORD --option="client min protocol"="NT1" && \
|
||||
bashio::log.info "Mounted with smbclient"
|
||||
fi
|
||||
|
||||
# Messages
|
||||
if [ $MOUNTED = true ]; then
|
||||
#Test write permissions
|
||||
touch /mnt/$diskname/testaze && rm /mnt/$diskname/testaze && bashio::log.info "... $disk successfully mounted to /mnt/$diskname with options $SMBVERS$SECVERS" || bashio::log.fatal "Disk is mounted, however unable to write in the shared disk. Please check UID/GID for permissions, and if the share is rw"
|
||||
else
|
||||
# message if still fail
|
||||
bashio::log.fatal "Unable to mount $disk to /mnt/$diskname with username $CIFS_USERNAME, $CIFS_PASSWORD. Please check your remote share path, username, password, domain, try putting 0 in UID and GID" # Mount share
|
||||
bashio::log.fatal "Error read : $(<ERRORCODE)" # Mount share
|
||||
rm ERRORCODE
|
||||
fi
|
||||
|
||||
done
|
||||
fi
|
||||
Reference in New Issue
Block a user