This commit is contained in:
Alexandre
2021-02-16 09:58:40 +01:00
parent 358aab5abe
commit ea01f21c59
11 changed files with 215 additions and 0 deletions

2
ubooquity/CHANGELOG.md Normal file
View File

@@ -0,0 +1,2 @@
- Enables PUID/GUID options
- Addition of possibility to mount smb

34
ubooquity/Dockerfile Normal file
View File

@@ -0,0 +1,34 @@
ARG BUILD_FROM
ARG BUILD_VERSION
FROM ${BUILD_FROM}${BUILD_VERSION}
# Copy root filesystem
COPY rootfs /
# Add bashio
RUN apk add --no-cache \
curl \
jq \
&& curl -J -L -o /tmp/bashio.tar.gz \
"https://github.com/hassio-addons/bashio/archive/v0.7.1.tar.gz" \
&& mkdir /tmp/bashio \
&& tar zxvf \
/tmp/bashio.tar.gz \
--strip 1 -C /tmp/bashio \
\
&& mv /tmp/bashio/lib /usr/lib/bashio \
&& ln -s /usr/lib/bashio/bashio /usr/bin/bashio \
&& rm -fr /tmp/bashio.tar.gz \
\
# 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 \
# # Set default folders
&& sed -i 's|/files|/share/ubooquity/files/|g' /defaults/preferences.json \
&& sed -i 's|/comics|/share/ubooquity/comics|g' /defaults/preferences.json \
&& sed -i 's|/books|/share/ubooquity/books|g' /defaults/preferences.json \
&& sed -i 's|config|config/ubooquity|g' /etc/cont-init.d/30-config \
&& sed -i 's|config|config/ubooquity|g' /etc/services.d/ubooquity/run
VOLUME [ "/data" ]

43
ubooquity/README.md Normal file
View File

@@ -0,0 +1,43 @@
# Home assistant add-on: Ubooquity
![Supports aarch64 Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armhf Architecture][armhf-shield] ![Supports armv7 Architecture][armv7-shield]
## About
Free, lightweight and easy-to-use home server for your comics and ebooks
This addon is based on the [docker image](https://github.com/linuxserver/ubooquity) from linuxserver.io.
## Installation
The installation of this add-on is pretty straightforward and not different in
comparison to installing any other Hass.io add-on.
1. [Add my Hass.io add-ons repository][repository] to your Hass.io instance.
1. Install this add-on.
1. Click the `Save` button to store your configuration.
1. Start the add-on.
1. Check the logs of the add-on to see if everything went well.
1. Carefully configure the add-on to your preferences, see the official documentation for for that.
## Configuration
Access the admin page at http://<your-ip>:2203/ubooquity/admin and set a password.
Then you can access the webui at http://<your-ip>:2202/ubooquity/
This container will automatically scan your files at startup.
Network disk is mounted to /share/storagecifs
```yaml
GUID: user
GPID: user
networkdisks: "<//SERVER/SHARE>" # list of smbv2/3 servers to mount (optional)
cifsusername: "username" # smb username (optional)
cifspassword: "password" # smb password (optional)
```
## Support
Create an issue on github
[repository]: https://github.com/alexbelgium/hassio-addons
[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
ubooquity/apparmor.txt Normal file
View File

@@ -0,0 +1,48 @@
#include <tunables/global>
profile ubooquity_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
ubooquity/build.json Normal file
View File

@@ -0,0 +1,8 @@
{
"build_from": {
"armv7": "linuxserver/ubooquity:arm32v7-",
"armhf": "linuxserver/ubooquity:arm32v7-",
"aarch64": "linuxserver/ubooquity:arm64v8-",
"amd64": "linuxserver/ubooquity:amd64-"
}
}

50
ubooquity/config.json Normal file
View File

@@ -0,0 +1,50 @@
{
"name": "Ubooquity",
"version": "2.1.2-ls57",
"slug": "ubooquity",
"description": "Free, lightweight and easy-to-use home server for your comics and ebooks",
"url": "https://hub.docker.com/r/linuxserver/ubooquity",
"startup": "services",
"arch": [
"aarch64",
"amd64",
"armv7",
"armhf"
],
"ports": {
"2202/tcp": 2202,
"2203/tcp": 2203
},
"ports_description": {
"2202/tcp": "Library page (to expose)",
"2203/tcp": "Admin page (local)"
},
"apparmor": true,
"privileged": [
"SYS_ADMIN",
"DAC_READ_SEARCH"
],
"map": [
"media:rw",
"config:rw",
"share:rw",
"ssl"
],
"webui": "[PROTO:ssl]://[HOST]:[PORT:2202]",
"boot": "auto",
"environment": {
"MAXMEM": "512"
},
"options": {
"PUID": 0,
"PGID": 0
},
"schema": {
"PUID": "int",
"PGID": "int",
"networkdisks": "str?",
"cifsusername": "str?",
"cifspassword": "str?",
"TZ": "str?"
}
}

BIN
ubooquity/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
ubooquity/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,3 @@
#!/usr/bin/with-contenv bashio
# Empty

View File

@@ -0,0 +1,23 @@
#!/usr/bin/with-contenv bashio
####################
# MOUNT SMB SHARES #
####################
# Mount CIFS Share if configured and if Protection Mode is active
if bashio::config.has_value 'networkdisks'; then
bashio::log.info 'Mounting smb share...'
MOREDISKS=$(bashio::config 'networkdisks')
CIFS_USERNAME=$(bashio::config 'cifsusername')
CIFS_PASSWORD=$(bashio::config 'cifspassword')
bashio::log.info "Network Disks mounting.. ${MOREDISKS}" && \
for disk in $MOREDISKS
do
bashio::log.info "Mount ${disk}"
echo "Creating /storage/storagecifs"
mkdir -p /storage/storagecifs
chown -R abc:abc /storage/storagecifs
mount -t cifs -o username=$CIFS_USERNAME,password=$CIFS_PASSWORD $disk /storage/storagecifs && \
bashio::log.info "Success!"
done || \
bashio::log.warning "Protection mode is ON. Unable to mount external drives!"
fi

View File

@@ -0,0 +1,4 @@
#!/bin/sh
# Shutdown addon
s6-svscanctl -t /var/run/s6/services