diff --git a/ubooquity/CHANGELOG.md b/ubooquity/CHANGELOG.md new file mode 100644 index 000000000..525b3fd63 --- /dev/null +++ b/ubooquity/CHANGELOG.md @@ -0,0 +1,2 @@ +- Enables PUID/GUID options +- Addition of possibility to mount smb \ No newline at end of file diff --git a/ubooquity/Dockerfile b/ubooquity/Dockerfile new file mode 100644 index 000000000..aee8059ed --- /dev/null +++ b/ubooquity/Dockerfile @@ -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" ] \ No newline at end of file diff --git a/ubooquity/README.md b/ubooquity/README.md new file mode 100644 index 000000000..f7011ae9d --- /dev/null +++ b/ubooquity/README.md @@ -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://:2203/ubooquity/admin and set a password. +Then you can access the webui at http://:2202/ubooquity/ +This container will automatically scan your files at startup. + +Network disk is mounted to /share/storagecifs + +```yaml +GUID: user +GPID: user +networkdisks: "" # 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 diff --git a/ubooquity/apparmor.txt b/ubooquity/apparmor.txt new file mode 100644 index 000000000..3223d49ab --- /dev/null +++ b/ubooquity/apparmor.txt @@ -0,0 +1,48 @@ +#include + +profile ubooquity_addon flags=(attach_disconnected,mediate_deleted) { + #include + + 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, + +} diff --git a/ubooquity/build.json b/ubooquity/build.json new file mode 100644 index 000000000..295f3289b --- /dev/null +++ b/ubooquity/build.json @@ -0,0 +1,8 @@ +{ + "build_from": { + "armv7": "linuxserver/ubooquity:arm32v7-", + "armhf": "linuxserver/ubooquity:arm32v7-", + "aarch64": "linuxserver/ubooquity:arm64v8-", + "amd64": "linuxserver/ubooquity:amd64-" + } +} \ No newline at end of file diff --git a/ubooquity/config.json b/ubooquity/config.json new file mode 100644 index 000000000..87a38bd21 --- /dev/null +++ b/ubooquity/config.json @@ -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?" + } +} \ No newline at end of file diff --git a/ubooquity/icon.png b/ubooquity/icon.png new file mode 100644 index 000000000..e552f0fdb Binary files /dev/null and b/ubooquity/icon.png differ diff --git a/ubooquity/logo.png b/ubooquity/logo.png new file mode 100644 index 000000000..e552f0fdb Binary files /dev/null and b/ubooquity/logo.png differ diff --git a/ubooquity/rootfs/etc/cont-init.d/91-configuration.sh b/ubooquity/rootfs/etc/cont-init.d/91-configuration.sh new file mode 100644 index 000000000..5e25bde4f --- /dev/null +++ b/ubooquity/rootfs/etc/cont-init.d/91-configuration.sh @@ -0,0 +1,3 @@ +#!/usr/bin/with-contenv bashio + +# Empty \ No newline at end of file diff --git a/ubooquity/rootfs/etc/cont-init.d/92-mounts b/ubooquity/rootfs/etc/cont-init.d/92-mounts new file mode 100644 index 000000000..c11731c54 --- /dev/null +++ b/ubooquity/rootfs/etc/cont-init.d/92-mounts @@ -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 diff --git a/ubooquity/rootfs/scripts/shutdown.sh b/ubooquity/rootfs/scripts/shutdown.sh new file mode 100644 index 000000000..8bc8473cf --- /dev/null +++ b/ubooquity/rootfs/scripts/shutdown.sh @@ -0,0 +1,4 @@ +#!/bin/sh +# Shutdown addon + +s6-svscanctl -t /var/run/s6/services