From 90f333c40d166b21157983feccaacc459407a2b9 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Tue, 14 Dec 2021 13:39:15 +0100 Subject: [PATCH] New logic --- addons_updater/Dockerfile | 36 ++-- addons_updater/rootfs/entrypoint.sh | 28 --- .../scripts/00-aaa_dockerfile_backup.sh | 15 +- arpspoof/CHANGELOG.md | 1 + arpspoof/Dockerfile | 34 ++-- arpspoof/rootfs/entrypoint.sh | 28 --- .../scripts/00-aaa_dockerfile_backup.sh | 15 +- bazarr/CHANGELOG.md | 1 + bazarr/Dockerfile | 62 +++--- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ bazarr/rootfs/etc/cont-init.d/00-banner.sh | 39 ++++ bazarr/rootfs/etc/cont-init.d/00-ha-env | 5 + bazarr/rootfs/etc/cont-init.d/20-folders | 19 ++ .../rootfs/etc/cont-init.d/92-local_mounts.sh | 32 +++ .../rootfs/etc/cont-init.d/92-smb_mounts.sh | 83 ++++++++ bitwarden/CHANGELOG.md | 1 + bitwarden/Dockerfile | 48 ++--- .../cont-init.d/00-aaa_dockerfile_backup.sh | 15 +- booksonic_air/CHANGELOG.md | 5 + booksonic_air/Dockerfile | 75 ++++--- booksonic_air/build.json | 8 + booksonic_air/config.json | 21 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ .../rootfs/etc/cont-init.d/00-banner.sh | 39 ++++ .../rootfs/etc/cont-init.d/92-local_mounts.sh | 32 +++ .../rootfs/etc/cont-init.d/92-smb_mounts.sh | 83 ++++++++ cloudcommander/CHANGELOG.md | 1 + cloudcommander/Dockerfile | 60 +++--- cloudcommander/rootfs/entrypoint.sh | 28 --- .../scripts/00-aaa_dockerfile_backup.sh | 35 ++-- code-server/CHANGELOG.md | 1 + code-server/Dockerfile | 59 ++++-- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ .../rootfs/etc/cont-init.d/00-banner.sh | 3 - .../rootfs/etc/cont-init.d/92-local_mounts.sh | 32 +++ .../rootfs/etc/cont-init.d/92-smb_mounts.sh | 83 ++++++++ doublecommander/CHANGELOG.md | 2 + doublecommander/Dockerfile | 68 ++++--- doublecommander/config.json | 2 - .../cont-init.d/00-aaa_dockerfile_backup.sh | 35 ++-- elasticsearch/CHANGELOG.md | 1 + elasticsearch/Dockerfile | 40 ++-- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ .../rootfs/etc/cont-init.d/00-banner.sh | 39 ++++ emby/CHANGELOG.md | 4 + emby/Dockerfile | 36 ++-- emby/config.json | 23 ++- .../cont-init.d/00-aaa_dockerfile_backup.sh | 15 +- enedisgateway2mqtt/CHANGELOG.md | 1 + enedisgateway2mqtt/Dockerfile | 57 +++--- .../scripts/00-aaa_dockerfile_backup.sh | 35 ++-- enedisgateway2mqtt_dev/CHANGELOG.md | 3 +- enedisgateway2mqtt_dev/Dockerfile | 59 +++--- .../scripts/00-aaa_dockerfile_backup.sh | 36 ++-- filebrowser/CHANGELOG.md | 1 + filebrowser/Dockerfile | 58 +++--- filebrowser/rootfs/entrypoint.sh | 28 --- .../scripts/00-aaa_dockerfile_backup.sh | 35 ++-- flexget/CHANGELOG.md | 1 + flexget/Dockerfile | 67 ++++--- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ flexget/rootfs/etc/cont-init.d/00-banner.sh | 39 ++++ flexget/rootfs/etc/cont-init.d/00-folders.sh | 3 + freqtrade/CHANGELOG.md | 7 - freqtrade/Dockerfile | 68 ------- freqtrade/Readme.md | 1 - freqtrade/apparmor.txt | 48 ----- freqtrade/config.json | 31 --- freqtrade/icon.png | Bin 21368 -> 0 bytes freqtrade/logo.png | Bin 21368 -> 0 bytes freqtrade/rootfs/entrypoint.sh | 15 -- .../cont-init.d/00-aaa_dockerfile_backup.sh | 29 --- gazpar2mqtt/CHANGELOG.md | 7 + gazpar2mqtt/Dockerfile | 61 +++--- gazpar2mqtt/config.json | 4 +- gazpar2mqtt/rootfs/entrypoint.sh | 28 --- .../scripts/00-aaa_dockerfile_backup.sh | 35 ++-- gazpar2mqtt/rootfs/scripts/92-config_yaml.sh | 3 +- grav/CHANGELOG.md | 1 + grav/Dockerfile | 66 ++++--- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ grav/rootfs/etc/cont-init.d/00-banner.sh | 39 ++++ .../rootfs/etc/cont-init.d/00-ha-env | 0 grav/rootfs/etc/cont-init.d/20-folders | 12 ++ inadyn/Dockerfile | 70 ++++--- inadyn/rootfs/entrypoint.sh | 17 ++ .../scripts/00-aaa_dockerfile_backup.sh | 18 ++ inadyn/rootfs/scripts/00-banner.sh | 39 ++++ inadyn/rootfs/scripts/99-run.sh | 11 ++ jackett/CHANGELOG.md | 11 ++ jackett/Dockerfile | 56 +++--- jackett/config.json | 5 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ jackett/rootfs/etc/cont-init.d/00-banner.sh | 39 ++++ jackett/rootfs/etc/cont-init.d/00-ha-env | 5 + jackett/rootfs/etc/cont-init.d/20-folders | 19 ++ .../rootfs/etc/cont-init.d/92-local_mounts.sh | 32 +++ .../rootfs/etc/cont-init.d/92-smb_mounts.sh | 83 ++++++++ jellyfin/CHANGELOG.md | 3 +- jellyfin/Dockerfile | 69 ++++--- jellyfin/config.json | 1 - .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ jellyfin/rootfs/etc/cont-init.d/00-banner.sh | 39 ++++ jellyfin/rootfs/etc/cont-init.d/00-ha-env | 5 + jellyfin/rootfs/etc/cont-init.d/20-folders | 82 ++++++++ .../rootfs/etc/cont-init.d/92-local_mounts.sh | 32 +++ .../rootfs/etc/cont-init.d/92-smb_mounts.sh | 83 ++++++++ joal/CHANGELOG.md | 4 + joal/Dockerfile | 88 +++++---- joal/config.json | 4 +- joal/rootfs/entrypoint.sh | 28 --- .../scripts/00-aaa_dockerfile_backup.sh | 35 ++-- joal/rootfs/scripts/99-run.sh | 2 - joplin/CHANGELOG.md | 1 + joplin/Dockerfile | 60 +++--- joplin/rootfs/entrypoint.sh | 17 ++ .../scripts/00-aaa_dockerfile_backup.sh | 18 ++ joplin/rootfs/scripts/00-banner.sh | 39 ++++ joplin/rootfs/scripts/99-run.sh | 67 +++++++ lidarr/CHANGELOG.md | 2 + lidarr/Dockerfile | 73 ++++--- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ lidarr/rootfs/etc/cont-init.d/00-banner.sh | 39 ++++ lidarr/rootfs/etc/cont-init.d/20-folders | 19 ++ .../rootfs/etc/cont-init.d/92-local_mounts.sh | 32 +++ .../rootfs/etc/cont-init.d/92-smb_mounts.sh | 83 ++++++++ mealie/CHANGELOG.md | 1 + mealie/Dockerfile | 63 +++--- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ mealie/rootfs/etc/cont-init.d/00-banner.sh | 39 ++++ mylar3/CHANGELOG.md | 4 + mylar3/Dockerfile | 38 ++-- mylar3/config.json | 4 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 15 +- nextcloud/CHANGELOG.md | 1 + nextcloud/Dockerfile | 44 +++-- nextcloud/rootfs/defaults/config.php | 6 + nextcloud/rootfs/defaults/default | 121 ++++++++++++ nextcloud/rootfs/defaults/nextcloud-perms.sh | 54 +++++ nextcloud/rootfs/defaults/nginx.conf | 102 ++++++++++ nextcloud/rootfs/defaults/root | 9 + .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ nextcloud/rootfs/etc/cont-init.d/00-banner.sh | 39 ++++ nextcloud/rootfs/etc/cont-init.d/10-adduser | 39 ++++ nextcloud/rootfs/etc/cont-init.d/30-keygen | 37 ++++ nextcloud/rootfs/etc/cont-init.d/40-config | 19 ++ nextcloud/rootfs/etc/cont-init.d/50-install | 21 ++ nextcloud/rootfs/etc/cont-init.d/60-memcache | 9 + .../rootfs/etc/cont-init.d/99-elasticsearch | 76 +++++++ nextcloud/rootfs/etc/cont-init.d/99-ocr | 45 +++++ .../rootfs/etc/cont-init.d/99-trusted_domains | 48 +++++ nextcloud/rootfs/etc/services.d/cron/run | 3 + ombi/CHANGELOG.md | 1 + ombi/Dockerfile | 71 ++++--- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ ombi/rootfs/etc/cont-init.d/00-banner.sh | 39 ++++ organizr/CHANGELOG.md | 3 +- organizr/Dockerfile | 53 +++-- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ organizr/rootfs/etc/cont-init.d/00-banner.sh | 39 ++++ organizr/rootfs/etc/cont-init.d/00-folders | 7 + paperless_ng/CHANGELOG.md | 1 + paperless_ng/Dockerfile | 74 ++++--- .../cont-init.d/00-aaa_dockerfile_backup.sh | 35 ++-- .../rootfs/etc/cont-init.d/90-config_yaml.sh | 4 +- papermerge/CHANGELOG.md | 1 + papermerge/Dockerfile | 75 ++++--- .../cont-init.d/00-aaa_dockerfile_backup.sh | 35 ++-- papermerge/rootfs/etc/cont-init.d/91-OCR | 10 +- photoprism/CHANGELOG.md | 4 + photoprism/Dockerfile | 87 ++++---- photoprism/config.json | 18 +- photoprism/rootfs/entrypoint.sh | 17 ++ .../scripts/00-aaa_dockerfile_backup.sh | 18 ++ photoprism/rootfs/scripts/00-banner.sh | 39 ++++ photoprism/rootfs/scripts/92-local_mounts.sh | 32 +++ photoprism/rootfs/scripts/92-smb_mounts.sh | 83 ++++++++ photoprism/rootfs/scripts/99-run.sh | 38 ++++ piwigo/CHANGELOG.md | 1 + piwigo/Dockerfile | 78 ++++---- .../cont-init.d/00-aaa_dockerfile_backup.sh | 35 ++-- plex/CHANGELOG.md | 4 + plex/Dockerfile | 80 ++++---- plex/config.json | 4 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ plex/rootfs/etc/cont-init.d/00-banner.sh | 39 ++++ plex/rootfs/etc/cont-init.d/21-folders | 26 +++ plex/rootfs/etc/cont-init.d/90-create_links | 24 +++ .../rootfs/etc/cont-init.d/92-local_mounts.sh | 32 +++ plex/rootfs/etc/cont-init.d/92-smb_mounts.sh | 83 ++++++++ portainer/CHANGELOG.md | 1 + portainer/Dockerfile | 45 ++++- .../cont-init.d/00-aaa_dockerfile_backup.sh | 35 ++-- prowlarr/CHANGELOG.md | 7 + prowlarr/Dockerfile | 77 +++++--- prowlarr/config.json | 4 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ prowlarr/rootfs/etc/cont-init.d/00-banner.sh | 39 ++++ prowlarr/rootfs/etc/cont-init.d/00-ha-env | 5 + prowlarr/rootfs/etc/cont-init.d/20-folders | 7 + .../rootfs/etc/cont-init.d/92-smb_mounts.sh | 83 ++++++++ qbittorrent/CHANGELOG.md | 3 + qbittorrent/Dockerfile | 37 ++-- qbittorrent/config.json | 3 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 8 +- radarr/CHANGELOG.md | 1 + radarr/Dockerfile | 72 ++++--- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ radarr/rootfs/etc/cont-init.d/00-banner.sh | 39 ++++ radarr/rootfs/etc/cont-init.d/00-ha-env | 5 + radarr/rootfs/etc/cont-init.d/20-folders | 19 ++ .../rootfs/etc/cont-init.d/92-local_mounts.sh | 32 +++ .../rootfs/etc/cont-init.d/92-smb_mounts.sh | 83 ++++++++ readarr/CHANGELOG.md | 4 + readarr/Dockerfile | 38 ++-- readarr/config.json | 4 +- .../cont-init.d/00-aaa_dockerfile_backup.sh | 15 +- requestrr/CHANGELOG.md | 1 + requestrr/Dockerfile | 73 ++++--- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ requestrr/rootfs/etc/cont-init.d/00-banner.sh | 39 ++++ requestrr/rootfs/etc/cont-init.d/00-ha-env | 5 + resiliosync/CHANGELOG.md | 1 + resiliosync/Dockerfile | 76 +++---- .../cont-init.d/00-aaa_dockerfile_backup.sh | 35 ++-- scrutiny/CHANGELOG.md | 1 + scrutiny/Dockerfile | 73 ++++--- .../cont-init.d/00-aaa_dockerfile_backup.sh | 35 ++-- sonarr/CHANGELOG.md | 1 + sonarr/Dockerfile | 73 ++++--- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ sonarr/rootfs/etc/cont-init.d/00-banner.sh | 39 ++++ sonarr/rootfs/etc/cont-init.d/00-ha-env | 5 + sonarr/rootfs/etc/cont-init.d/20-folders | 19 ++ .../rootfs/etc/cont-init.d/92-local_mounts.sh | 32 +++ .../rootfs/etc/cont-init.d/92-smb_mounts.sh | 83 ++++++++ teamspeak/CHANGELOG.md | 1 + teamspeak/Dockerfile | 27 ++- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ teamspeak/rootfs/etc/cont-init.d/00-banner.sh | 39 ++++ transmission/CHANGELOG.md | 1 + transmission/Dockerfile | 75 ++++--- .../cont-init.d/00-aaa_dockerfile_backup.sh | 35 ++-- ubooquity/CHANGELOG.md | 1 + ubooquity/Dockerfile | 66 ++++--- .../cont-init.d/00-aaa_dockerfile_backup.sh | 35 ++-- webtop/CHANGELOG.md | 1 + webtop/Dockerfile | 98 ++++++---- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ webtop/rootfs/etc/cont-init.d/00-banner.sh | 39 ++++ webtop/rootfs/etc/cont-init.d/90-dns_set.sh | 28 +++ .../rootfs/etc/cont-init.d/92-local_mounts.sh | 32 +++ .../rootfs/etc/cont-init.d/92-smb_mounts.sh | 83 ++++++++ webtrees/CHANGELOG.md | 1 + webtrees/Dockerfile | 74 +++---- webtrees/rootfs/entrypoint.sh | 28 --- .../scripts/00-aaa_dockerfile_backup.sh | 35 ++-- webtrees/rootfs/scripts/90-config_yaml.sh | 4 +- wger/Dockerfile | 28 ++- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ wger/rootfs/etc/cont-init.d/00-banner.sh | 39 ++++ xteve/CHANGELOG.md | 1 + xteve/Dockerfile | 23 ++- .../cont-init.d/00-aaa_dockerfile_backup.sh | 18 ++ xteve/rootfs/etc/cont-init.d/00-banner.sh | 39 ++++ zzz_templates/00-aaa_dockerfile_backup.sh | 14 +- zzz_templates/00-banner.sh | 18 +- zzz_templates/90-config_yaml.sh | 4 +- zzz_templates/automatic_packages.sh | 185 ++++++++++-------- 269 files changed, 6071 insertions(+), 2163 deletions(-) create mode 100644 bazarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 bazarr/rootfs/etc/cont-init.d/00-banner.sh create mode 100644 bazarr/rootfs/etc/cont-init.d/00-ha-env create mode 100644 bazarr/rootfs/etc/cont-init.d/20-folders create mode 100644 bazarr/rootfs/etc/cont-init.d/92-local_mounts.sh create mode 100644 bazarr/rootfs/etc/cont-init.d/92-smb_mounts.sh create mode 100644 booksonic_air/build.json create mode 100644 booksonic_air/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 booksonic_air/rootfs/etc/cont-init.d/00-banner.sh create mode 100644 booksonic_air/rootfs/etc/cont-init.d/92-local_mounts.sh create mode 100644 booksonic_air/rootfs/etc/cont-init.d/92-smb_mounts.sh create mode 100644 code-server/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh rename {freqtrade => code-server}/rootfs/etc/cont-init.d/00-banner.sh (94%) create mode 100644 code-server/rootfs/etc/cont-init.d/92-local_mounts.sh create mode 100644 code-server/rootfs/etc/cont-init.d/92-smb_mounts.sh create mode 100644 elasticsearch/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 elasticsearch/rootfs/etc/cont-init.d/00-banner.sh create mode 100644 flexget/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 flexget/rootfs/etc/cont-init.d/00-banner.sh create mode 100644 flexget/rootfs/etc/cont-init.d/00-folders.sh delete mode 100644 freqtrade/CHANGELOG.md delete mode 100644 freqtrade/Dockerfile delete mode 100644 freqtrade/Readme.md delete mode 100644 freqtrade/apparmor.txt delete mode 100644 freqtrade/config.json delete mode 100644 freqtrade/icon.png delete mode 100644 freqtrade/logo.png delete mode 100644 freqtrade/rootfs/entrypoint.sh delete mode 100644 freqtrade/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 grav/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 grav/rootfs/etc/cont-init.d/00-banner.sh rename {freqtrade => grav}/rootfs/etc/cont-init.d/00-ha-env (100%) create mode 100644 grav/rootfs/etc/cont-init.d/20-folders create mode 100644 inadyn/rootfs/entrypoint.sh create mode 100644 inadyn/rootfs/scripts/00-aaa_dockerfile_backup.sh create mode 100644 inadyn/rootfs/scripts/00-banner.sh create mode 100644 inadyn/rootfs/scripts/99-run.sh create mode 100644 jackett/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 jackett/rootfs/etc/cont-init.d/00-banner.sh create mode 100644 jackett/rootfs/etc/cont-init.d/00-ha-env create mode 100644 jackett/rootfs/etc/cont-init.d/20-folders create mode 100644 jackett/rootfs/etc/cont-init.d/92-local_mounts.sh create mode 100644 jackett/rootfs/etc/cont-init.d/92-smb_mounts.sh create mode 100644 jellyfin/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 jellyfin/rootfs/etc/cont-init.d/00-banner.sh create mode 100644 jellyfin/rootfs/etc/cont-init.d/00-ha-env create mode 100644 jellyfin/rootfs/etc/cont-init.d/20-folders create mode 100644 jellyfin/rootfs/etc/cont-init.d/92-local_mounts.sh create mode 100644 jellyfin/rootfs/etc/cont-init.d/92-smb_mounts.sh create mode 100644 joplin/rootfs/entrypoint.sh create mode 100644 joplin/rootfs/scripts/00-aaa_dockerfile_backup.sh create mode 100644 joplin/rootfs/scripts/00-banner.sh create mode 100644 joplin/rootfs/scripts/99-run.sh create mode 100644 lidarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 lidarr/rootfs/etc/cont-init.d/00-banner.sh create mode 100644 lidarr/rootfs/etc/cont-init.d/20-folders create mode 100644 lidarr/rootfs/etc/cont-init.d/92-local_mounts.sh create mode 100644 lidarr/rootfs/etc/cont-init.d/92-smb_mounts.sh create mode 100644 mealie/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 mealie/rootfs/etc/cont-init.d/00-banner.sh create mode 100644 nextcloud/rootfs/defaults/config.php create mode 100644 nextcloud/rootfs/defaults/default create mode 100644 nextcloud/rootfs/defaults/nextcloud-perms.sh create mode 100644 nextcloud/rootfs/defaults/nginx.conf create mode 100644 nextcloud/rootfs/defaults/root create mode 100644 nextcloud/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 nextcloud/rootfs/etc/cont-init.d/00-banner.sh create mode 100644 nextcloud/rootfs/etc/cont-init.d/10-adduser create mode 100644 nextcloud/rootfs/etc/cont-init.d/30-keygen create mode 100644 nextcloud/rootfs/etc/cont-init.d/40-config create mode 100644 nextcloud/rootfs/etc/cont-init.d/50-install create mode 100644 nextcloud/rootfs/etc/cont-init.d/60-memcache create mode 100644 nextcloud/rootfs/etc/cont-init.d/99-elasticsearch create mode 100644 nextcloud/rootfs/etc/cont-init.d/99-ocr create mode 100644 nextcloud/rootfs/etc/cont-init.d/99-trusted_domains create mode 100644 nextcloud/rootfs/etc/services.d/cron/run create mode 100644 ombi/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 ombi/rootfs/etc/cont-init.d/00-banner.sh create mode 100644 organizr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 organizr/rootfs/etc/cont-init.d/00-banner.sh create mode 100644 organizr/rootfs/etc/cont-init.d/00-folders create mode 100644 photoprism/rootfs/entrypoint.sh create mode 100644 photoprism/rootfs/scripts/00-aaa_dockerfile_backup.sh create mode 100644 photoprism/rootfs/scripts/00-banner.sh create mode 100644 photoprism/rootfs/scripts/92-local_mounts.sh create mode 100644 photoprism/rootfs/scripts/92-smb_mounts.sh create mode 100644 photoprism/rootfs/scripts/99-run.sh create mode 100644 plex/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 plex/rootfs/etc/cont-init.d/00-banner.sh create mode 100644 plex/rootfs/etc/cont-init.d/21-folders create mode 100644 plex/rootfs/etc/cont-init.d/90-create_links create mode 100644 plex/rootfs/etc/cont-init.d/92-local_mounts.sh create mode 100644 plex/rootfs/etc/cont-init.d/92-smb_mounts.sh create mode 100644 prowlarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 prowlarr/rootfs/etc/cont-init.d/00-banner.sh create mode 100644 prowlarr/rootfs/etc/cont-init.d/00-ha-env create mode 100644 prowlarr/rootfs/etc/cont-init.d/20-folders create mode 100644 prowlarr/rootfs/etc/cont-init.d/92-smb_mounts.sh create mode 100644 radarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 radarr/rootfs/etc/cont-init.d/00-banner.sh create mode 100644 radarr/rootfs/etc/cont-init.d/00-ha-env create mode 100644 radarr/rootfs/etc/cont-init.d/20-folders create mode 100644 radarr/rootfs/etc/cont-init.d/92-local_mounts.sh create mode 100644 radarr/rootfs/etc/cont-init.d/92-smb_mounts.sh create mode 100644 requestrr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 requestrr/rootfs/etc/cont-init.d/00-banner.sh create mode 100644 requestrr/rootfs/etc/cont-init.d/00-ha-env create mode 100644 sonarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 sonarr/rootfs/etc/cont-init.d/00-banner.sh create mode 100644 sonarr/rootfs/etc/cont-init.d/00-ha-env create mode 100644 sonarr/rootfs/etc/cont-init.d/20-folders create mode 100644 sonarr/rootfs/etc/cont-init.d/92-local_mounts.sh create mode 100644 sonarr/rootfs/etc/cont-init.d/92-smb_mounts.sh create mode 100644 teamspeak/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 teamspeak/rootfs/etc/cont-init.d/00-banner.sh create mode 100644 webtop/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 webtop/rootfs/etc/cont-init.d/00-banner.sh create mode 100644 webtop/rootfs/etc/cont-init.d/90-dns_set.sh create mode 100644 webtop/rootfs/etc/cont-init.d/92-local_mounts.sh create mode 100644 webtop/rootfs/etc/cont-init.d/92-smb_mounts.sh create mode 100644 wger/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 wger/rootfs/etc/cont-init.d/00-banner.sh create mode 100644 xteve/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh create mode 100644 xteve/rootfs/etc/cont-init.d/00-banner.sh diff --git a/addons_updater/Dockerfile b/addons_updater/Dockerfile index 356295086..045edb547 100644 --- a/addons_updater/Dockerfile +++ b/addons_updater/Dockerfile @@ -1,18 +1,18 @@ -############### -# Build Image # -############### +################# +# 1 Build Image # +################# ARG BUILD_FROM FROM $BUILD_FROM VOLUME [ "/data" ] -################ -# Modify Image # -################ +################## +# 2 Modify Image # +################## -################ -# Install apps # -################ +################## +# 3 Install apps # +################## # Add rootfs COPY rootfs/ / @@ -21,17 +21,17 @@ COPY rootfs/ / ENV PACKAGES="" # Automatic apps & bashio -RUN $(ls /bin/bash &>/dev/null) || (apt-get install -y --no-install-recommends bash || apk add --no-cache bash) && \ - $(curl --help &>/dev/null) || (apt-get install -y --no-install-recommends curl || apk add --no-cache curl) && \ +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ chmod 777 /automatic_packages.sh && \ /automatic_packages.sh "${PACKAGES:-}" && \ rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE -############## -# Entrypoint # -############## - +################ +# 4 Entrypoint # +################ + # Entrypoint logic RUN chmod 777 /entrypoint.sh #WORKDIR / @@ -40,9 +40,9 @@ CMD [ "/entrypoint.sh" ] # Set shell SHELL ["/bin/bash", "-o", "pipefail", "-c"] -########## -# Labels # -########## +############ +# 5 Labels # +############ ARG BUILD_ARCH ARG BUILD_DATE diff --git a/addons_updater/rootfs/entrypoint.sh b/addons_updater/rootfs/entrypoint.sh index bf5da4a6c..35ccb7382 100644 --- a/addons_updater/rootfs/entrypoint.sh +++ b/addons_updater/rootfs/entrypoint.sh @@ -2,34 +2,6 @@ echo "Starting..." -################################### -# Export all addon options as env # -################################### - -# For all keys in options.json -JSONSOURCE="/data/options.json" - -# Export keys as env variables -echo "All addon options were exported as variables" -mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE}) -for KEYS in ${arr[@]}; do - # export key - VALUE=$(jq .$KEYS ${JSONSOURCE}) - export ${KEYS}=${VALUE//[\"\']/} &>/dev/null -done - -################ -# Set timezone # -################ -if [ ! -z "TZ" ] && [ -f /etc/localtime ]; then - if [ -f /usr/share/zoneinfo/$TZ ]; then - echo "Timezone set from $(cat /etc/timezone) to $TZ" - ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone - else - echo "WARNING : Timezone $TZ is invalid, it will be kept to default value of $(cat /etc/timezone)" - fi -fi - #################### # Starting scripts # #################### diff --git a/addons_updater/rootfs/scripts/00-aaa_dockerfile_backup.sh b/addons_updater/rootfs/scripts/00-aaa_dockerfile_backup.sh index e33f7f063..4f9ed9c51 100644 --- a/addons_updater/rootfs/scripts/00-aaa_dockerfile_backup.sh +++ b/addons_updater/rootfs/scripts/00-aaa_dockerfile_backup.sh @@ -2,18 +2,17 @@ # If dockerfile failed install manually if [ -e "/ENVFILE" ]; then echo "Executing script" - PACKAGES=$(< /ENVFILE) + PACKAGES=$(/dev/null) || (apt-get install -y --no-install-recommends bash || apk add --no-cache bash) && \ - $(curl --help &>/dev/null) || (apt-get install -y --no-install-recommends curl &>/dev/null || apk add --no-cache curl) && \ - curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ - chmod 777 /automatic_packages.sh && \ - eval /./automatic_packages.sh "$PACKAGES" && \ - rm /automatic_packages.sh - + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/arpspoof/CHANGELOG.md b/arpspoof/CHANGELOG.md index 6256f6532..18af5d834 100644 --- a/arpspoof/CHANGELOG.md +++ b/arpspoof/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation ## 1.0.0 (07-12-2021) - Update to latest version from t0mer/Arpspoof-Docker diff --git a/arpspoof/Dockerfile b/arpspoof/Dockerfile index 72c4fd184..b596b54f2 100644 --- a/arpspoof/Dockerfile +++ b/arpspoof/Dockerfile @@ -1,18 +1,18 @@ -############### -# Build Image # -############### +################# +# 1 Build Image # +################# ARG BUILD_FROM ARG BUILD_VERSION FROM techblog/arpspoof-docker:latest -################ -# Modify Image # -################ +################## +# 2 Modify Image # +################## -################ -# Install apps # -################ +################## +# 3 Install apps # +################## # Add rootfs COPY rootfs/ / @@ -21,24 +21,24 @@ COPY rootfs/ / ENV PACKAGES="jq curl iproute2" # Automatic apps & bashio -RUN $(ls /bin/bash &>/dev/null) || (apt-get install -y --no-install-recommends bash || apk add --no-cache bash) && \ - $(curl --help &>/dev/null) || (apt-get install -y --no-install-recommends curl || apk add --no-cache curl) && \ +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ chmod 777 /automatic_packages.sh && \ /automatic_packages.sh "${PACKAGES:-}" && \ rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE -############## -# Entrypoint # -############## +################ +# 4 Entrypoint # +################ RUN chmod 777 /entrypoint.sh ENTRYPOINT [ "/usr/bin/env" ] CMD [ "/entrypoint.sh" ] -########## -# Labels # -########## +############ +# 5 Labels # +############ ARG BUILD_ARCH ARG BUILD_DATE diff --git a/arpspoof/rootfs/entrypoint.sh b/arpspoof/rootfs/entrypoint.sh index bf5da4a6c..35ccb7382 100644 --- a/arpspoof/rootfs/entrypoint.sh +++ b/arpspoof/rootfs/entrypoint.sh @@ -2,34 +2,6 @@ echo "Starting..." -################################### -# Export all addon options as env # -################################### - -# For all keys in options.json -JSONSOURCE="/data/options.json" - -# Export keys as env variables -echo "All addon options were exported as variables" -mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE}) -for KEYS in ${arr[@]}; do - # export key - VALUE=$(jq .$KEYS ${JSONSOURCE}) - export ${KEYS}=${VALUE//[\"\']/} &>/dev/null -done - -################ -# Set timezone # -################ -if [ ! -z "TZ" ] && [ -f /etc/localtime ]; then - if [ -f /usr/share/zoneinfo/$TZ ]; then - echo "Timezone set from $(cat /etc/timezone) to $TZ" - ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone - else - echo "WARNING : Timezone $TZ is invalid, it will be kept to default value of $(cat /etc/timezone)" - fi -fi - #################### # Starting scripts # #################### diff --git a/arpspoof/rootfs/scripts/00-aaa_dockerfile_backup.sh b/arpspoof/rootfs/scripts/00-aaa_dockerfile_backup.sh index e33f7f063..4f9ed9c51 100644 --- a/arpspoof/rootfs/scripts/00-aaa_dockerfile_backup.sh +++ b/arpspoof/rootfs/scripts/00-aaa_dockerfile_backup.sh @@ -2,18 +2,17 @@ # If dockerfile failed install manually if [ -e "/ENVFILE" ]; then echo "Executing script" - PACKAGES=$(< /ENVFILE) + PACKAGES=$(/dev/null) || (apt-get install -y --no-install-recommends bash || apk add --no-cache bash) && \ - $(curl --help &>/dev/null) || (apt-get install -y --no-install-recommends curl &>/dev/null || apk add --no-cache curl) && \ - curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ - chmod 777 /automatic_packages.sh && \ - eval /./automatic_packages.sh "$PACKAGES" && \ - rm /automatic_packages.sh - + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/bazarr/CHANGELOG.md b/bazarr/CHANGELOG.md index c559150e2..d1232be22 100644 --- a/bazarr/CHANGELOG.md +++ b/bazarr/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation ## 1.0.1 (20-11-2021) - Update to latest version from linuxserver/docker-bazarr diff --git a/bazarr/Dockerfile b/bazarr/Dockerfile index 6a919c58e..9b09a9e20 100644 --- a/bazarr/Dockerfile +++ b/bazarr/Dockerfile @@ -1,29 +1,14 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -ENV BASHIO_VERSION=0.14.3 -ENV PACKAGES="jq \ - curl \ - cifs-utils \ - keyutils \ - samba \ - samba-client" -RUN \ - ############################### - # Install apps test both dist # - ############################### - apk add --no-cache ${PACKAGES} \ - \ - ################## - # 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 || true +################## +# 2 Modify Image # +################## RUN \ # Correct config folder @@ -36,10 +21,37 @@ RUN \ && 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/ / +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="jq \ + curl \ + cifs-utils \ + keyutils \ + samba \ + samba-client" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/bazarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/bazarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/bazarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/bazarr/rootfs/etc/cont-init.d/00-banner.sh b/bazarr/rootfs/etc/cont-init.d/00-banner.sh new file mode 100644 index 000000000..54d7d491a --- /dev/null +++ b/bazarr/rootfs/etc/cont-init.d/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/bazarr/rootfs/etc/cont-init.d/00-ha-env b/bazarr/rootfs/etc/cont-init.d/00-ha-env new file mode 100644 index 000000000..3b3e69246 --- /dev/null +++ b/bazarr/rootfs/etc/cont-init.d/00-ha-env @@ -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 \ No newline at end of file diff --git a/bazarr/rootfs/etc/cont-init.d/20-folders b/bazarr/rootfs/etc/cont-init.d/20-folders new file mode 100644 index 000000000..73e1f22de --- /dev/null +++ b/bazarr/rootfs/etc/cont-init.d/20-folders @@ -0,0 +1,19 @@ +#!/usr/bin/with-contenv bash + +if [ ! -d /share/storage/movies ]; then + echo "Creating /share/storage/movies" + mkdir -p /share/storage/movies + chown -R abc:abc /share/storage/movies +fi + +if [ ! -d /share/downloads ]; then + echo "Creating /share/downloads" + mkdir -p /share/downloads + chown -R abc:abc /share/downloads +fi + +if [ ! -d /config/bazarr ]; then + echo "Creating /config/bazarr" + mkdir -p /config/bazarr + chown -R abc:abc /config/bazarr +fi diff --git a/bazarr/rootfs/etc/cont-init.d/92-local_mounts.sh b/bazarr/rootfs/etc/cont-init.d/92-local_mounts.sh new file mode 100644 index 000000000..0920d68bd --- /dev/null +++ b/bazarr/rootfs/etc/cont-init.d/92-local_mounts.sh @@ -0,0 +1,32 @@ +#!/usr/bin/with-contenv bashio + +###################### +# MOUNT LOCAL SHARES # +###################### + +# Mount local Share if configured +if bashio::config.has_value 'localdisks'; then + + MOREDISKS=$(bashio::config 'localdisks') + echo "Local Disks mounting..." + + # Separate comma separated values + for disk in ${MOREDISKS//,/ }; do + + # Mount by device as default + devpath=/dev + + # Mount as label + [ ${disk:0:2} != "sd" ] && devpath=/dev/disk/by-label + + # Creates dir + mkdir -p /mnt/$disk + chown -R $(id -u):$(id -g) /mnt/$disk + # Legacy mounting : mount to share if still exists (avoid breaking changes) + [ -d /share/$disk ] && mount $devpath/$disk /share/$disk || true + # Mount + mount $devpath/$disk /mnt/$disk && bashio::log.info "Success! $disk mounted to /mnt/$disk" || (bashio::log.fatal "Unable to mount local drives! Please check the name." && rmdir /mnt/$disk) + + done + +fi diff --git a/bazarr/rootfs/etc/cont-init.d/92-smb_mounts.sh b/bazarr/rootfs/etc/cont-init.d/92-smb_mounts.sh new file mode 100644 index 000000000..06410e554 --- /dev/null +++ b/bazarr/rootfs/etc/cont-init.d/92-smb_mounts.sh @@ -0,0 +1,83 @@ +#!/usr/bin/with-contenv bashio + +######################### +# MOUNT SMB SHARES v1.6 # +######################### +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="" + + # Mount CIFS Share if configured and if Protection Mode is active + echo '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//,/ }; do # Separate comma separated values + + # 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 + + # Data validation + if [[ ! $disk =~ ^.*+[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[/]+.*+$ ]]; then + bashio::log.fatal "The structure of your \"networkdisks\" option : \"$disk\" doesn't seem correct, please use a structure like //123.12.12.12/sharedfolder,//123.12.12.12/sharedfolder2. If you don't use it, you can simply remove the text, this will avoid this error message in the future." + exit 0 + fi + + # 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:-WORKGROUP}"; 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 + + # Messages + if [ $MOUNTED = true ] && [ "mountpoint -q /mnt/$diskname" ]; 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 + # Mounting failed messages + bashio::log.fatal "Error, 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" + bashio::log.fatal "Here is some debugging info :" + + # Provide debugging info + smbclient -V &>/dev/null || apt-get install smbclient || apk add --no-cache samba-client + #smbclient $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + smbclient -L $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + + # Error code + bashio::log.fatal "Error read : $(/dev/null || true + rmdir /mnt/$diskname || true + fi + + done +fi diff --git a/bitwarden/CHANGELOG.md b/bitwarden/CHANGELOG.md index 8229c6ecc..e15850430 100644 --- a/bitwarden/CHANGELOG.md +++ b/bitwarden/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation ## 1.23.0 (21-10-2021) - Update to latest version from dani-garcia/bitwarden_rs diff --git a/bitwarden/Dockerfile b/bitwarden/Dockerfile index ac9b4bd37..af6a0f623 100644 --- a/bitwarden/Dockerfile +++ b/bitwarden/Dockerfile @@ -1,20 +1,12 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM=ghcr.io/hassio-addons/debian-base/amd64:4.0.0 -############################################################################### -# Get prebuild containers from Bitwarden RS -############################################################################### ARG BUILD_VERSION ARG BUILD_UPSTREAM="1.23.0" - -# hadolint ignore=DL3006 FROM "vaultwarden/server:${BUILD_UPSTREAM}" as vaultwarden - -############################################################################### -# Build the actual add-on. -############################################################################### -# hadolint ignore=DL3006 FROM ${BUILD_FROM} - -# Set shell SHELL ["/bin/bash", "-o", "pipefail", "-c"] # Get the Bitwarden from official images @@ -22,33 +14,45 @@ COPY --from=vaultwarden /vaultwarden /opt/vaultwarden COPY --from=vaultwarden /Rocket.toml /opt/Rocket.toml COPY --from=vaultwarden /web-vault /opt/web-vault -################ -# Install apps # -################ +################## +# 2 Modify Image # +################## + +################## +# 3 Install apps # +################## + # Add rootfs COPY rootfs/ / # Manual apps ENV PACKAGES="libmariadb-dev-compat \ - libpq5 \ - nginx \ - sqlite3" + libpq5 \ + nginx \ + sqlite3" # Automatic apps & bashio -RUN $(ls /bin/bash &>/dev/null) || (apt-get install -y --no-install-recommends bash || apk add --no-cache bash) && \ - $(curl --help &>/dev/null) || (apt-get install -y --no-install-recommends curl || apk add --no-cache curl) && \ +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ chmod 777 /automatic_packages.sh && \ /automatic_packages.sh "${PACKAGES:-}" && \ rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE -# Entrypoint logic +################ +# 4 Entrypoint # +################ + #RUN chmod 777 /entrypoint.sh #WORKDIR / #ENTRYPOINT [ "/usr/bin/env" ] #CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/bitwarden/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/bitwarden/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index e33f7f063..4f9ed9c51 100644 --- a/bitwarden/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/bitwarden/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -2,18 +2,17 @@ # If dockerfile failed install manually if [ -e "/ENVFILE" ]; then echo "Executing script" - PACKAGES=$(< /ENVFILE) + PACKAGES=$(/dev/null) || (apt-get install -y --no-install-recommends bash || apk add --no-cache bash) && \ - $(curl --help &>/dev/null) || (apt-get install -y --no-install-recommends curl &>/dev/null || apk add --no-cache curl) && \ - curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ - chmod 777 /automatic_packages.sh && \ - eval /./automatic_packages.sh "$PACKAGES" && \ - rm /automatic_packages.sh - + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/booksonic_air/CHANGELOG.md b/booksonic_air/CHANGELOG.md index 4b13fa069..aba3fdeb2 100644 --- a/booksonic_air/CHANGELOG.md +++ b/booksonic_air/CHANGELOG.md @@ -1,3 +1,8 @@ + +## v2112.1.0-ls38 (12-12-2021) +- Update to latest version from linuxserver/docker-booksonic-air +- New standardized logic for Dockerfile build and packages installation + ## nightly-0.1.0.1024-ls29 (14-11-2021) - Update to latest version from linuxserver/docker-booksonic-air diff --git a/booksonic_air/Dockerfile b/booksonic_air/Dockerfile index 9711c5ce8..d59a90826 100644 --- a/booksonic_air/Dockerfile +++ b/booksonic_air/Dockerfile @@ -1,7 +1,30 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION -FROM linuxserver/booksonic-air:latest -ENV BASHIO_VERSION=0.14.3 +FROM $BUILD_FROM + +################## +# 2 Modify Image # +################## + +ENV BOOKSONIC_AIR_SETTINGS="/data" +RUN \ + # 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 || true + +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps ENV PACKAGES="jq \ curl \ cifs-utils \ @@ -9,38 +32,28 @@ ENV PACKAGES="jq \ samba \ smbclient" -RUN \ - ################ - # Install apps # - ################ - apt-get clean \ - && apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} \ - \ - ################### - # 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 +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE -################# -# Correct image # -################# -RUN \ - # 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 || true +################ +# 4 Entrypoint # +################ -# copy local files -COPY root/ / -ENV BOOKSONIC_AIR_SETTINGS="/data" +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/booksonic_air/build.json b/booksonic_air/build.json new file mode 100644 index 000000000..87f02532c --- /dev/null +++ b/booksonic_air/build.json @@ -0,0 +1,8 @@ +{ + "build_from": { + "armhf": "linuxserver/booksonic-air:arm32v7-latest", + "armv7": "linuxserver/booksonic-air:arm32v7-latest", + "aarch64": "linuxserver/booksonic-air:arm64v8-latest", + "amd64": "linuxserver/booksonic-air:amd64-latest" + } +} diff --git a/booksonic_air/config.json b/booksonic_air/config.json index 4d717c228..ccdeafa0e 100644 --- a/booksonic_air/config.json +++ b/booksonic_air/config.json @@ -1,6 +1,11 @@ { "apparmor": true, - "arch": ["aarch64", "amd64", "armv7", "armhf"], + "arch": [ + "aarch64", + "amd64", + "armv7", + "armhf" + ], "boot": "auto", "description": "platform for accessing the audibooks you own wherever you are", "devices": [ @@ -35,7 +40,10 @@ "PUID": "0", "PGID": "0" }, - "map": ["share:rw", "media:rw"], + "map": [ + "share:rw", + "media:rw" + ], "name": "Booksonic-air", "options": { "PUID": 0, @@ -50,7 +58,10 @@ "ports_description": { "4040/tcp": "web interface" }, - "privileged": ["SYS_ADMIN", "DAC_READ_SEARCH"], + "privileged": [ + "SYS_ADMIN", + "DAC_READ_SEARCH" + ], "schema": { "PUID": "int", "PGID": "int", @@ -61,8 +72,8 @@ "cifspassword": "str?" }, "slug": "booksonic-air_nas", - "upstream": "v2009.1.0-ls37", + "upstream": "v2112.1.0-ls38", "url": "https://github.com/alexbelgium/hassio-addons", - "version": "v2009.1.0-ls37", + "version": "v2112.1.0-ls38", "webui": "http://[HOST]:[PORT:4040]" } diff --git a/booksonic_air/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/booksonic_air/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/booksonic_air/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/booksonic_air/rootfs/etc/cont-init.d/00-banner.sh b/booksonic_air/rootfs/etc/cont-init.d/00-banner.sh new file mode 100644 index 000000000..54d7d491a --- /dev/null +++ b/booksonic_air/rootfs/etc/cont-init.d/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/booksonic_air/rootfs/etc/cont-init.d/92-local_mounts.sh b/booksonic_air/rootfs/etc/cont-init.d/92-local_mounts.sh new file mode 100644 index 000000000..0920d68bd --- /dev/null +++ b/booksonic_air/rootfs/etc/cont-init.d/92-local_mounts.sh @@ -0,0 +1,32 @@ +#!/usr/bin/with-contenv bashio + +###################### +# MOUNT LOCAL SHARES # +###################### + +# Mount local Share if configured +if bashio::config.has_value 'localdisks'; then + + MOREDISKS=$(bashio::config 'localdisks') + echo "Local Disks mounting..." + + # Separate comma separated values + for disk in ${MOREDISKS//,/ }; do + + # Mount by device as default + devpath=/dev + + # Mount as label + [ ${disk:0:2} != "sd" ] && devpath=/dev/disk/by-label + + # Creates dir + mkdir -p /mnt/$disk + chown -R $(id -u):$(id -g) /mnt/$disk + # Legacy mounting : mount to share if still exists (avoid breaking changes) + [ -d /share/$disk ] && mount $devpath/$disk /share/$disk || true + # Mount + mount $devpath/$disk /mnt/$disk && bashio::log.info "Success! $disk mounted to /mnt/$disk" || (bashio::log.fatal "Unable to mount local drives! Please check the name." && rmdir /mnt/$disk) + + done + +fi diff --git a/booksonic_air/rootfs/etc/cont-init.d/92-smb_mounts.sh b/booksonic_air/rootfs/etc/cont-init.d/92-smb_mounts.sh new file mode 100644 index 000000000..06410e554 --- /dev/null +++ b/booksonic_air/rootfs/etc/cont-init.d/92-smb_mounts.sh @@ -0,0 +1,83 @@ +#!/usr/bin/with-contenv bashio + +######################### +# MOUNT SMB SHARES v1.6 # +######################### +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="" + + # Mount CIFS Share if configured and if Protection Mode is active + echo '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//,/ }; do # Separate comma separated values + + # 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 + + # Data validation + if [[ ! $disk =~ ^.*+[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[/]+.*+$ ]]; then + bashio::log.fatal "The structure of your \"networkdisks\" option : \"$disk\" doesn't seem correct, please use a structure like //123.12.12.12/sharedfolder,//123.12.12.12/sharedfolder2. If you don't use it, you can simply remove the text, this will avoid this error message in the future." + exit 0 + fi + + # 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:-WORKGROUP}"; 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 + + # Messages + if [ $MOUNTED = true ] && [ "mountpoint -q /mnt/$diskname" ]; 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 + # Mounting failed messages + bashio::log.fatal "Error, 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" + bashio::log.fatal "Here is some debugging info :" + + # Provide debugging info + smbclient -V &>/dev/null || apt-get install smbclient || apk add --no-cache samba-client + #smbclient $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + smbclient -L $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + + # Error code + bashio::log.fatal "Error read : $(/dev/null || true + rmdir /mnt/$diskname || true + fi + + done +fi diff --git a/cloudcommander/CHANGELOG.md b/cloudcommander/CHANGELOG.md index 8eaae1bd0..fa5db3ba7 100644 --- a/cloudcommander/CHANGELOG.md +++ b/cloudcommander/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation ## 15.9.11 (09-12-2021) - Update to latest version from coderaiser/cloudcmd diff --git a/cloudcommander/Dockerfile b/cloudcommander/Dockerfile index ce1f64c5b..313535a05 100644 --- a/cloudcommander/Dockerfile +++ b/cloudcommander/Dockerfile @@ -1,6 +1,22 @@ +################# +# 1 Build Image # +################# + ARG BUILD_VERSION FROM coderaiser/cloudcmd:latest -ENV BASHIO_VERSION=0.14.3 + +################## +# 2 Modify Image # +################## + +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps ENV PACKAGES="jq \ cifs-utils \ keyutils \ @@ -8,39 +24,25 @@ ENV PACKAGES="jq \ smbclient \ nginx" -RUN \ - ################ - # Install apps # - ################ - apt-get clean \ - && apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} \ - && apt-get clean \ - \ - ################## - # 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 || true +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE -# Copy root filesystem -COPY rootfs / - -RUN \ - ############### - # Permissions # - ############### - chmod 777 /entrypoint.sh +################ +# 4 Entrypoint # +################ ENTRYPOINT [ "/entrypoint.sh" ] +RUN chmod 777 /entrypoint.sh -VOLUME [ "/data" ] +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/cloudcommander/rootfs/entrypoint.sh b/cloudcommander/rootfs/entrypoint.sh index bf5da4a6c..35ccb7382 100644 --- a/cloudcommander/rootfs/entrypoint.sh +++ b/cloudcommander/rootfs/entrypoint.sh @@ -2,34 +2,6 @@ echo "Starting..." -################################### -# Export all addon options as env # -################################### - -# For all keys in options.json -JSONSOURCE="/data/options.json" - -# Export keys as env variables -echo "All addon options were exported as variables" -mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE}) -for KEYS in ${arr[@]}; do - # export key - VALUE=$(jq .$KEYS ${JSONSOURCE}) - export ${KEYS}=${VALUE//[\"\']/} &>/dev/null -done - -################ -# Set timezone # -################ -if [ ! -z "TZ" ] && [ -f /etc/localtime ]; then - if [ -f /usr/share/zoneinfo/$TZ ]; then - echo "Timezone set from $(cat /etc/timezone) to $TZ" - ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone - else - echo "WARNING : Timezone $TZ is invalid, it will be kept to default value of $(cat /etc/timezone)" - fi -fi - #################### # Starting scripts # #################### diff --git a/cloudcommander/rootfs/scripts/00-aaa_dockerfile_backup.sh b/cloudcommander/rootfs/scripts/00-aaa_dockerfile_backup.sh index 612e26d7e..4f9ed9c51 100644 --- a/cloudcommander/rootfs/scripts/00-aaa_dockerfile_backup.sh +++ b/cloudcommander/rootfs/scripts/00-aaa_dockerfile_backup.sh @@ -1,29 +1,18 @@ #!/bin/bash # If dockerfile failed install manually -if [ ! -f "/usr/bin/bashio" ]; then - echo "Bashio does not exist, executing script" +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null \ - || apk add --no-cache ${PACKAGES} - - ################### - # 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 - + ####################### + # Automatic installer # + ####################### + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/code-server/CHANGELOG.md b/code-server/CHANGELOG.md index a2a2bec9e..9c381e009 100644 --- a/code-server/CHANGELOG.md +++ b/code-server/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation - Allow mounting local drives by label. Just pust the label instead of sda1 for example - Allow mounting of devices up to sdg2 diff --git a/code-server/Dockerfile b/code-server/Dockerfile index e688c934d..6b0e12ed3 100644 --- a/code-server/Dockerfile +++ b/code-server/Dockerfile @@ -1,33 +1,56 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -ENV BASHIO_VERSION=0.14.3 -ENV PACKAGES="jq" -# Install bashio -RUN apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} \ - ################## - # 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 \ - \ +################## +# 2 Modify Image # +################## + +RUN \ # Allow UID and GID setting - && sed -i 's/bash/bashio/g' /etc/cont-init.d/10-adduser \ + 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 \ # MOFIFY DATA PATH && sed -i "s|config|data|g" /etc/services.d/code-server/run \ && sed -i "s|config|data|g" /etc/cont-init.d/30-config -VOLUME [ "/data" ] +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="jq" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/code-server/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/code-server/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/code-server/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/freqtrade/rootfs/etc/cont-init.d/00-banner.sh b/code-server/rootfs/etc/cont-init.d/00-banner.sh similarity index 94% rename from freqtrade/rootfs/etc/cont-init.d/00-banner.sh rename to code-server/rootfs/etc/cont-init.d/00-banner.sh index 31de08e93..0ac294e9a 100644 --- a/freqtrade/rootfs/etc/cont-init.d/00-banner.sh +++ b/code-server/rootfs/etc/cont-init.d/00-banner.sh @@ -1,7 +1,4 @@ #!/usr/bin/with-contenv bashio - -bashio::log.warning "Minimal (advised) system requirements: 2GB RAM, 1GB disk space, 2vCPU" - # ============================================================================== # Displays a simple add-on banner on startup # ============================================================================== diff --git a/code-server/rootfs/etc/cont-init.d/92-local_mounts.sh b/code-server/rootfs/etc/cont-init.d/92-local_mounts.sh new file mode 100644 index 000000000..0920d68bd --- /dev/null +++ b/code-server/rootfs/etc/cont-init.d/92-local_mounts.sh @@ -0,0 +1,32 @@ +#!/usr/bin/with-contenv bashio + +###################### +# MOUNT LOCAL SHARES # +###################### + +# Mount local Share if configured +if bashio::config.has_value 'localdisks'; then + + MOREDISKS=$(bashio::config 'localdisks') + echo "Local Disks mounting..." + + # Separate comma separated values + for disk in ${MOREDISKS//,/ }; do + + # Mount by device as default + devpath=/dev + + # Mount as label + [ ${disk:0:2} != "sd" ] && devpath=/dev/disk/by-label + + # Creates dir + mkdir -p /mnt/$disk + chown -R $(id -u):$(id -g) /mnt/$disk + # Legacy mounting : mount to share if still exists (avoid breaking changes) + [ -d /share/$disk ] && mount $devpath/$disk /share/$disk || true + # Mount + mount $devpath/$disk /mnt/$disk && bashio::log.info "Success! $disk mounted to /mnt/$disk" || (bashio::log.fatal "Unable to mount local drives! Please check the name." && rmdir /mnt/$disk) + + done + +fi diff --git a/code-server/rootfs/etc/cont-init.d/92-smb_mounts.sh b/code-server/rootfs/etc/cont-init.d/92-smb_mounts.sh new file mode 100644 index 000000000..06410e554 --- /dev/null +++ b/code-server/rootfs/etc/cont-init.d/92-smb_mounts.sh @@ -0,0 +1,83 @@ +#!/usr/bin/with-contenv bashio + +######################### +# MOUNT SMB SHARES v1.6 # +######################### +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="" + + # Mount CIFS Share if configured and if Protection Mode is active + echo '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//,/ }; do # Separate comma separated values + + # 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 + + # Data validation + if [[ ! $disk =~ ^.*+[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[/]+.*+$ ]]; then + bashio::log.fatal "The structure of your \"networkdisks\" option : \"$disk\" doesn't seem correct, please use a structure like //123.12.12.12/sharedfolder,//123.12.12.12/sharedfolder2. If you don't use it, you can simply remove the text, this will avoid this error message in the future." + exit 0 + fi + + # 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:-WORKGROUP}"; 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 + + # Messages + if [ $MOUNTED = true ] && [ "mountpoint -q /mnt/$diskname" ]; 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 + # Mounting failed messages + bashio::log.fatal "Error, 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" + bashio::log.fatal "Here is some debugging info :" + + # Provide debugging info + smbclient -V &>/dev/null || apt-get install smbclient || apk add --no-cache samba-client + #smbclient $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + smbclient -L $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + + # Error code + bashio::log.fatal "Error read : $(/dev/null || true + rmdir /mnt/$diskname || true + fi + + done +fi diff --git a/doublecommander/CHANGELOG.md b/doublecommander/CHANGELOG.md index b12ec0716..e283b7b0a 100644 --- a/doublecommander/CHANGELOG.md +++ b/doublecommander/CHANGELOG.md @@ -1,4 +1,6 @@ +- New standardized logic for Dockerfile build and packages installation - Improve SMB mount code to v1.5 ; accepts several network disks separated by commas (//123.12.12.12/share,//123.12.12.12/hello) that are mount to /mnt/$sharename +- Removed full_access and host_network ## 0.8.2-1-ls54 (19-05-2021) diff --git a/doublecommander/Dockerfile b/doublecommander/Dockerfile index de36ad326..52a2f7bd3 100644 --- a/doublecommander/Dockerfile +++ b/doublecommander/Dockerfile @@ -1,39 +1,57 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -ENV BASHIO_VERSION=0.14.3 + +################## +# 2 Modify Image # +################## + +RUN \ + # 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 \ + # MOFIFY DATA PATH + && sed -i "s|config|data|g" /defaults/autostart + +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps ENV PACKAGES="jq \ samba \ smbclient" -# Install bashio -RUN apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} \ - \ - ################## - # 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 \ - \ - # 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 +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE -# copy local files -COPY rootfs/ / +################ +# 4 Entrypoint # +################ -# MOFIFY DATA PATH -RUN sed -i "s|config|data|g" /defaults/autostart +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] -VOLUME [ "/data" ] +############ +# 5 Labels # +########### -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/doublecommander/config.json b/doublecommander/config.json index 574e41e2c..818ff83ee 100644 --- a/doublecommander/config.json +++ b/doublecommander/config.json @@ -7,8 +7,6 @@ "PUID": "0", "PGID": "0" }, - "full_access": true, - "host_network": true, "map": ["backup:rw", "config:rw", "share:rw", "media:rw", "ssl"], "name": "Double commander", "options": { diff --git a/doublecommander/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/doublecommander/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 612e26d7e..4f9ed9c51 100644 --- a/doublecommander/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/doublecommander/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -1,29 +1,18 @@ #!/bin/bash # If dockerfile failed install manually -if [ ! -f "/usr/bin/bashio" ]; then - echo "Bashio does not exist, executing script" +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null \ - || apk add --no-cache ${PACKAGES} - - ################### - # 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 - + ####################### + # Automatic installer # + ####################### + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/elasticsearch/CHANGELOG.md b/elasticsearch/CHANGELOG.md index 68dde260e..4a854f7ea 100644 --- a/elasticsearch/CHANGELOG.md +++ b/elasticsearch/CHANGELOG.md @@ -1 +1,2 @@ +- New standardized logic for Dockerfile build and packages installation - Initial build diff --git a/elasticsearch/Dockerfile b/elasticsearch/Dockerfile index d81ec0132..c055b89c2 100644 --- a/elasticsearch/Dockerfile +++ b/elasticsearch/Dockerfile @@ -1,21 +1,39 @@ +################# +# 1 Build Image # +################# + ARG BUILD_UPSTREAM="7.14.2" FROM elasticsearch:$BUILD_UPSTREAM +################## +# 2 Modify Image # +################## + # Data persistence RUN sed -i '5a echo "Data location moved. Please wait while elasticsearch starts..."' /usr/local/bin/docker-entrypoint.sh \ -&& sed -i '5a chown -R $(id -u):$(id -g) $HOME' /usr/local/bin/docker-entrypoint.sh \ -&& sed -i '5a done' /usr/local/bin/docker-entrypoint.sh \ -&& sed -i '5a ln -s $NEWHOME/$files /usr/share/elasticsearch || true' /usr/local/bin/docker-entrypoint.sh \ -&& sed -i '5a rm -r /usr/share/elasticsearch/$files || true' /usr/local/bin/docker-entrypoint.sh \ -&& sed -i '5a cp -rn /usr/share/elasticsearch/$files $NEWHOME || true' /usr/local/bin/docker-entrypoint.sh \ -&& sed -i '5a for files in "data" "config"; do' /usr/local/bin/docker-entrypoint.sh \ -&& sed -i '5a mkdir -p $NEWHOME' /usr/local/bin/docker-entrypoint.sh \ -&& sed -i '5a NEWHOME="/data"' /usr/local/bin/docker-entrypoint.sh + && sed -i '5a chown -R $(id -u):$(id -g) $HOME' /usr/local/bin/docker-entrypoint.sh \ + && sed -i '5a done' /usr/local/bin/docker-entrypoint.sh \ + && sed -i '5a ln -s $NEWHOME/$files /usr/share/elasticsearch || true' /usr/local/bin/docker-entrypoint.sh \ + && sed -i '5a rm -r /usr/share/elasticsearch/$files || true' /usr/local/bin/docker-entrypoint.sh \ + && sed -i '5a cp -rn /usr/share/elasticsearch/$files $NEWHOME || true' /usr/local/bin/docker-entrypoint.sh \ + && sed -i '5a for files in "data" "config"; do' /usr/local/bin/docker-entrypoint.sh \ + && sed -i '5a mkdir -p $NEWHOME' /usr/local/bin/docker-entrypoint.sh \ + && sed -i '5a NEWHOME="/data"' /usr/local/bin/docker-entrypoint.sh \ + # Install plugins + && /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch ingest-attachment -# Install plugins -RUN /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch ingest-attachment +################## +# 3 Install apps # +################## + +################ +# 4 Entrypoint # +################ + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/elasticsearch/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/elasticsearch/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/elasticsearch/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/elasticsearch/rootfs/etc/cont-init.d/00-banner.sh b/elasticsearch/rootfs/etc/cont-init.d/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/elasticsearch/rootfs/etc/cont-init.d/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/emby/CHANGELOG.md b/emby/CHANGELOG.md index 133d6b9f0..f4799200a 100644 --- a/emby/CHANGELOG.md +++ b/emby/CHANGELOG.md @@ -1,4 +1,8 @@ +## 4.7.0.19 (14-12-2021) +- Update to latest version from linuxserver/docker-emby +- New standardized logic for Dockerfile build and packages installation + ## 4.7.0.18 (20-11-2021) - Update to latest version from linuxserver/docker-emby diff --git a/emby/Dockerfile b/emby/Dockerfile index eb999b6f9..f4e4d2212 100644 --- a/emby/Dockerfile +++ b/emby/Dockerfile @@ -1,18 +1,18 @@ -############### -# Build Image # -############### +################# +# 1 Build Image # +################# ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -################ -# Modify Image # -################ +################## +# 2 Modify Image # +################## # Set shell SHELL ["/bin/bash", "-o", "pipefail", "-c"] - + RUN \ # Allow UID and GID setting sed -i 's/bash/bashio/g' /etc/cont-init.d/10-adduser \ @@ -24,9 +24,9 @@ RUN \ && sed -i "s|/config|/emby|g" /etc/services.d/emby/run \ && sed -i "s|/config|/emby|g" /etc/cont-init.d/30-config -################ -# Install apps # -################ +################## +# 3 Install apps # +################## # Copy local files COPY rootfs/ / @@ -34,20 +34,20 @@ COPY rootfs/ / ENV PACKAGES="" # Automatic apps & bashio -RUN $(ls /bin/bash &>/dev/null) || (apt-get install -y --no-install-recommends bash || apk add --no-cache bash) && \ - $(curl --help &>/dev/null) || (apt-get install -y --no-install-recommends curl || apk add --no-cache curl) && \ +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ chmod 777 /automatic_packages.sh && \ /automatic_packages.sh "${PACKAGES:-}" && \ rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE -############## -# Entrypoint # -############## +################ +# 4 Entrypoint # +################ -########## -# Labels # -########## +############ +# 5 Labels # +############ ARG BUILD_ARCH ARG BUILD_DATE diff --git a/emby/config.json b/emby/config.json index 1b12a521f..387161af2 100644 --- a/emby/config.json +++ b/emby/config.json @@ -1,6 +1,11 @@ { "apparmor": true, - "arch": ["aarch64", "amd64", "armv7", "armhf"], + "arch": [ + "aarch64", + "amd64", + "armv7", + "armhf" + ], "backup_exclude": [ "*/cache/", "*/logs/", @@ -47,7 +52,12 @@ "/dev/nvme1", "/dev/nvme2" ], - "map": ["config:rw", "share:rw", "media:rw", "ssl:rw"], + "map": [ + "config:rw", + "share:rw", + "media:rw", + "ssl:rw" + ], "name": "Emby NAS", "options": { "PUID": 0, @@ -66,7 +76,10 @@ "7359/udp": "udp server discover (optional)", "1900/udp": "dlna (optional)" }, - "privileged": ["SYS_ADMIN", "DAC_READ_SEARCH"], + "privileged": [ + "SYS_ADMIN", + "DAC_READ_SEARCH" + ], "schema": { "PUID": "int", "PGID": "int", @@ -81,9 +94,9 @@ }, "slug": "emby_nas", "startup": "services", - "upstream": "4.7.0.18", + "upstream": "4.7.0.19", "url": "https://github.com/alexbelgium/hassio-addons", - "version": "4.7.0.18", + "version": "4.7.0.19", "video": true, "webui": "http://[HOST]:[PORT:8096]" } diff --git a/emby/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/emby/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index e33f7f063..4f9ed9c51 100644 --- a/emby/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/emby/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -2,18 +2,17 @@ # If dockerfile failed install manually if [ -e "/ENVFILE" ]; then echo "Executing script" - PACKAGES=$(< /ENVFILE) + PACKAGES=$(/dev/null) || (apt-get install -y --no-install-recommends bash || apk add --no-cache bash) && \ - $(curl --help &>/dev/null) || (apt-get install -y --no-install-recommends curl &>/dev/null || apk add --no-cache curl) && \ - curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ - chmod 777 /automatic_packages.sh && \ - eval /./automatic_packages.sh "$PACKAGES" && \ - rm /automatic_packages.sh - + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/enedisgateway2mqtt/CHANGELOG.md b/enedisgateway2mqtt/CHANGELOG.md index 7e58b69e4..ebcb0ed9a 100644 --- a/enedisgateway2mqtt/CHANGELOG.md +++ b/enedisgateway2mqtt/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation ## 0.7.7 (25-11-2021) - Update to latest version from m4dm4rtig4n/enedisgateway2mqtt diff --git a/enedisgateway2mqtt/Dockerfile b/enedisgateway2mqtt/Dockerfile index 972b8a860..5978c4eb9 100644 --- a/enedisgateway2mqtt/Dockerfile +++ b/enedisgateway2mqtt/Dockerfile @@ -1,43 +1,48 @@ +################# +# 1 Build Image # +################# + ARG BUILD_UPSTREAM="0.7.7" FROM m4dm4rtig4n/enedisgateway2mqtt:$BUILD_UPSTREAM -# Base system -ENV BASHIO_VERSION=0.14.3 + +################## +# 2 Modify Image # +################## + +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps ENV PACKAGES="jq \ curl \ yamllint" -# Copy root filesystem -COPY rootfs / -VOLUME [ "/config" ] +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE -RUN \ - ################ - # Install apps # - ################ - apt-get clean \ - && apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} \ - && apt-get clean \ - \ - ################## - # 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 || true - -#RUN ln -snf /usr/share/zoneinfo/Europe/Paris /etc/localtime +################ +# 4 Entrypoint # +################ RUN chmod 777 /entrypoint.sh ENTRYPOINT [ "/usr/bin/env" ] CMD ["/entrypoint.sh"] VOLUME [ "/data" ] -### LABELS +############ +# 5 Labels # +############ + ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/enedisgateway2mqtt/rootfs/scripts/00-aaa_dockerfile_backup.sh b/enedisgateway2mqtt/rootfs/scripts/00-aaa_dockerfile_backup.sh index 612e26d7e..4f9ed9c51 100644 --- a/enedisgateway2mqtt/rootfs/scripts/00-aaa_dockerfile_backup.sh +++ b/enedisgateway2mqtt/rootfs/scripts/00-aaa_dockerfile_backup.sh @@ -1,29 +1,18 @@ #!/bin/bash # If dockerfile failed install manually -if [ ! -f "/usr/bin/bashio" ]; then - echo "Bashio does not exist, executing script" +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null \ - || apk add --no-cache ${PACKAGES} - - ################### - # 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 - + ####################### + # Automatic installer # + ####################### + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/enedisgateway2mqtt_dev/CHANGELOG.md b/enedisgateway2mqtt_dev/CHANGELOG.md index 60dfdf4ce..ad16f6e6b 100644 --- a/enedisgateway2mqtt_dev/CHANGELOG.md +++ b/enedisgateway2mqtt_dev/CHANGELOG.md @@ -1,4 +1,5 @@ -- Always aligned with dev versions +- New standardized logic for Dockerfile build and packages installation +- Always aligned with dev versions ## 0.7.8-dev (23-11-2021) - Update to latest version from m4dm4rtig4n/enedisgateway2mqtt diff --git a/enedisgateway2mqtt_dev/Dockerfile b/enedisgateway2mqtt_dev/Dockerfile index 681525dee..9c45b66d8 100644 --- a/enedisgateway2mqtt_dev/Dockerfile +++ b/enedisgateway2mqtt_dev/Dockerfile @@ -1,43 +1,48 @@ +################# +# 1 Build Image # +################# + ARG BUILD_UPSTREAM="0.7.8-dev" FROM m4dm4rtig4n/enedisgateway2mqtt:$BUILD_UPSTREAM -# Base system -ENV BASHIO_VERSION=0.14.3 -# Copy root filesystem -COPY rootfs / -VOLUME [ "/config" ] +################## +# 2 Modify Image # +################## -RUN \ - ################ - # Install apps # - ################ - apt-get clean \ - && apt-get update \ - && apt-get install -y \ - jq \ +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="jq \ curl \ - yamllint \ - && apt-get clean \ - \ - ################## - # 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 || true + yamllint" -#RUN ln -snf /usr/share/zoneinfo/Europe/Paris /etc/localtime +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ RUN chmod 777 /entrypoint.sh ENTRYPOINT [ "/usr/bin/env" ] CMD ["/entrypoint.sh"] VOLUME [ "/data" ] -### LABELS +############ +# 5 Labels # +############ + ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/enedisgateway2mqtt_dev/rootfs/scripts/00-aaa_dockerfile_backup.sh b/enedisgateway2mqtt_dev/rootfs/scripts/00-aaa_dockerfile_backup.sh index 3b3b8653f..4f9ed9c51 100644 --- a/enedisgateway2mqtt_dev/rootfs/scripts/00-aaa_dockerfile_backup.sh +++ b/enedisgateway2mqtt_dev/rootfs/scripts/00-aaa_dockerfile_backup.sh @@ -1,30 +1,18 @@ #!/bin/bash # If dockerfile failed install manually -if [ ! -f "/usr/bin/bashio" ]; then - echo "Bashio does not exist, executing script" +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/filebrowser/CHANGELOG.md b/filebrowser/CHANGELOG.md index cc3ce0608..055941e08 100644 --- a/filebrowser/CHANGELOG.md +++ b/filebrowser/CHANGELOG.md @@ -1,4 +1,5 @@ - Mount ssl in write +- New standardized logic for Dockerfile build and packages installation - Mount nvme drives ## 2.19.0 (25-11-2021) diff --git a/filebrowser/Dockerfile b/filebrowser/Dockerfile index 5cc2047d4..c534ff683 100644 --- a/filebrowser/Dockerfile +++ b/filebrowser/Dockerfile @@ -1,8 +1,27 @@ +################# +# 1 Build Image # +################# + ARG BUILD_VERSION ARG BUILD_UPSTREAM="2.19.0" FROM hurlenko/filebrowser:v${BUILD_UPSTREAM} -ENV BASHIO_VERSION=0.14.3 +################## +# 2 Modify Image # +################## + +RUN \ + # Correct upstream image folders links + mkdir -p -m 777 /config/filebrowser + +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps ENV PACKAGES="curl \ jq \ bash \ @@ -13,30 +32,17 @@ ENV PACKAGES="curl \ bind-tools \ nginx" -RUN \ - ################ - # Install apps # - ################ - apk add --no-cache ${PACKAGES} \ - \ - ################## - # 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 || true +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE -RUN \ - ######################################## - # Correct upstream image folders links # - ######################################## - mkdir -p -m 777 /config/filebrowser - -# Copy root filesystem -COPY rootfs / +################ +# 4 Entrypoint # +################ VOLUME [ "/data" ] WORKDIR / @@ -44,8 +50,10 @@ RUN chmod 777 /entrypoint.sh ENTRYPOINT [ "/usr/bin/env" ] CMD [ "/entrypoint.sh" ] +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/filebrowser/rootfs/entrypoint.sh b/filebrowser/rootfs/entrypoint.sh index bf5da4a6c..35ccb7382 100644 --- a/filebrowser/rootfs/entrypoint.sh +++ b/filebrowser/rootfs/entrypoint.sh @@ -2,34 +2,6 @@ echo "Starting..." -################################### -# Export all addon options as env # -################################### - -# For all keys in options.json -JSONSOURCE="/data/options.json" - -# Export keys as env variables -echo "All addon options were exported as variables" -mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE}) -for KEYS in ${arr[@]}; do - # export key - VALUE=$(jq .$KEYS ${JSONSOURCE}) - export ${KEYS}=${VALUE//[\"\']/} &>/dev/null -done - -################ -# Set timezone # -################ -if [ ! -z "TZ" ] && [ -f /etc/localtime ]; then - if [ -f /usr/share/zoneinfo/$TZ ]; then - echo "Timezone set from $(cat /etc/timezone) to $TZ" - ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone - else - echo "WARNING : Timezone $TZ is invalid, it will be kept to default value of $(cat /etc/timezone)" - fi -fi - #################### # Starting scripts # #################### diff --git a/filebrowser/rootfs/scripts/00-aaa_dockerfile_backup.sh b/filebrowser/rootfs/scripts/00-aaa_dockerfile_backup.sh index 612e26d7e..4f9ed9c51 100644 --- a/filebrowser/rootfs/scripts/00-aaa_dockerfile_backup.sh +++ b/filebrowser/rootfs/scripts/00-aaa_dockerfile_backup.sh @@ -1,29 +1,18 @@ #!/bin/bash # If dockerfile failed install manually -if [ ! -f "/usr/bin/bashio" ]; then - echo "Bashio does not exist, executing script" +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null \ - || apk add --no-cache ${PACKAGES} - - ################### - # 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 - + ####################### + # Automatic installer # + ####################### + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/flexget/CHANGELOG.md b/flexget/CHANGELOG.md index 33f9cca8c..38bbbc8cd 100644 --- a/flexget/CHANGELOG.md +++ b/flexget/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation ## 3.2.4 (08-12-2021) - Update to latest version from flexget/flexget diff --git a/flexget/Dockerfile b/flexget/Dockerfile index ba057483f..f8c07b5f8 100644 --- a/flexget/Dockerfile +++ b/flexget/Dockerfile @@ -1,32 +1,18 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION FROM wiserain/flexget:latest -ENV BASHIO_VERSION=0.14.3 + +################## +# 2 Modify Image # +################## RUN \ - ################## - # Install apps # - ################## - apk add --no-cache \ - jq \ - curl \ - cifs-utils \ - \ - ################## - # 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 \ - \ - ############### - # Adapt image # - ############### # Allow UID and GID setting - && sed -i 's/bash/bashio/g' /etc/cont-init.d/10-adduser \ + 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 \ \ @@ -40,9 +26,40 @@ RUN \ && sed -i 's/# set FG_WEBUI_PASSWD/if bashio::config.has_value "WebuiPass"; then FG_WEBUI_PASSWD=$(bashio::config "WebuiPass"); fi/g' /etc/cont-init.d/20-config \ && sed -i 's/# install custom plugins/if bashio::config.has_value "FG_PLUGINS"; then FG_PLUGINS=$(bashio::config "FG_PLUGINS"); fi/g' /etc/cont-init.d/20-config -VOLUME [ "/data" ] +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="jq \ + curl \ + cifs-utils" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE] + +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/flexget/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/flexget/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/flexget/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/flexget/rootfs/etc/cont-init.d/00-banner.sh b/flexget/rootfs/etc/cont-init.d/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/flexget/rootfs/etc/cont-init.d/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/flexget/rootfs/etc/cont-init.d/00-folders.sh b/flexget/rootfs/etc/cont-init.d/00-folders.sh new file mode 100644 index 000000000..6e8bb9452 --- /dev/null +++ b/flexget/rootfs/etc/cont-init.d/00-folders.sh @@ -0,0 +1,3 @@ +#!/usr/bin/with-contenv bashio + +mkdir -p /config/flexget diff --git a/freqtrade/CHANGELOG.md b/freqtrade/CHANGELOG.md deleted file mode 100644 index a9215ab42..000000000 --- a/freqtrade/CHANGELOG.md +++ /dev/null @@ -1,7 +0,0 @@ - -## 2021.11 (27-11-2021) -- Update to latest version from freqtrade/freqtrade - -## 2021.10 (29-10-2021) -- Update to latest version from freqtrade/freqtrade -- Initial release diff --git a/freqtrade/Dockerfile b/freqtrade/Dockerfile deleted file mode 100644 index e34085015..000000000 --- a/freqtrade/Dockerfile +++ /dev/null @@ -1,68 +0,0 @@ -ARG BUILD_FROM -ARG BUILD_VERSION -FROM freqtradeorg/freqtrade:latest -ENV BASHIO_VERSION=0.14.3 -ENV PACKAGES="jq git" - -USER root -COPY rootfs / - -RUN \ - ################ - # Install apps # - ################ - apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} \ - \ - ################### - # 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 || true - -VOLUME [ "/data" ] -WORKDIR / -RUN chmod 777 /entrypoint.sh -ENTRYPOINT [ "/bin/bash" ] -CMD [ "/entrypoint.sh" ] - -# use /data instead of /config for hass.io environment -# && sed -i "s|/config|/share/freqtrade|g" /etc/services.d/freqtrade/run \ -#&& sed -i "s|/config|/share/freqtrade|g" /etc/cont-init.d/50-config \ -#&& sed -i "s|/share/freqtrade/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 - -### 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} diff --git a/freqtrade/Readme.md b/freqtrade/Readme.md deleted file mode 100644 index b0202726a..000000000 --- a/freqtrade/Readme.md +++ /dev/null @@ -1 +0,0 @@ -EXPERIMENTAL - DO NOT USE diff --git a/freqtrade/apparmor.txt b/freqtrade/apparmor.txt deleted file mode 100644 index 9efe66c73..000000000 --- a/freqtrade/apparmor.txt +++ /dev/null @@ -1,48 +0,0 @@ -#include - -profile freqtrade_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/freqtrade/config.json b/freqtrade/config.json deleted file mode 100644 index eb39790ac..000000000 --- a/freqtrade/config.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "apparmor": true, - "arch": [ - "aarch64", - "amd64", - "armv7", - "armhf" - ], - "boot": "auto", - "description": "Simple High frequency trading bot for crypto currencies ", - "devices": [], - "environment": {}, - "map": [ - "share:rw" - ], - "name": "freqtrade web server - DO NOT USE", - "options": {}, - "ports": { - "8080/tcp": 9711 - }, - "ports_description": { - "8080/tcp": "web interface" - }, - "privileged": [], - "schema": {}, - "slug": "freqtrade", - "upstream": "2021.11", - "url": "https://github.com/alexbelgium/hassio-addons", - "version": "2021.11", - "webui": "http://[HOST]:[PORT:80]" -} diff --git a/freqtrade/icon.png b/freqtrade/icon.png deleted file mode 100644 index 4bcfb31391455cc0d25794def99be0ae0eb841e6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 21368 zcmZ@=WmHgIvp#fp3X&qA64KouA}x(Hh)Q=iC=Cj}bc0HWC?Q=UC8>ZY-6`FDhwuMg z%le_G_TDp3jgcB^iUhbcxCnv}C_R*a48MbI!552egPA+zq)Rsovu)F=Fvd@@$(`#LyE%|MU98I_mVBk~V zH){z(LBst2|3F3m=+Pr|gcKnO%AtHi#cZ+s#T)b7%r6EH4HbEeN4*yy*g+kEjZ_AX zxc=ulC5wh~ziZ^23DM}a=7Y-)TF!UG+7As4;Sth_4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N(>5v3|BVl-dd_YV}Wu=C0#U$0>6KWJ+*xW1a}_{@H`7 zV(#!*VwUHp4E8$2a7FyWYjtQ-U?#&3(W;vWOA&~HBZ4|n@2ORp%QSvZ=hm_O+9Db2 z(l-S*%T_0*5%?Il616A13|V=VAVQ1w-*k3@!3; z_H3sQPgheeXq7CAn$T8Kou1`>u76>T}F75M=*%WYvX9aA+GtP(@Ji$pfwS* zUPq(R7SK$UZMR?2fARx4w`S_J) z-&7iT*zcwy6j>gC!v4(v$($>jR;s&cJ|bdw^|A8PPd~L^F9D z3yAtS^?VAN;_eDAux;I0*CMJxNS}K^4%$Z|HrzSho}bSGL48}$r5HZL*c;2~v?fwA z{`u&god#HtXMFltXI9Vk5VrT%5MRu#*Jo5}dMzb#+fX8KX;y_T-~-OqsNtjjzjc*? c8(G_aOHw|sKF(2%jhZBTYe&ihOP~1v0M@RWnE(I) diff --git a/freqtrade/logo.png b/freqtrade/logo.png deleted file mode 100644 index 4bcfb31391455cc0d25794def99be0ae0eb841e6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 21368 zcmZ@=WmHgIvp#fp3X&qA64KouA}x(Hh)Q=iC=Cj}bc0HWC?Q=UC8>ZY-6`FDhwuMg z%le_G_TDp3jgcB^iUhbcxCnv}C_R*a48MbI!552egPA+zq)Rsovu)F=Fvd@@$(`#LyE%|MU98I_mVBk~V zH){z(LBst2|3F3m=+Pr|gcKnO%AtHi#cZ+s#T)b7%r6EH4HbEeN4*yy*g+kEjZ_AX zxc=ulC5wh~ziZ^23DM}a=7Y-)TF!UG+7As4;Sth_4i}Y||H^v(dOMM$$2N{m>~QbL zfA_AE6BAt@Ym#3Y-!W>(#ILlDK%6$JMwi~df8XR-WoTUZ+e}g+>1k9{)Y!;7<>c@h z@4~bRZiw2 zdup&$;L;|Rgj-yT5L@=5asOl&6g*5{9s0nQGqz*iB3%-WAY`m6E0z_1e<194U&to> zXujW3jA-cU{`M_iA~lOCBdBz_kHkb23=a>xZ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@Ji$pfwS* zUPq(R7SK$UZMR?2fARx4w`S_J) z-&7iT*zcwy6j>gC!v4(v$($>jR;s&cJ|bdw^|A8PPd~L^F9D z3yAtS^?VAN;_eDAux;I0*CMJxNS}K^4%$Z|HrzSho}bSGL48}$r5HZL*c;2~v?fwA z{`u&god#HtXMFltXI9Vk5VrT%5MRu#*Jo5}dMzb#+fX8KX;y_T-~-OqsNtjjzjc*? c8(G_aOHw|sKF(2%jhZBTYe&ihOP~1v0M@RWnE(I) diff --git a/freqtrade/rootfs/entrypoint.sh b/freqtrade/rootfs/entrypoint.sh deleted file mode 100644 index 165ffe1bb..000000000 --- a/freqtrade/rootfs/entrypoint.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -echo "Starting" - -if [ ! -f /data/config.json ]; then - echo "building userdir" - freqtrade create-userdir --userdir /data - echo "building initial config" - freqtrade new-config --config /data/config.json -fi - -sleep 5000000 - -echo "Starting app" -freqtrade trade --logfile /data/logs/freqtrade.log --db-url sqlite://///data/tradesv3.sqlite --config /data/config.json --strategy SampleStrategy diff --git a/freqtrade/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/freqtrade/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh deleted file mode 100644 index 612e26d7e..000000000 --- a/freqtrade/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# If dockerfile failed install manually -if [ ! -f "/usr/bin/bashio" ]; then - echo "Bashio does not exist, executing script" - ( - ################ - # Install apps # - ################ - PACKAGES="${PACKAGES:="curl"}" - - apt-get clean \ - && apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} 2>/dev/null \ - || apk add --no-cache ${PACKAGES} - - ################### - # 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 - - ) >/dev/null - -fi diff --git a/gazpar2mqtt/CHANGELOG.md b/gazpar2mqtt/CHANGELOG.md index b42a9154c..680183a93 100644 --- a/gazpar2mqtt/CHANGELOG.md +++ b/gazpar2mqtt/CHANGELOG.md @@ -1,4 +1,11 @@ +## 0.6.1 (14-12-2021) +- Update to latest version from yukulehe/gazpar2mqtt +- New standardized logic for Dockerfile build and packages installation + +## 0.6 (11-12-2021) +- Update to latest version from yukulehe/gazpar2mqtt + ## 0.5.3 (07-12-2021) - Update to latest version from yukulehe/gazpar2mqtt - mqtt autodiscover added diff --git a/gazpar2mqtt/Dockerfile b/gazpar2mqtt/Dockerfile index e753dcc94..9f0ed1c6a 100644 --- a/gazpar2mqtt/Dockerfile +++ b/gazpar2mqtt/Dockerfile @@ -1,40 +1,38 @@ +################# +# 1 Build Image # +################# + FROM yukulehe/gazpar2mqtt:latest -# Base system -ENV BASHIO_VERSION=0.14.3 +################## +# 2 Modify Image # +################## + ENV TZ=Europe/Paris + +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps ENV PACKAGES="jq \ curl \ yamllint" -# Copy root filesystem -COPY rootfs / +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE -RUN \ - ################ - # Install apps # - ################ - apt-get clean \ - && apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} \ - && apt-get clean \ - \ - ################## - # 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 || true - -RUN \ - ################# - # Copy template # - ################# - mkdir -p /share/gazpar2mqtt \ - && cp -n /templates/config.yaml /share/gazpar2mqtt/ +################ +# 4 Entrypoint # +################ RUN chmod 777 /entrypoint.sh ENTRYPOINT [ "/usr/bin/env" ] @@ -42,7 +40,10 @@ CMD ["/entrypoint.sh"] VOLUME [ "/data" ] VOLUME [ "/share" ] -### LABELS +############ +# 5 Labels # +############ + ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/gazpar2mqtt/config.json b/gazpar2mqtt/config.json index af5a8da13..d521a7b64 100644 --- a/gazpar2mqtt/config.json +++ b/gazpar2mqtt/config.json @@ -25,7 +25,7 @@ "mqtt:want" ], "slug": "gazpar2mqtt", - "upstream": "0.5.3", + "upstream": "0.6.1", "url": "https://github.com/alexbelgium/hassio-addons", - "version": "0.5.3" + "version": "0.6.1" } diff --git a/gazpar2mqtt/rootfs/entrypoint.sh b/gazpar2mqtt/rootfs/entrypoint.sh index bf5da4a6c..35ccb7382 100644 --- a/gazpar2mqtt/rootfs/entrypoint.sh +++ b/gazpar2mqtt/rootfs/entrypoint.sh @@ -2,34 +2,6 @@ echo "Starting..." -################################### -# Export all addon options as env # -################################### - -# For all keys in options.json -JSONSOURCE="/data/options.json" - -# Export keys as env variables -echo "All addon options were exported as variables" -mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE}) -for KEYS in ${arr[@]}; do - # export key - VALUE=$(jq .$KEYS ${JSONSOURCE}) - export ${KEYS}=${VALUE//[\"\']/} &>/dev/null -done - -################ -# Set timezone # -################ -if [ ! -z "TZ" ] && [ -f /etc/localtime ]; then - if [ -f /usr/share/zoneinfo/$TZ ]; then - echo "Timezone set from $(cat /etc/timezone) to $TZ" - ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone - else - echo "WARNING : Timezone $TZ is invalid, it will be kept to default value of $(cat /etc/timezone)" - fi -fi - #################### # Starting scripts # #################### diff --git a/gazpar2mqtt/rootfs/scripts/00-aaa_dockerfile_backup.sh b/gazpar2mqtt/rootfs/scripts/00-aaa_dockerfile_backup.sh index 612e26d7e..4f9ed9c51 100644 --- a/gazpar2mqtt/rootfs/scripts/00-aaa_dockerfile_backup.sh +++ b/gazpar2mqtt/rootfs/scripts/00-aaa_dockerfile_backup.sh @@ -1,29 +1,18 @@ #!/bin/bash # If dockerfile failed install manually -if [ ! -f "/usr/bin/bashio" ]; then - echo "Bashio does not exist, executing script" +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null \ - || apk add --no-cache ${PACKAGES} - - ################### - # 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 - + ####################### + # Automatic installer # + ####################### + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/gazpar2mqtt/rootfs/scripts/92-config_yaml.sh b/gazpar2mqtt/rootfs/scripts/92-config_yaml.sh index 8d94b196e..e37468ce2 100644 --- a/gazpar2mqtt/rootfs/scripts/92-config_yaml.sh +++ b/gazpar2mqtt/rootfs/scripts/92-config_yaml.sh @@ -83,7 +83,8 @@ while IFS= read -r line; do if [[ $line =~ ^.+[=].+$ ]]; then export $line # Export the variable - sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || sed -i "1a export $line" /scripts/*run* + sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || true + sed -i "1a export $line" /scripts/*run* 2>/dev/null || true # Show in log bashio::log.blue "$line" else diff --git a/grav/CHANGELOG.md b/grav/CHANGELOG.md index 568208d3b..310f4da25 100644 --- a/grav/CHANGELOG.md +++ b/grav/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation ## 1.7.25 (17-11-2021) - Update to latest version from linuxserver/docker-grav diff --git a/grav/Dockerfile b/grav/Dockerfile index 0c9794c1b..4c41ea309 100644 --- a/grav/Dockerfile +++ b/grav/Dockerfile @@ -1,33 +1,18 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -ENV BASHIO_VERSION=0.14.3 -ENV PACKAGES="jq \ - curl \ - cifs-utils \ - keyutils \ - samba \ - samba-client" + +################## +# 2 Modify Image # +################## RUN \ - ################ - # Install apps # - ################ - apk add --no-cache ${PACKAGES} \ - \ - ################### - # 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|/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 @@ -35,10 +20,37 @@ RUN \ && 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/ / +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="jq \ + curl \ + cifs-utils \ + keyutils \ + samba \ + samba-client" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/grav/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/grav/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/grav/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/grav/rootfs/etc/cont-init.d/00-banner.sh b/grav/rootfs/etc/cont-init.d/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/grav/rootfs/etc/cont-init.d/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/freqtrade/rootfs/etc/cont-init.d/00-ha-env b/grav/rootfs/etc/cont-init.d/00-ha-env similarity index 100% rename from freqtrade/rootfs/etc/cont-init.d/00-ha-env rename to grav/rootfs/etc/cont-init.d/00-ha-env diff --git a/grav/rootfs/etc/cont-init.d/20-folders b/grav/rootfs/etc/cont-init.d/20-folders new file mode 100644 index 000000000..5cf2a6207 --- /dev/null +++ b/grav/rootfs/etc/cont-init.d/20-folders @@ -0,0 +1,12 @@ +#!/usr/bin/with-contenv bashio + +echo "Updating folders..." + +for FOLDERS in "/share/grav" "/app/grav-admin/backup" +do + echo "... $FOLDERS" + mkdir -p $FOLDERS + chown -R abc:abc $FOLDERS +done + +bashio::log.warning "If error of missing folder when loading addon, just restart" diff --git a/inadyn/Dockerfile b/inadyn/Dockerfile index a7006b9c4..1af09a4f2 100644 --- a/inadyn/Dockerfile +++ b/inadyn/Dockerfile @@ -1,39 +1,44 @@ +################# +# 1 Build Image # +################# + FROM troglobit/inadyn:latest -# Base system -ENV BASHIO_VERSION=0.14.3 -ARG BUILD_ARCH +################## +# 2 Modify Image # +################## +ARG BUILD_ARCH ENV LANG='C.UTF-8'\ TERM='xterm-256color'\ GOPATH='/opt/go' + +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps ENV PACKAGES="curl \ jq \ bash \ - xz build-base libressl-dev ca-certificates npm" + build-base libressl-dev ca-certificates npm" -RUN \ - ################ - # Install apps # - ################ - apk add --no-cache ${PACKAGES} \ - \ - ################## - # 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 \ - \ - #################### - # Install mustache # - #################### - && apk add --no-cache \ +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +# Install mustache +RUN apk add --no-cache \ go \ npm \ + xz \ # && npm install mustache-cli --global && apk upgrade --no-cache &&\ apk add --no-cache --virtual .build-deps\ @@ -43,19 +48,22 @@ RUN \ go get -u github.com/quantumew/mustache-cli &&\ cp $GOPATH/bin/* /usr/bin/ && \ rm -rf $GOPATH /var/cache/apk/* /tmp/src &&\ - apk del .build-deps xz build-base + apk del .build-deps xz build-base || true -# Copy root filesystem -COPY rootfs / +################ +# 4 Entrypoint # +################ WORKDIR / -RUN chmod 777 /run.sh +RUN chmod 777 /entrypoint.sh ENTRYPOINT [ "/usr/bin/env" ] -CMD [ "/run.sh" ] - +CMD [ "/entrypoint.sh" ] VOLUME [ "/data" ] -### LABELS +############ +# 5 Labels # +############ + ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/inadyn/rootfs/entrypoint.sh b/inadyn/rootfs/entrypoint.sh new file mode 100644 index 000000000..35ccb7382 --- /dev/null +++ b/inadyn/rootfs/entrypoint.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +echo "Starting..." + +#################### +# Starting scripts # +#################### + +cd / +for SCRIPTS in scripts/*; do + [ -e "$SCRIPTS" ] || continue + echo "$SCRIPTS: executing" + chown $(id -u):$(id -g) $SCRIPTS + chmod a+x $SCRIPTS + sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' $SCRIPTS || true + ./$SCRIPTS || echo "$SCRIPTS: exiting $?" +done diff --git a/inadyn/rootfs/scripts/00-aaa_dockerfile_backup.sh b/inadyn/rootfs/scripts/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/inadyn/rootfs/scripts/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/inadyn/rootfs/scripts/00-banner.sh b/inadyn/rootfs/scripts/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/inadyn/rootfs/scripts/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/inadyn/rootfs/scripts/99-run.sh b/inadyn/rootfs/scripts/99-run.sh new file mode 100644 index 000000000..b47224a94 --- /dev/null +++ b/inadyn/rootfs/scripts/99-run.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bashio + +################# +# Create config # +################# +mustache-cli /data/options.json /templates/inadyn.mustache >/etc/inadyn.conf + +############## +# Launch App # +############## +/usr/sbin/inadyn --foreground diff --git a/jackett/CHANGELOG.md b/jackett/CHANGELOG.md index 8ab10f811..80da4bfd4 100644 --- a/jackett/CHANGELOG.md +++ b/jackett/CHANGELOG.md @@ -1,4 +1,15 @@ +## 0.20.162 (14-12-2021) +- Update to latest version from linuxserver/docker-jackett + +## 0.20.159 (12-12-2021) +- Update to latest version from linuxserver/docker-jackett +- New standardized logic for Dockerfile build and packages installation +- Removed full access (not used anymore) + +## 0.20.147 (11-12-2021) +- Update to latest version from linuxserver/docker-jackett + ## 0.20.141 (10-12-2021) - Update to latest version from linuxserver/docker-jackett diff --git a/jackett/Dockerfile b/jackett/Dockerfile index c0ae0d69d..cc50cfaca 100644 --- a/jackett/Dockerfile +++ b/jackett/Dockerfile @@ -1,28 +1,14 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -ENV BASHIO_VERSION=0.14.3 -ENV PACKAGES="curl" -RUN \ - ################ - # Install apps # - ################ - apk add --no-cache ${PACKAGES} \ - \ - ################## - # Install bashio # - ################## - && curl -J -L -o /tmp/bashio.tar.gz \ - "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.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 || true +################## +# 2 Modify Image # +################## # use /data instead of /config for hass.io environment RUN sed -i "s|/config|/config/jackett|g" /etc/services.d/jackett/run \ @@ -33,10 +19,32 @@ RUN sed -i "s|/config|/config/jackett|g" /etc/services.d/jackett/run \ && 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/ / +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="curl" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/jackett/config.json b/jackett/config.json index 836568bb3..6dfe65e73 100644 --- a/jackett/config.json +++ b/jackett/config.json @@ -11,7 +11,6 @@ "PUID": "0", "PGID": "0" }, - "full_access": true, "map": [ "config:rw", "share:rw", @@ -44,8 +43,8 @@ }, "slug": "jackett_nas", "startup": "services", - "upstream": "0.20.141", + "upstream": "0.20.162", "url": "https://github.com/alexbelgium/hassio-addons", - "version": "0.20.141", + "version": "0.20.162", "webui": "http://[HOST]:[PORT:9117]" } diff --git a/jackett/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/jackett/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/jackett/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/jackett/rootfs/etc/cont-init.d/00-banner.sh b/jackett/rootfs/etc/cont-init.d/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/jackett/rootfs/etc/cont-init.d/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/jackett/rootfs/etc/cont-init.d/00-ha-env b/jackett/rootfs/etc/cont-init.d/00-ha-env new file mode 100644 index 000000000..3b3e69246 --- /dev/null +++ b/jackett/rootfs/etc/cont-init.d/00-ha-env @@ -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 \ No newline at end of file diff --git a/jackett/rootfs/etc/cont-init.d/20-folders b/jackett/rootfs/etc/cont-init.d/20-folders new file mode 100644 index 000000000..0a8112e46 --- /dev/null +++ b/jackett/rootfs/etc/cont-init.d/20-folders @@ -0,0 +1,19 @@ +#!/usr/bin/with-contenv bash + +if [ ! -d /share/storage/movies ]; then + echo "Creating /share/storage/movies" + mkdir -p /share/storage/movies + chown -R abc:abc /share/storage/movies +fi + +if [ ! -d /share/downloads ]; then + echo "Creating /share/downloads" + mkdir -p /share/downloads + chown -R abc:abc /share/downloads +fi + +if [ ! -d /config/jackett ]; then + echo "Creating /config/jackett" + mkdir -p /config/jackett + chown -R abc:abc /config/jackett +fi diff --git a/jackett/rootfs/etc/cont-init.d/92-local_mounts.sh b/jackett/rootfs/etc/cont-init.d/92-local_mounts.sh new file mode 100644 index 000000000..0920d68bd --- /dev/null +++ b/jackett/rootfs/etc/cont-init.d/92-local_mounts.sh @@ -0,0 +1,32 @@ +#!/usr/bin/with-contenv bashio + +###################### +# MOUNT LOCAL SHARES # +###################### + +# Mount local Share if configured +if bashio::config.has_value 'localdisks'; then + + MOREDISKS=$(bashio::config 'localdisks') + echo "Local Disks mounting..." + + # Separate comma separated values + for disk in ${MOREDISKS//,/ }; do + + # Mount by device as default + devpath=/dev + + # Mount as label + [ ${disk:0:2} != "sd" ] && devpath=/dev/disk/by-label + + # Creates dir + mkdir -p /mnt/$disk + chown -R $(id -u):$(id -g) /mnt/$disk + # Legacy mounting : mount to share if still exists (avoid breaking changes) + [ -d /share/$disk ] && mount $devpath/$disk /share/$disk || true + # Mount + mount $devpath/$disk /mnt/$disk && bashio::log.info "Success! $disk mounted to /mnt/$disk" || (bashio::log.fatal "Unable to mount local drives! Please check the name." && rmdir /mnt/$disk) + + done + +fi diff --git a/jackett/rootfs/etc/cont-init.d/92-smb_mounts.sh b/jackett/rootfs/etc/cont-init.d/92-smb_mounts.sh new file mode 100644 index 000000000..06410e554 --- /dev/null +++ b/jackett/rootfs/etc/cont-init.d/92-smb_mounts.sh @@ -0,0 +1,83 @@ +#!/usr/bin/with-contenv bashio + +######################### +# MOUNT SMB SHARES v1.6 # +######################### +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="" + + # Mount CIFS Share if configured and if Protection Mode is active + echo '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//,/ }; do # Separate comma separated values + + # 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 + + # Data validation + if [[ ! $disk =~ ^.*+[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[/]+.*+$ ]]; then + bashio::log.fatal "The structure of your \"networkdisks\" option : \"$disk\" doesn't seem correct, please use a structure like //123.12.12.12/sharedfolder,//123.12.12.12/sharedfolder2. If you don't use it, you can simply remove the text, this will avoid this error message in the future." + exit 0 + fi + + # 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:-WORKGROUP}"; 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 + + # Messages + if [ $MOUNTED = true ] && [ "mountpoint -q /mnt/$diskname" ]; 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 + # Mounting failed messages + bashio::log.fatal "Error, 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" + bashio::log.fatal "Here is some debugging info :" + + # Provide debugging info + smbclient -V &>/dev/null || apt-get install smbclient || apk add --no-cache samba-client + #smbclient $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + smbclient -L $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + + # Error code + bashio::log.fatal "Error read : $(/dev/null || true + rmdir /mnt/$diskname || true + fi + + done +fi diff --git a/jellyfin/CHANGELOG.md b/jellyfin/CHANGELOG.md index afc167a9b..64152c0a9 100644 --- a/jellyfin/CHANGELOG.md +++ b/jellyfin/CHANGELOG.md @@ -1,4 +1,5 @@ -- Add local mount (see readmeà +- New standardized logic for Dockerfile build and packages installation +- Add local mount (see readme) - Added watchdog feature - Allow mounting of devices up to sdg2 - Improve SMB mount code to v1.5 ; accepts several network disks separated by commas (//123.12.12.12/share,//123.12.12.12/hello) that are mount to /mnt/$sharename diff --git a/jellyfin/Dockerfile b/jellyfin/Dockerfile index 7da6d7bb5..16ff1fd27 100644 --- a/jellyfin/Dockerfile +++ b/jellyfin/Dockerfile @@ -1,40 +1,59 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -# Set shell -SHELL ["/bin/bash", "-o", "pipefail", "-c"] -ENV BASHIO_VERSION=0.14.3 -ENV PACKAGES="jq \ - samba \ - cifs-utils \ - smbclient" +################## +# 2 Modify Image # +################## -RUN apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} \ - \ - ################## - # 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 \ - \ - # Allow UID and GID setting - && sed -i 's/bash/bashio/g' /etc/cont-init.d/10-adduser \ +# Allow UID and GID setting +RUN \ + 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 \ && sed -i "s|/config|/config/jellyfin|g" /etc/services.d/jellyfin/run \ && sed -i "s|/config|/config/jellyfin|g" /etc/cont-init.d/10-adduser \ && sed -i "s|/config|/config/jellyfin|g" /etc/cont-init.d/30-config -# copy local files -COPY root/ / +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="jq \ + samba \ + cifs-utils \ + smbclient" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/jellyfin/config.json b/jellyfin/config.json index fd34137cb..595885638 100644 --- a/jellyfin/config.json +++ b/jellyfin/config.json @@ -78,6 +78,5 @@ "url": "https://github.com/alexbelgium/hassio-addons", "version": "10.7.7-1-ls130-4", "video": true, - "watchdog": "http://[HOST]:[PORT:8096]", "webui": "http://[HOST]:[PORT:8096]" } diff --git a/jellyfin/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/jellyfin/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/jellyfin/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/jellyfin/rootfs/etc/cont-init.d/00-banner.sh b/jellyfin/rootfs/etc/cont-init.d/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/jellyfin/rootfs/etc/cont-init.d/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/jellyfin/rootfs/etc/cont-init.d/00-ha-env b/jellyfin/rootfs/etc/cont-init.d/00-ha-env new file mode 100644 index 000000000..3b3e69246 --- /dev/null +++ b/jellyfin/rootfs/etc/cont-init.d/00-ha-env @@ -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 \ No newline at end of file diff --git a/jellyfin/rootfs/etc/cont-init.d/20-folders b/jellyfin/rootfs/etc/cont-init.d/20-folders new file mode 100644 index 000000000..9015351ab --- /dev/null +++ b/jellyfin/rootfs/etc/cont-init.d/20-folders @@ -0,0 +1,82 @@ +#!/usr/bin/with-contenv bash + +if [ ! -d /jellyfin ]; then + echo "Creating /jellyfin" + mkdir -p /jellyfin + chown -R abc:abc /jellyfin +fi + +if [ ! -d /share/storage/tv ]; then + echo "Creating /share/storage/tv" + mkdir -p /share/storage/tv + chown -R abc:abc /share/storage/tv +fi + +if [ ! -d /share/storage/movies ]; then + echo "Creating /share/storage/movies" + mkdir -p /share/storage/movies + chown -R abc:abc /share/storage/movies +fi + +if [ ! -d /share/jellyfin ]; then + echo "Creating /share/jellyfin" + mkdir -p /share/jellyfin + chown -R abc:abc /share/jellyfin +fi + +if [ ! -d /config/jellyfin ]; then + echo "Creating /config/jellyfin" + mkdir -p /config/jellyfin + chown -R abc:abc /config/jellyfin +fi + +# links + +if [ ! -d /jellyfin/cache ]; then + echo "Creating link for /jellyfin/cache" + mkdir -p /share/jellyfin/cache + chown -R abc:abc /share/jellyfin/cache + ln -s /share/jellyfin/cache /jellyfin/cache +fi + +if [ ! -d /jellyfin/config ]; then + echo "Creating link for /jellyfin/config" + mkdir -p /config/jellyfin + chown -R abc:abc /config/jellyfin + ln -s /config/jellyfin /jellyfin/config +fi + +if [ ! -d /jellyfin/data ]; then + echo "Creating link for /jellyfin/data" + mkdir -p /share/jellyfin/data + chown -R abc:abc /share/jellyfin/data + ln -s /share/jellyfin/data /jellyfin/data +fi + +if [ ! -d /jellyfin/logs ]; then + echo "Creating link for /jellyfin/logs" + mkdir -p /share/jellyfin/logs + chown -R abc:abc /share/jellyfin/logs + ln -s /share/jellyfin/logs /jellyfin/logs +fi + +if [ ! -d /jellyfin/metadata ]; then + echo "Creating link for /jellyfin/metadata" + mkdir -p /share/jellyfin/metadata + chown -R abc:abc /share/jellyfin/metadata + ln -s /share/jellyfin/metadata /jellyfin/metadata +fi + +if [ ! -d /jellyfin/plugins ]; then + echo "Creating link for /jellyfin/plugins" + mkdir -p /share/jellyfin/plugins + chown -R abc:abc /share/jellyfin/plugins + ln -s /share/jellyfin/plugins /jellyfin/plugins +fi + +if [ ! -d /jellyfin/root ]; then + echo "Creating link for /jellyfin/root" + mkdir -p /share/jellyfin/root + chown -R abc:abc /share/jellyfin/root + ln -s /share/jellyfin/root /jellyfin/root +fi diff --git a/jellyfin/rootfs/etc/cont-init.d/92-local_mounts.sh b/jellyfin/rootfs/etc/cont-init.d/92-local_mounts.sh new file mode 100644 index 000000000..0920d68bd --- /dev/null +++ b/jellyfin/rootfs/etc/cont-init.d/92-local_mounts.sh @@ -0,0 +1,32 @@ +#!/usr/bin/with-contenv bashio + +###################### +# MOUNT LOCAL SHARES # +###################### + +# Mount local Share if configured +if bashio::config.has_value 'localdisks'; then + + MOREDISKS=$(bashio::config 'localdisks') + echo "Local Disks mounting..." + + # Separate comma separated values + for disk in ${MOREDISKS//,/ }; do + + # Mount by device as default + devpath=/dev + + # Mount as label + [ ${disk:0:2} != "sd" ] && devpath=/dev/disk/by-label + + # Creates dir + mkdir -p /mnt/$disk + chown -R $(id -u):$(id -g) /mnt/$disk + # Legacy mounting : mount to share if still exists (avoid breaking changes) + [ -d /share/$disk ] && mount $devpath/$disk /share/$disk || true + # Mount + mount $devpath/$disk /mnt/$disk && bashio::log.info "Success! $disk mounted to /mnt/$disk" || (bashio::log.fatal "Unable to mount local drives! Please check the name." && rmdir /mnt/$disk) + + done + +fi diff --git a/jellyfin/rootfs/etc/cont-init.d/92-smb_mounts.sh b/jellyfin/rootfs/etc/cont-init.d/92-smb_mounts.sh new file mode 100644 index 000000000..06410e554 --- /dev/null +++ b/jellyfin/rootfs/etc/cont-init.d/92-smb_mounts.sh @@ -0,0 +1,83 @@ +#!/usr/bin/with-contenv bashio + +######################### +# MOUNT SMB SHARES v1.6 # +######################### +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="" + + # Mount CIFS Share if configured and if Protection Mode is active + echo '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//,/ }; do # Separate comma separated values + + # 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 + + # Data validation + if [[ ! $disk =~ ^.*+[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[/]+.*+$ ]]; then + bashio::log.fatal "The structure of your \"networkdisks\" option : \"$disk\" doesn't seem correct, please use a structure like //123.12.12.12/sharedfolder,//123.12.12.12/sharedfolder2. If you don't use it, you can simply remove the text, this will avoid this error message in the future." + exit 0 + fi + + # 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:-WORKGROUP}"; 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 + + # Messages + if [ $MOUNTED = true ] && [ "mountpoint -q /mnt/$diskname" ]; 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 + # Mounting failed messages + bashio::log.fatal "Error, 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" + bashio::log.fatal "Here is some debugging info :" + + # Provide debugging info + smbclient -V &>/dev/null || apt-get install smbclient || apk add --no-cache samba-client + #smbclient $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + smbclient -L $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + + # Error code + bashio::log.fatal "Error read : $(/dev/null || true + rmdir /mnt/$diskname || true + fi + + done +fi diff --git a/joal/CHANGELOG.md b/joal/CHANGELOG.md index 3daef1abf..3b5132019 100644 --- a/joal/CHANGELOG.md +++ b/joal/CHANGELOG.md @@ -1,4 +1,8 @@ +## 2.1.28 (14-12-2021) +- Update to latest version from anthonyraymond/joal +- New standardized logic for Dockerfile build and packages installation + ## 2.1.27 (17-11-2021) - Update to latest version from anthonyraymond/joal diff --git a/joal/Dockerfile b/joal/Dockerfile index 0c87dc1d1..ad4fc7a06 100644 --- a/joal/Dockerfile +++ b/joal/Dockerfile @@ -1,58 +1,60 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM -ARG BUILD_UPSTREAM="2.1.27" +ARG BUILD_UPSTREAM="2.1.28" FROM anthonyraymond/joal:$BUILD_UPSTREAM -# Set shell +################## +# 2 Modify Image # +################## + +#Install Joal +RUN \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -s -S -J -L -o /tmp/joal.tar.gz $(curl -s https://api.github.com/repos/anthonyraymond/joal/releases/latest | grep -o "http.*joal.tar.gz") >/dev/null &&\ + mkdir -p /data/joal &&\ + tar zxvf /tmp/joal.tar.gz -C /data/joal >/dev/null &&\ + chown -R $(id -u):$(id -g) /data/joal &&\ + rm /data/joal/jack-of* || true + +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="jq \ + nginx" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG BUILD_VERSION -ARG BUILD_UPSTREAM="2.1.27" -ENV BASHIO_VERSION=0.14.3 -ENV PACKAGES="wget \ - jq \ - nginx" +ARG BUILD_UPSTREAM="2.1.28" -RUN \ - #Install bashio - apt-get clean \ - && apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} \ - \ - ################## - # Install bashio # - ################## - && curl -J -L -o /tmp/bashio.tar.gz \ - "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.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 || true +################ +# 4 Entrypoint # +################ -RUN \ - #Install Joal - wget -O /tmp/joal.tar.gz "https://github.com/anthonyraymond/joal/releases/download/$BUILD_UPSTREAM/joal.tar.gz" \ - && mkdir -p /data/joal \ - && tar zxvf /tmp/joal.tar.gz -C /data/joal \ - && rm /data/joal/jack-of* \ - #Clean - && rm -fr \ - /tmp/* \ - /var/{cache,log}/* \ - /var/lib/apt/lists/* - -VOLUME [ "/data" ] - -# copy local files -COPY rootfs/ / -#WORKDIR / RUN chmod 777 /entrypoint.sh ENTRYPOINT [ "/usr/bin/env" ] CMD [ "/entrypoint.sh" ] -### LABELS +############ +# 5 Labels # +############ + ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/joal/config.json b/joal/config.json index 212425de1..b658db43a 100644 --- a/joal/config.json +++ b/joal/config.json @@ -38,8 +38,8 @@ }, "slug": "joal", "startup": "services", - "upstream": "2.1.27", + "upstream": "2.1.28", "url": "https://github.com/alexbelgium/hassio-addons", - "version": "2.1.27", + "version": "2.1.28", "webui": "http://[HOST]:[PORT:8081]/joal/ui?ui_credentials=%7B%22host%22%3A%22[HOST]%22%2C%22port%22%3A%22[PORT:8081]%22%2C%22pathPrefix%22%3A%22joal%22%2C%22secretToken%22%3A%22lrMY24Byhx%22%7D" } diff --git a/joal/rootfs/entrypoint.sh b/joal/rootfs/entrypoint.sh index bf5da4a6c..35ccb7382 100644 --- a/joal/rootfs/entrypoint.sh +++ b/joal/rootfs/entrypoint.sh @@ -2,34 +2,6 @@ echo "Starting..." -################################### -# Export all addon options as env # -################################### - -# For all keys in options.json -JSONSOURCE="/data/options.json" - -# Export keys as env variables -echo "All addon options were exported as variables" -mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE}) -for KEYS in ${arr[@]}; do - # export key - VALUE=$(jq .$KEYS ${JSONSOURCE}) - export ${KEYS}=${VALUE//[\"\']/} &>/dev/null -done - -################ -# Set timezone # -################ -if [ ! -z "TZ" ] && [ -f /etc/localtime ]; then - if [ -f /usr/share/zoneinfo/$TZ ]; then - echo "Timezone set from $(cat /etc/timezone) to $TZ" - ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone - else - echo "WARNING : Timezone $TZ is invalid, it will be kept to default value of $(cat /etc/timezone)" - fi -fi - #################### # Starting scripts # #################### diff --git a/joal/rootfs/scripts/00-aaa_dockerfile_backup.sh b/joal/rootfs/scripts/00-aaa_dockerfile_backup.sh index 612e26d7e..4f9ed9c51 100644 --- a/joal/rootfs/scripts/00-aaa_dockerfile_backup.sh +++ b/joal/rootfs/scripts/00-aaa_dockerfile_backup.sh @@ -1,29 +1,18 @@ #!/bin/bash # If dockerfile failed install manually -if [ ! -f "/usr/bin/bashio" ]; then - echo "Bashio does not exist, executing script" +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null \ - || apk add --no-cache ${PACKAGES} - - ################### - # 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 - + ####################### + # Automatic installer # + ####################### + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/joal/rootfs/scripts/99-run.sh b/joal/rootfs/scripts/99-run.sh index eec197a1f..f0a83cde8 100644 --- a/joal/rootfs/scripts/99-run.sh +++ b/joal/rootfs/scripts/99-run.sh @@ -18,10 +18,8 @@ fi if [ $VERBOSE = true ]; then curl -J -L -o /tmp/joal.tar.gz $(curl -s https://api.github.com/repos/anthonyraymond/joal/releases/latest | grep -o "http.*joal.tar.gz") - #wget -O /tmp/joal.tar.gz "https://github.com/anthonyraymond/joal/releases/download/$UPSTREAM/joal.tar.gz" else curl -s -S -J -L -o /tmp/joal.tar.gz $(curl -s https://api.github.com/repos/anthonyraymond/joal/releases/latest | grep -o "http.*joal.tar.gz") >/dev/null - #wget -q -O /tmp/joal.tar.gz "https://github.com/anthonyraymond/joal/releases/download/$UPSTREAM/joal.tar.gz" fi mkdir -p /data/joal tar zxvf /tmp/joal.tar.gz -C /data/joal >/dev/null diff --git a/joplin/CHANGELOG.md b/joplin/CHANGELOG.md index 5d407ad82..6a2a73ec6 100644 --- a/joplin/CHANGELOG.md +++ b/joplin/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation ## 2.5.12 (08-11-2021) - Update to latest version from laurent22/joplin diff --git a/joplin/Dockerfile b/joplin/Dockerfile index f283dba1b..1e764b53e 100644 --- a/joplin/Dockerfile +++ b/joplin/Dockerfile @@ -1,36 +1,50 @@ +################# +# 1 Build Image # +################# ARG BUILD_FROM ARG BUILD_VERSION FROM florider89/joplin-server:master -ENV BASHIO_VERSION=0.14.3 +################## +# 2 Modify Image # +################## + +USER root + +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps ENV PACKAGES="jq \ curl" -USER root -RUN \ - ################ - # Install apps # - ################ - apt-get clean \ - && apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} \ - \ - ################## - # 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 -COPY rootfs / -RUN chmod +x /run.sh +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +RUN chmod 777 /entrypoint.sh ENTRYPOINT [ "/usr/bin/env" ] -CMD [ "/run.sh" ] +CMD [ "/entrypoint.sh" ] +#WORKDIR / +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/joplin/rootfs/entrypoint.sh b/joplin/rootfs/entrypoint.sh new file mode 100644 index 000000000..35ccb7382 --- /dev/null +++ b/joplin/rootfs/entrypoint.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +echo "Starting..." + +#################### +# Starting scripts # +#################### + +cd / +for SCRIPTS in scripts/*; do + [ -e "$SCRIPTS" ] || continue + echo "$SCRIPTS: executing" + chown $(id -u):$(id -g) $SCRIPTS + chmod a+x $SCRIPTS + sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' $SCRIPTS || true + ./$SCRIPTS || echo "$SCRIPTS: exiting $?" +done diff --git a/joplin/rootfs/scripts/00-aaa_dockerfile_backup.sh b/joplin/rootfs/scripts/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/joplin/rootfs/scripts/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/joplin/rootfs/scripts/00-banner.sh b/joplin/rootfs/scripts/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/joplin/rootfs/scripts/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/joplin/rootfs/scripts/99-run.sh b/joplin/rootfs/scripts/99-run.sh new file mode 100644 index 000000000..66ec58d27 --- /dev/null +++ b/joplin/rootfs/scripts/99-run.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bashio + +bashio::log.warning "Warning - minimum configuration recommended : 2 cpu cores and 4 GB of memory. Otherwise the system will become unresponsive and crash." + +########## +# BANNER # +########## + +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 + +############## +# LAUNCH APP # +############## + +# Configure app +bashio::config.has_value 'DB_CLIENT' && export DB_CLIENT=$(bashio::config 'DB_CLIENT') && bashio::log.info 'Database client set' +bashio::config.has_value 'POSTGRES_PASSWORD' && export POSTGRES_PASSWORD=$(bashio::config 'POSTGRES_PASSWORD') && bashio::log.info 'Postgrep Password set' +bashio::config.has_value 'POSTGRES_DATABASE' && export POSTGRES_DATABASE=$(bashio::config 'POSTGRES_DATABASE') && bashio::log.info 'Postgrep Database set' +bashio::config.has_value 'POSTGRES_USER' && export POSTGRES_USER=$(bashio::config 'POSTGRES_USER') && bashio::log.info 'Postgrep User set' +bashio::config.has_value 'POSTGRES_PORT' && export POSTGRES_PORT=$(bashio::config 'POSTGRES_PORT') && bashio::log.info 'Postgrep Port set' +bashio::config.has_value 'POSTGRES_HOST' && export POSTGRES_HOST=$(bashio::config 'POSTGRES_HOST') && bashio::log.info 'Postgrep Host set' +bashio::config.has_value 'MAILER_HOST' && export MAILER_HOST=$(bashio::config 'MAILER_HOST') && bashio::log.info 'Mailer Host set' +bashio::config.has_value 'MAILER_PORT' && export MAILER_PORT=$(bashio::config 'MAILER_PORT') && bashio::log.info 'Mailer Port set' +bashio::config.has_value 'MAILER_SECURE' && export MAILER_SECURE=$(bashio::config 'MAILER_SECURE') && bashio::log.info 'Mailer Secure set' +bashio::config.has_value 'MAILER_AUTH_USER' && export MAILER_AUTH_USER=$(bashio::config 'MAILER_AUTH_USER') && bashio::log.info 'Mailer User set' +bashio::config.has_value 'MAILER_AUTH_PASSWORD' && export MAILER_AUTH_PASSWORD=$(bashio::config 'MAILER_AUTH_PASSWORD') && bashio::log.info 'Mailer Password set' +bashio::config.has_value 'MAILER_NOREPLY_NAME' && export MAILER_NOREPLY_NAME=$(bashio::config 'MAILER_NOREPLY_NAME') && bashio::log.info 'Mailer Noreply Name set' +bashio::config.has_value 'MAILER_NOREPLY_EMAIL' && export MAILER_NOREPLY_EMAIL=$(bashio::config 'MAILER_NOREPLY_EMAIL') && bashio::log.info 'Mailer Noreply Email set' +bashio::config.has_value 'MAILER_ENABLED' && export MAILER_ENABLED=$(bashio::config 'MAILER_ENABLED') && bashio::log.info 'Mailer Enabled set' +export APP_BASE_URL=$(bashio::config 'APP_BASE_URL') + +bashio::log.info 'Starting Joplin. Initial user is "admin@localhost" with password "admin"' + +npm --prefix packages/server start diff --git a/lidarr/CHANGELOG.md b/lidarr/CHANGELOG.md index c9ac238b9..aab139117 100644 --- a/lidarr/CHANGELOG.md +++ b/lidarr/CHANGELOG.md @@ -1,3 +1,5 @@ +- New standardized logic for Dockerfile build and packages installation - Allow mounting local drives by label. Just pust the label instead of sda1 for example + - Initial release - Improve SMB mount code to v1.5 ; accepts several network disks separated by commas (//123.12.12.12/share,//123.12.12.12/hello) that are mount to /mnt/$sharename diff --git a/lidarr/Dockerfile b/lidarr/Dockerfile index 93500f1fc..6b10ff969 100644 --- a/lidarr/Dockerfile +++ b/lidarr/Dockerfile @@ -1,34 +1,18 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -ENV BASHIO_VERSION=0.14.3 -ENV PACKAGES="jq \ - curl \ - cifs-utils \ - keyutils \ - samba \ - smbclient" + +################## +# 2 Modify Image # +################## RUN \ - ################ - # Install apps # - ################ - apt-get clean \ - && apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} \ - \ - ################### - # 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|/config/lidarr|g" /etc/services.d/lidarr/run \ + sed -i "s|/config|/config/lidarr|g" /etc/services.d/lidarr/run \ && sed -i "s|/config|/config/lidarr|g" /etc/cont-init.d/30-config \ \ # Allow UID and GID setting @@ -36,10 +20,43 @@ RUN \ && 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/ / +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="jq \ + curl \ + cifs-utils \ + keyutils \ + samba \ + smbclient" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/lidarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/lidarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/lidarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/lidarr/rootfs/etc/cont-init.d/00-banner.sh b/lidarr/rootfs/etc/cont-init.d/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/lidarr/rootfs/etc/cont-init.d/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/lidarr/rootfs/etc/cont-init.d/20-folders b/lidarr/rootfs/etc/cont-init.d/20-folders new file mode 100644 index 000000000..6e2cb7cce --- /dev/null +++ b/lidarr/rootfs/etc/cont-init.d/20-folders @@ -0,0 +1,19 @@ +#!/usr/bin/with-contenv bash + +if [ ! -d /share/music ]; then + echo "Creating /share/music" + mkdir -p /share/music + chown -R abc:abc /share/music +fi + +if [ ! -d /share/downloads ]; then + echo "Creating /share/downloads" + mkdir -p /share/downloads + chown -R abc:abc /share/downloads +fi + +if [ ! -d /config/lidarr ]; then + echo "Creating /config/lidarr" + mkdir -p /config/lidarr + chown -R abc:abc /config/lidarr +fi diff --git a/lidarr/rootfs/etc/cont-init.d/92-local_mounts.sh b/lidarr/rootfs/etc/cont-init.d/92-local_mounts.sh new file mode 100644 index 000000000..0920d68bd --- /dev/null +++ b/lidarr/rootfs/etc/cont-init.d/92-local_mounts.sh @@ -0,0 +1,32 @@ +#!/usr/bin/with-contenv bashio + +###################### +# MOUNT LOCAL SHARES # +###################### + +# Mount local Share if configured +if bashio::config.has_value 'localdisks'; then + + MOREDISKS=$(bashio::config 'localdisks') + echo "Local Disks mounting..." + + # Separate comma separated values + for disk in ${MOREDISKS//,/ }; do + + # Mount by device as default + devpath=/dev + + # Mount as label + [ ${disk:0:2} != "sd" ] && devpath=/dev/disk/by-label + + # Creates dir + mkdir -p /mnt/$disk + chown -R $(id -u):$(id -g) /mnt/$disk + # Legacy mounting : mount to share if still exists (avoid breaking changes) + [ -d /share/$disk ] && mount $devpath/$disk /share/$disk || true + # Mount + mount $devpath/$disk /mnt/$disk && bashio::log.info "Success! $disk mounted to /mnt/$disk" || (bashio::log.fatal "Unable to mount local drives! Please check the name." && rmdir /mnt/$disk) + + done + +fi diff --git a/lidarr/rootfs/etc/cont-init.d/92-smb_mounts.sh b/lidarr/rootfs/etc/cont-init.d/92-smb_mounts.sh new file mode 100644 index 000000000..06410e554 --- /dev/null +++ b/lidarr/rootfs/etc/cont-init.d/92-smb_mounts.sh @@ -0,0 +1,83 @@ +#!/usr/bin/with-contenv bashio + +######################### +# MOUNT SMB SHARES v1.6 # +######################### +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="" + + # Mount CIFS Share if configured and if Protection Mode is active + echo '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//,/ }; do # Separate comma separated values + + # 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 + + # Data validation + if [[ ! $disk =~ ^.*+[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[/]+.*+$ ]]; then + bashio::log.fatal "The structure of your \"networkdisks\" option : \"$disk\" doesn't seem correct, please use a structure like //123.12.12.12/sharedfolder,//123.12.12.12/sharedfolder2. If you don't use it, you can simply remove the text, this will avoid this error message in the future." + exit 0 + fi + + # 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:-WORKGROUP}"; 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 + + # Messages + if [ $MOUNTED = true ] && [ "mountpoint -q /mnt/$diskname" ]; 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 + # Mounting failed messages + bashio::log.fatal "Error, 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" + bashio::log.fatal "Here is some debugging info :" + + # Provide debugging info + smbclient -V &>/dev/null || apt-get install smbclient || apk add --no-cache samba-client + #smbclient $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + smbclient -L $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + + # Error code + bashio::log.fatal "Error read : $(/dev/null || true + rmdir /mnt/$diskname || true + fi + + done +fi diff --git a/mealie/CHANGELOG.md b/mealie/CHANGELOG.md index 9eb5083fa..4439bc34e 100644 --- a/mealie/CHANGELOG.md +++ b/mealie/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation ## 0.5.4 (03-12-2021) - Update to latest version from hay-kot/mealie diff --git a/mealie/Dockerfile b/mealie/Dockerfile index e6299c639..eb26c61a6 100644 --- a/mealie/Dockerfile +++ b/mealie/Dockerfile @@ -1,43 +1,52 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -COPY rootfs / +################## +# 2 Modify Image # +################## -ENV BASHIO_VERSION=0.14.3 +# Correct data path +RUN \ + grep -rl "/app/data" /app | xargs sed -i 's|/app/data|/data|g' + +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps ENV PACKAGES="jq curl bash" +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + RUN \ - ################ - # Install apps # - ################ - apt-get update && apt-get install -y --no-install-recommends ${PACKAGES} && apt-get clean || apk add --no-cache ${PACKAGES} \ - \ - ################## - # 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 \ - ############### - # Adapt image # - ############### - # Correct data path - && grep -rl "/app/data" /app | xargs sed -i 's|/app/data|/data|g' \ # Add custom instructions to run.sh - && sed -i '1d' /app/mealie/run.sh \ + sed -i '1d' /app/mealie/run.sh \ && cat /app/mealie/run.sh >> /run.txt \ && cat /run.txt > /app/mealie/run.sh \ - && chmod +x /app/mealie/run.sh -# Add custom caddy instructions for ingress -#&& cat /caddy.txt >> /app/Caddyfile + && chmod +x /app/mealie/run.sh -VOLUME [ "/data" ] +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/mealie/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/mealie/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/mealie/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/mealie/rootfs/etc/cont-init.d/00-banner.sh b/mealie/rootfs/etc/cont-init.d/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/mealie/rootfs/etc/cont-init.d/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/mylar3/CHANGELOG.md b/mylar3/CHANGELOG.md index 66f7e8b76..4214b05a4 100644 --- a/mylar3/CHANGELOG.md +++ b/mylar3/CHANGELOG.md @@ -1 +1,5 @@ +- New standardized logic for Dockerfile build and packages installation + +## 0.6.1 (11-12-2021) +- Update to latest version from linuxserver/docker-mylar3 - Initial release diff --git a/mylar3/Dockerfile b/mylar3/Dockerfile index 1537c5759..cfcc4c91d 100644 --- a/mylar3/Dockerfile +++ b/mylar3/Dockerfile @@ -1,14 +1,14 @@ -############### -# Build Image # -############### +################# +# 1 Build Image # +################# ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -################ -# Modify Image # -################ +################## +# 2 Modify Image # +################## RUN sed -i "s|/config|/data|g" /etc/services.d/*/run \ && sed -i "s|/config|/data|g" /etc/cont-init.d/* \ @@ -18,9 +18,9 @@ RUN sed -i "s|/config|/data|g" /etc/services.d/*/run \ && 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 -################ -# Install apps # -################ +################## +# 3 Install apps # +################## # Copy local files COPY rootfs/ / @@ -29,25 +29,25 @@ COPY rootfs/ / ENV PACKAGES="" # Automatic apps & bashio -RUN $(ls /bin/bash &>/dev/null) || (apt-get install -y --no-install-recommends bash || apk add --no-cache bash) && \ - $(curl --help &>/dev/null) || (apt-get install -y --no-install-recommends curl || apk add --no-cache curl) && \ +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ chmod 777 /automatic_packages.sh && \ /automatic_packages.sh "${PACKAGES:-}" && \ rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE - -############## -# Entrypoint # -############## + +################ +# 4 Entrypoint # +################ #RUN chmod 777 /entrypoint.sh #WORKDIR / #ENTRYPOINT [ "/usr/bin/env" ] #CMD [ "/entrypoint.sh" ] - -########## -# Labels # -########## + +############ +# 5 Labels # +############ ARG BUILD_ARCH ARG BUILD_DATE diff --git a/mylar3/config.json b/mylar3/config.json index 20ddd19d4..f356ce67e 100644 --- a/mylar3/config.json +++ b/mylar3/config.json @@ -71,8 +71,8 @@ "cifspassword": "str?" }, "slug": "mylar3", - "upstream": "v0.6.1-ls40", + "upstream": "0.6.1", "url": "https://github.com/alexbelgium/hassio-addons", - "version": "v0.6.1-ls40", + "version": "0.6.1", "webui": "http://[HOST]:[PORT:8090]" } diff --git a/mylar3/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/mylar3/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index e33f7f063..4f9ed9c51 100644 --- a/mylar3/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/mylar3/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -2,18 +2,17 @@ # If dockerfile failed install manually if [ -e "/ENVFILE" ]; then echo "Executing script" - PACKAGES=$(< /ENVFILE) + PACKAGES=$(/dev/null) || (apt-get install -y --no-install-recommends bash || apk add --no-cache bash) && \ - $(curl --help &>/dev/null) || (apt-get install -y --no-install-recommends curl &>/dev/null || apk add --no-cache curl) && \ - curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ - chmod 777 /automatic_packages.sh && \ - eval /./automatic_packages.sh "$PACKAGES" && \ - rm /automatic_packages.sh - + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/nextcloud/CHANGELOG.md b/nextcloud/CHANGELOG.md index 3860606bf..433d159b2 100644 --- a/nextcloud/CHANGELOG.md +++ b/nextcloud/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation ## 23.0.0 (30-11-2021) - Update to latest version from linuxserver/docker-nextcloud diff --git a/nextcloud/Dockerfile b/nextcloud/Dockerfile index a1038f8a5..dbe0c58d9 100644 --- a/nextcloud/Dockerfile +++ b/nextcloud/Dockerfile @@ -1,6 +1,6 @@ -############### -# Build Image # -############### +################# +# 1 Build Image # +################# ARG BUILD_FROM ARG BUILD_VERSION @@ -8,9 +8,9 @@ ARG BUILD_ARCH ARG BUILD_UPSTREAM="23.0.0" FROM ${BUILD_FROM} -################ -# Modify Image # -################ +################## +# 2 Modify Image # +################## ENV NEXTCLOUD_PATH="/data/config/www/nextcloud" @@ -22,24 +22,40 @@ RUN \ && sed -i "s|data|share/nextcloud|g" /etc/services.d/nginx/* \ && sed -i "s|config|data/config|g" /etc/services.d/nginx/* -################ -# Install apps # -################ +################## +# 3 Install apps # +################## -COPY root/ / +# Add rootfs +COPY rootfs/ / +# Manual apps ENV PACKAGES="curl jq wget" -RUN $(ls /bin/bash &>/dev/null) || (apt-get install -y --no-install-recommends bash || apk add --no-cache bash) && \ - $(curl --help &>/dev/null) || (apt-get install -y --no-install-recommends curl || apk add --no-cache curl) && \ +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ chmod 777 /automatic_packages.sh && \ - /automatic_packagesaa.sh "$PACKAGES" && \ + /automatic_packages.sh "${PACKAGES:-}" && \ rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE VOLUME ["/share", "/ssl", "/data", "/media"] -### LABELS +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ + ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/nextcloud/rootfs/defaults/config.php b/nextcloud/rootfs/defaults/config.php new file mode 100644 index 000000000..367cad15d --- /dev/null +++ b/nextcloud/rootfs/defaults/config.php @@ -0,0 +1,6 @@ + '\OC\Memcache\APCu', + 'datadirectory' => '/share/nextcloud', + ); + diff --git a/nextcloud/rootfs/defaults/default b/nextcloud/rootfs/defaults/default new file mode 100644 index 000000000..f17b71216 --- /dev/null +++ b/nextcloud/rootfs/defaults/default @@ -0,0 +1,121 @@ +upstream php-handler { + server 127.0.0.1:9000; +} +server { + listen 80; + listen [::]:80; + server_name _; + return 301 https://$host$request_uri; +} +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + server_name _; + ssl_certificate /ssl/nextcloud/keys/cert.crt; + ssl_certificate_key /ssl/nextcloud/keys/cert.key; + + # Add headers to serve security related headers + # Before enabling Strict-Transport-Security headers please read into this + # topic first. + #add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always; + # + # WARNING: Only add the preload option once you read about + # the consequences in https://hstspreload.org/. This option + # will add the domain to a hardcoded list that is shipped + # in all major browsers and getting removed from this list + # could take several months. + + add_header X-Content-Type-Options nosniff; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Robots-Tag none; + add_header X-Download-Options noopen; + add_header X-Frame-Options "SAMEORIGIN"; + add_header X-Permitted-Cross-Domain-Policies none; + add_header Referrer-Policy no-referrer; + fastcgi_hide_header X-Powered-By; + root /data/config/www/nextcloud/; + # display real ip in nginx logs when connected through reverse proxy via docker network + set_real_ip_from 172.0.0.0/8; + real_ip_header X-Forwarded-For; + location = /robots.txt { + allow all; + log_not_found off; + access_log off; + } + location = /.well-known/carddav { + return 301 $scheme://$host:$server_port/remote.php/dav; + } + location = /.well-known/caldav { + return 301 $scheme://$host:$server_port/remote.php/dav; + } + location = /.well-known/webfinger { + return 301 $scheme://$host:$server_port/public.php?service=webfinger; + } + location = /.well-known/host-meta { + return 301 $scheme://$host:$server_port/public.php?service=host-meta; + } + location = /.well-known/host-meta.json { + return 301 $scheme://$host:$server_port/public.php?service=host-meta-json; + } + client_max_body_size 10G; + fastcgi_buffers 64 4K; + gzip on; + gzip_vary on; + gzip_comp_level 4; + gzip_min_length 256; + gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; + gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; + location / { + rewrite ^ /index.php; + } + location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ { + deny all; + } + location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) { + deny all; + } + location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy)\.php(?:$|\/) { + fastcgi_split_path_info ^(.+?\.php)(\/.*|)$; + set $path_info $fastcgi_path_info; + try_files $fastcgi_script_name =404; + include /etc/nginx/fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $path_info; + fastcgi_param HTTPS on; + fastcgi_param modHeadersAvailable true; + fastcgi_param front_controller_active true; + fastcgi_pass php-handler; + fastcgi_intercept_errors on; + fastcgi_request_buffering off; + } + location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) { + try_files $uri/ =404; + index index.php; + } + location ~ \.(?:css|js|woff2?|svg|gif|map)$ { + try_files $uri /index.php$request_uri; + add_header Cache-Control "public, max-age=15778463"; + # Add headers to serve security related headers + # Before enabling Strict-Transport-Security headers please read into this + # topic first. + #add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always; + # + # WARNING: Only add the preload option once you read about + # the consequences in https://hstspreload.org/. This option + # will add the domain to a hardcoded list that is shipped + # in all major browsers and getting removed from this list + # could take several months. + add_header X-Content-Type-Options nosniff; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Robots-Tag none; + add_header X-Download-Options noopen; + add_header X-Frame-Options "SAMEORIGIN"; + add_header X-Permitted-Cross-Domain-Policies none; + add_header Referrer-Policy no-referrer; + access_log off; + } + location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap|mp4|webm)$ { + try_files $uri /index.php$request_uri; + access_log off; + } +} diff --git a/nextcloud/rootfs/defaults/nextcloud-perms.sh b/nextcloud/rootfs/defaults/nextcloud-perms.sh new file mode 100644 index 000000000..6bf4607f0 --- /dev/null +++ b/nextcloud/rootfs/defaults/nextcloud-perms.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +ocpath="${NEXTCLOUD_PATH}" +htuser='abc' +htgroup='abc' +rootuser='root' + +printf "Creating possible missing Directories\n" +mkdir -p $ocpath/data +mkdir -p $ocpath/assets +mkdir -p $ocpath/updater +mkdir -p $ocpath/apps +mkdir -p $ocpath/assets +mkdir -p $ocpath/config +mkdir -p $ocpath/data +mkdir -p $ocpath/themes +mkdir -p /data/config/nextcloud/config +mkdir -p /data/config/nextcloud/data +mkdir -p /data/config/www/nextcloud/occ 2>/dev/null +mkdir -p /share/nextcloud +mkdir -p /ssl/nextcloud/keys + +printf "chmod Files and Directories. This could take some time, please wait...\n" +#chmod -R 777 ${ocpath} +find ${ocpath}/ -type f -exec chmod 0640 {} \; +find ${ocpath}/ -type d -exec chmod 0750 {} \; + +#find ${ocpath}/ -type f -print0 | xargs -0 chmod 0640 +#find ${ocpath}/ -type d -print0 | xargs -0 chmod 0750 + +printf "chown Directories. This could take some time, please wait...\n" +chown -R ${rootuser}:${htgroup} ${ocpath}/ +chown -R ${htuser}:${htgroup} ${ocpath}/apps/ +chown -R ${htuser}:${htgroup} ${ocpath}/assets/ +chown -R ${htuser}:${htgroup} ${ocpath}/config/ +chown -R ${htuser}:${htgroup} ${ocpath}/data/ +chown -R ${htuser}:${htgroup} ${ocpath}/themes/ +chown -R ${htuser}:${htgroup} ${ocpath}/updater/ +chown -R ${htuser}:${htgroup} /share/nextcloud +chown -R ${htuser}:${htgroup} /ssl/nextcloud/keys || true + +chmod +x ${ocpath}/occ + +printf "chmod/chown .htaccess\n" +if [ -f ${ocpath}/.htaccess ] + then + chmod 0644 ${ocpath}/.htaccess + chown ${rootuser}:${htgroup} ${ocpath}/.htaccess +fi +if [ -f ${ocpath}/data/.htaccess ] + then + chmod 0644 ${ocpath}/data/.htaccess + chown ${rootuser}:${htgroup} ${ocpath}/data/.htaccess +fi diff --git a/nextcloud/rootfs/defaults/nginx.conf b/nextcloud/rootfs/defaults/nginx.conf new file mode 100644 index 000000000..9949edc82 --- /dev/null +++ b/nextcloud/rootfs/defaults/nginx.conf @@ -0,0 +1,102 @@ +## Version 2018/08/16 - Changelog: https://github.com/linuxserver/docker-baseimage-alpine-nginx/commits/master/root/defaults/nginx.conf + +user abc; +worker_processes 4; +pid /run/nginx.pid; +include /etc/nginx/modules/*.conf; + +events { + worker_connections 768; + # multi_accept on; +} + +http { + + ## + # Basic Settings + ## + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 300; + types_hash_max_size 2048; + fastcgi_read_timeout 86400; + # server_tokens off; + + # server_names_hash_bucket_size 64; + # server_name_in_redirect off; + + client_max_body_size 0; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + ## + # Logging Settings + ## + + access_log /data/config/log/nginx/access.log; + error_log /data/config/log/nginx/error.log; + + ## + # Gzip Settings + ## + + gzip on; + gzip_disable "msie6"; + + # gzip_vary on; + # gzip_proxied any; + # gzip_comp_level 6; + # gzip_buffers 16 8k; + # gzip_http_version 1.1; + # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; + + ## + # nginx-naxsi config + ## + # Uncomment it if you installed nginx-naxsi + ## + + #include /etc/nginx/naxsi_core.rules; + + ## + # nginx-passenger config + ## + # Uncomment it if you installed nginx-passenger + ## + + #passenger_root /usr; + #passenger_ruby /usr/bin/ruby; + + ## + # Virtual Host Configs + ## + include /etc/nginx/conf.d/*.conf; + include /data/config/nginx/site-confs/*; + +} + +#mail { +# # See sample authentication script at: +# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript +# +# # auth_http localhost/auth.php; +# # pop3_capabilities "TOP" "USER"; +# # imap_capabilities "IMAP4rev1" "UIDPLUS"; +# +# server { +# listen localhost:110; +# protocol pop3; +# proxy on; +# } +# +# server { +# listen localhost:143; +# protocol imap; +# proxy on; +# } +#} +daemon off; + diff --git a/nextcloud/rootfs/defaults/root b/nextcloud/rootfs/defaults/root new file mode 100644 index 000000000..7563168d1 --- /dev/null +++ b/nextcloud/rootfs/defaults/root @@ -0,0 +1,9 @@ +# do daily/weekly/monthly maintenance +# min hour day month weekday command +*/15 * * * * run-parts /etc/periodic/15min +0 * * * * run-parts /etc/periodic/hourly +0 2 * * * run-parts /etc/periodic/daily +0 3 * * 6 run-parts /etc/periodic/weekly +0 5 1 * * run-parts /etc/periodic/monthly +# nextcloud cron +*/5 * * * * s6-setuidgid abc php7 -f /data/config/www/nextcloud/cron.php diff --git a/nextcloud/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/nextcloud/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/nextcloud/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/nextcloud/rootfs/etc/cont-init.d/00-banner.sh b/nextcloud/rootfs/etc/cont-init.d/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/nextcloud/rootfs/etc/cont-init.d/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/nextcloud/rootfs/etc/cont-init.d/10-adduser b/nextcloud/rootfs/etc/cont-init.d/10-adduser new file mode 100644 index 000000000..a1207733b --- /dev/null +++ b/nextcloud/rootfs/etc/cont-init.d/10-adduser @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio + +PUID=$(bashio::config "PUID") +PGID=$(bashio::config "PGID") + +groupmod -o -g "$PGID" abc +usermod -o -u "$PUID" abc +mkdir -p /data/config +mkdir -p /share/nextcloud +echo ' +------------------------------------- + _ () + | | ___ _ __ + | | / __| | | / \ + | | \__ \ | | | () | + |_| |___/ |_| \__/ + + +Brought to you by linuxserver.io +-------------------------------------' +if [[ -f /donate.txt ]]; then + echo ' +To support the app dev(s) visit:' + cat /donate.txt +fi +echo ' +To support LSIO projects visit: +https://www.linuxserver.io/donate/ +------------------------------------- +GID/UID +-------------------------------------' +echo " +User uid: $(id -u abc) +User gid: $(id -g abc) +------------------------------------- +" +chown abc:abc /app +chown abc:abc /data/config +chown abc:abc /defaults diff --git a/nextcloud/rootfs/etc/cont-init.d/30-keygen b/nextcloud/rootfs/etc/cont-init.d/30-keygen new file mode 100644 index 000000000..2d41156b2 --- /dev/null +++ b/nextcloud/rootfs/etc/cont-init.d/30-keygen @@ -0,0 +1,37 @@ +#!/usr/bin/with-contenv bashio + +if bashio::config.true 'use_own_certs'; then + + bashio::log.info "Using referenced ssl certificates..." + CERTFILE=$(bashio::config 'certfile') + KEYFILE=$(bashio::config 'keyfile') + + #Check if files exist + echo "... checking if referenced files exist" + [ ! -f /ssl/$CERTFILE ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$CERTFILE not found" && bashio::exit.nok + [ ! -f /ssl/$KEYFILE ] && bashio::log.fatal "... use_own_certs is true but certificate /ssl/$KEYFILE not found" && bashio::exit.nok + +else + mkdir -p /ssl/nextcloud/keys + bashio::log.info "No ssl certificates set. Auto generating ones..." + SUBJECT="/C=US/ST=CA/L=Carlsbad/O=Linuxserver.io/OU=LSIO Server/CN=*" + openssl req -new -x509 -days 3650 -nodes -out /ssl/nextcloud/keys/cert.crt -keyout /ssl/nextcloud/keys/cert.key -subj "$SUBJECT" + CERTFILE="nextcloud/keys/cert.crt" + KEYFILE="nextcloud/keys/cert.key" + +fi + +#Sets certificates +echo "... adding ssl certs in files" +#Sets certificates +for NGINXFILE in "/defaults/default" "/config/nginx/site-confs/default" "/data/config/nginx/site-confs/default"; do + if [ -f $NGINXFILE ]; then + LINE=$(sed -n "/ssl_certificate /=" $NGINXFILE) + if [ ! -z $LINE ]; then + sed -i "/ssl_certificate/ d" $NGINXFILE + sed -i "$LINE a ssl_certificate_key /ssl/$KEYFILE;" $NGINXFILE + sed -i "$LINE a ssl_certificate /ssl/$CERTFILE;" $NGINXFILE + fi + fi +done +bashio::log.info "... done" diff --git a/nextcloud/rootfs/etc/cont-init.d/40-config b/nextcloud/rootfs/etc/cont-init.d/40-config new file mode 100644 index 000000000..f63e7eb5b --- /dev/null +++ b/nextcloud/rootfs/etc/cont-init.d/40-config @@ -0,0 +1,19 @@ +#!/usr/bin/with-contenv bash + +#create folders +mkdir -p \ + /share/nextcloud \ + /data/config/nextcloud/config \ + /data/config/nextcloud/data + +#permissions +chown abc:abc \ + /share/nextcloud \ + /data/config/nextcloud/config \ + /data/config/nextcloud/data + +chown -R abc:abc \ + /var/lib/nginx + +rm -r /data/config/www/nextcloud/assets &>/dev/null +chmod -R 777 /data/config diff --git a/nextcloud/rootfs/etc/cont-init.d/50-install b/nextcloud/rootfs/etc/cont-init.d/50-install new file mode 100644 index 000000000..bd2695198 --- /dev/null +++ b/nextcloud/rootfs/etc/cont-init.d/50-install @@ -0,0 +1,21 @@ +#!/usr/bin/with-contenv bash + +# create folders +mkdir -p \ + "${NEXTCLOUD_PATH}" \ + /data/config/crontabs + +# install app +if [ ! -e "${NEXTCLOUD_PATH}/index.php" ]; then + tar xf /app/nextcloud.tar.bz2 -C \ + "${NEXTCLOUD_PATH}" --strip-components=1 + chown abc:abc -R \ + "${NEXTCLOUD_PATH}" + chmod +x "${NEXTCLOUD_PATH}/occ" +fi + +#?set cronjob +[[ ! -f /data/config/crontabs/root ]] && \ + cp /defaults/root /data/config/crontabs/root +cp /data/config/crontabs/root /etc/crontabs/root + diff --git a/nextcloud/rootfs/etc/cont-init.d/60-memcache b/nextcloud/rootfs/etc/cont-init.d/60-memcache new file mode 100644 index 000000000..0307c088d --- /dev/null +++ b/nextcloud/rootfs/etc/cont-init.d/60-memcache @@ -0,0 +1,9 @@ +#!/usr/bin/with-contenv bash + +# copy config +[[ ! -f /data/config/www/nextcloud/config/config.php ]] && \ + cp /defaults/config.php /data/config/www/nextcloud/config/config.php + +# permissions +chown abc:abc \ + /data/config/www/nextcloud/config/config.php diff --git a/nextcloud/rootfs/etc/cont-init.d/99-elasticsearch b/nextcloud/rootfs/etc/cont-init.d/99-elasticsearch new file mode 100644 index 000000000..b87d40798 --- /dev/null +++ b/nextcloud/rootfs/etc/cont-init.d/99-elasticsearch @@ -0,0 +1,76 @@ +#!/usr/bin/with-contenv bashio + +LAUNCHER="sudo -u abc php /data/config/www/nextcloud/occ" || bashio::log.info "/data/config/www/nextcloud/occ not found" +if ! bashio::fs.file_exists '/data/config/www/nextcloud/occ'; then + LAUNCHER=$(find / -name "occ" -print -quit) +fi || bashio::log.info "occ not found" + +# Make sure there is an Nextcloud installation +if [[ $($LAUNCHER -V) == *"not installed"* ]]; then + bashio::log.warning "It seems there is no Nextcloud server installed. Please restart the addon after initialization of the user." + exit 0 +fi + +############ +# BASED ON # +################################################################################# +# https://raw.githubusercontent.com/nextcloud/vm/master/apps/fulltextsearch.sh # +# T&M Hansson IT AB © - 2021, https://www.hanssonit.se/ # +# SwITNet Ltd © - 2021, https://switnet.net/ # +################################################################################# + +if bashio::config.true 'Full_Text_Search'; then + if [ $LAUNCHER fulltextsearch:index ] &>/dev/null; then + echo "Full Text Search is already working" + break 2 + fi + + echo "Installing Full Text Search" + # Reset Full Text Search to be able to index again, and also remove the app to be able to install it again + occ fulltextsearch:reset &>/dev/null || true + APPS=(fulltextsearch fulltextsearch_elasticsearch files_fulltextsearch) + for app in "${APPS[@]}"; do + # If app exists, remove it + [ ! -z $($LAUNCHER app:getpath $app) ] && $LAUNCHER app:remove $app &>/dev/null + done + + # Get Full Text Search app for nextcloud + for app in "${APPS[@]}"; do + echo "... installing apps : $app" + $LAUNCHER app:install $app >/dev/null + $LAUNCHER app:enable $app >/dev/null + done + chown -R abc:abc $NEXTCLOUD_PATH/apps + + if bashio::config.has_value 'elasticsearch_server'; then + HOST=$(bashio::config 'elasticsearch_server') + else + bashio::log.warning 'Please define elasticsearch server url in addon options with the format "ip:port" such as "192.168.178.1:9200"' + HOST=$(bashio::network.ipv4_address) + HOST="${HOST%/*}:9200" + fi + + # Final setup + echo "... settings apps" + #occ fulltextsearch:configure '{"search_platform":"ElasticSearchPlatform"}' + $LAUNCHER fulltextsearch_elasticsearch:configure "{\"elastic_host\":\"http://$HOST:9200\"}" &>/dev/null + $LAUNCHER fulltextsearch_elasticsearch:configure "{\"elastic_index\":\"my_index\"}" &>/dev/null + $LAUNCHER fulltextsearch_elasticsearch:configure "{\"analyzer_tokenizer\":\"standard\"}" &>/dev/null + $LAUNCHER fulltextsearch:configure '{"search_platform":"OCA\\FullTextSearch_Elasticsearch\\Platform\\ElasticSearchPlatform"}' &>/dev/null || true + $LAUNCHER files_fulltextsearch:configure "{\"files_pdf\":\"1\",\"files_office\":\"1\"}" &>/dev/null || true + + # Is server detected + # if [ curl $HOST ] &>/dev/null; then + # Wait further for cache for index to work + echo "Waiting for a few seconds before indexing starts..." + sleep 10s + if $LAUNCHER fulltextsearch:index &>/dev/null; then + bashio::log.info "Full Text Search was successfully installed using elasticsearch server $HOST!" + + else + + bashio::log.warning "Elasticsearch can't connect. Please manually define its server in the options" + fi +else + echo "Full_Text_Search option not set" +fi diff --git a/nextcloud/rootfs/etc/cont-init.d/99-ocr b/nextcloud/rootfs/etc/cont-init.d/99-ocr new file mode 100644 index 000000000..8d5693f82 --- /dev/null +++ b/nextcloud/rootfs/etc/cont-init.d/99-ocr @@ -0,0 +1,45 @@ +#!/usr/bin/with-contenv bashio + +LAUNCHER="sudo -u abc php /data/config/www/nextcloud/occ" || bashio::log.info "/data/config/www/nextcloud/occ not found" +if ! bashio::fs.file_exists '/data/config/www/nextcloud/occ'; then + LAUNCHER=$(find / -name "occ" -print -quit) +fi || bashio::log.info "occ not found" + +# Make sure there is an Nextcloud installation +if [[ $($LAUNCHER -V) == *"not installed"* ]]; then + bashio::log.warning "It seems there is no Nextcloud server installed. Please restart the addon after initialization of the user." + exit 0 +fi + +# Install OCR if requested +if bashio::config.has_value 'OCR'; then + # Install package + if $(bashio::config 'OCR') = true; then + + # Get Full Text Search app for nextcloud + echo "... installing apps : fulltextsearch" + occ app:install files_fulltextsearch_tesseract &>/dev/null || true + occ app:enable files_fulltextsearch_tesseract &>/dev/null || true + + echo "Installing OCR" + apk add --quiet --no-cache tesseract-ocr || apk add --quiet --no-cache tesseract-ocr@community + # Install additional language if requested + if bashio::config.has_value 'OCRLANG'; then + LANG=$(bashio::config 'OCRLANG') + apk add --quiet --no-cache tesseract-ocr-data-$LANG || apk add --quiet --no-cache tesseract-ocr-data-$LANG@community && \ + bashio::log.info "OCR Language installed : $LANG" || bashio::log.fatal "Couldn't install OCR lang $LANG. Please check its format is conform" + + # Downloading trainer data + cd /usr/share/tessdata + sudo rm -r $LANG.traineddata &>/dev/null || true + wget https://github.com/tesseract-ocr/tessdata/raw/main/$LANG.traineddata &>/dev/null + + fi + elif $(bashio::config 'OCR') = false; then + bashio::log.info 'Removing OCR' + # Delete package + apk del tesseract-ocr.* &>/dev/null || true + # Remove app + occ app:disable files_fulltextsearch_tesseract &>/dev/null || true + fi +fi diff --git a/nextcloud/rootfs/etc/cont-init.d/99-trusted_domains b/nextcloud/rootfs/etc/cont-init.d/99-trusted_domains new file mode 100644 index 000000000..59036b0a9 --- /dev/null +++ b/nextcloud/rootfs/etc/cont-init.d/99-trusted_domains @@ -0,0 +1,48 @@ +#!/usr/bin/with-contenv bashio + +LAUNCHER="sudo -u abc php /data/config/www/nextcloud/occ" || bashio::log.info "/data/config/www/nextcloud/occ not found" +if ! bashio::fs.file_exists '/data/config/www/nextcloud/occ'; then + LAUNCHER=$(find / -name "occ" -print -quit) +fi || bashio::log.info "occ not found" + +# Make sure there is an Nextcloud installation +if [[ $($LAUNCHER -V) == *"not installed"* ]]; then + bashio::log.warning "It seems there is no Nextcloud server installed. Please restart the addon after initialization of the user." + exit 0 +fi + +#################### +# Initialization # +#################### + +if bashio::config.has_value 'trusted_domains'; then + + bashio::log.info "Currently set trusted domains :" + $LAUNCHER config:system:get trusted_domains || bashio::log.info "No trusted domain set yet. The first one will be set when doing initial configuration" + + bashio::log.info "Trusted domains set in the configuration. Refreshing domains." && \ + ################################### + # Remove previous trusted domains # + ################################### + bashio::log.info "... removing previously added trusted domain (except for first one created)" + i=2 + until [ $i -gt 5 ]; do + $LAUNCHER config:system:delete trusted_domains $i && \ + ((i = i + 1)) || exit + done + + ########################### + # Add new trusted domains # + ########################### + TRUSTEDDOMAINS=$(bashio::config 'trusted_domains') + bashio::log.info "... alignement with trusted domains list : ${TRUSTEDDOMAINS}" + for domain in ${TRUSTEDDOMAINS//,/ }; do # Comma separated values + bashio::log.info "... adding ${domain}" + $LAUNCHER config:system:set trusted_domains $i --value=${domain} + i=$((i + 1)) + done + + bashio::log.info "Remaining configurated trusted domains :" + bashio::log.info "$($LAUNCHER config:system:get trusted_domains)" || exit + +fi diff --git a/nextcloud/rootfs/etc/services.d/cron/run b/nextcloud/rootfs/etc/services.d/cron/run new file mode 100644 index 000000000..a1b27f4a7 --- /dev/null +++ b/nextcloud/rootfs/etc/services.d/cron/run @@ -0,0 +1,3 @@ +#!/usr/bin/with-contenv bash + +/usr/sbin/crond -f -S -l 0 -c /etc/crontabs diff --git a/ombi/CHANGELOG.md b/ombi/CHANGELOG.md index e21e4f2b7..278a6f5fb 100644 --- a/ombi/CHANGELOG.md +++ b/ombi/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation ## 4.3.3 (07-11-2021) - Update to latest version from linuxserver/docker-ombi diff --git a/ombi/Dockerfile b/ombi/Dockerfile index 23fd0ce13..a6e70e5b3 100644 --- a/ombi/Dockerfile +++ b/ombi/Dockerfile @@ -1,38 +1,16 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -ENV BASHIO_VERSION=0.14.3 + +################## +# 2 Modify Image # +################## RUN \ - ################ - # Install apps # - ################ - apt-get clean \ - && apt-get update \ - && apt-get install -y --no-install-recommends \ - jq \ - curl \ - # Backup if change - || apk add --no-cache jq curl \ - \ - ################## - # Install bashio # - ################## - && curl -J -L -o /tmp/bashio.tar.gz \ - "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.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/* \ - \ - ############### - # Adapt image # - ############### # 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 \ @@ -43,9 +21,38 @@ RUN \ && grep -rl "/config" /etc/services.d | xargs sed -i 's|/config|/config/ombi|g' || true \ && sed -i 's=/config/ombi=/config/ombi || true=g' /etc/cont-init.d/10-adduser || true -VOLUME [ "/data" ] +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="jq curl" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/ombi/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/ombi/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/ombi/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/ombi/rootfs/etc/cont-init.d/00-banner.sh b/ombi/rootfs/etc/cont-init.d/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/ombi/rootfs/etc/cont-init.d/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/organizr/CHANGELOG.md b/organizr/CHANGELOG.md index 8b1378917..4a854f7ea 100644 --- a/organizr/CHANGELOG.md +++ b/organizr/CHANGELOG.md @@ -1 +1,2 @@ - +- New standardized logic for Dockerfile build and packages installation +- Initial build diff --git a/organizr/Dockerfile b/organizr/Dockerfile index e6357f4aa..88e57c65b 100644 --- a/organizr/Dockerfile +++ b/organizr/Dockerfile @@ -1,25 +1,13 @@ +################# +# 1 Build Image # +################# ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -ENV BASHIO_VERSION=0.14.3 -ENV PACKAGES="curl \ - jq" -RUN \ - ################ - # Install apps # - ################ - apk add --no-cache ${PACKAGES} \ - \ - ################### - # 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 || true +################## +# 2 Modify Image # +################## RUN \ ######################################## @@ -36,10 +24,33 @@ RUN \ && grep -rl '/config' /etc/logrotate.d/ | xargs sed -i 's|/config|/data/organizr|g' \ && grep -rl '/config' /etc/services.d/ | xargs sed -i 's|/config|/data/organizr|g' -# copy local files -COPY root/ / +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="curl \ + jq" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/organizr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/organizr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/organizr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/organizr/rootfs/etc/cont-init.d/00-banner.sh b/organizr/rootfs/etc/cont-init.d/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/organizr/rootfs/etc/cont-init.d/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/organizr/rootfs/etc/cont-init.d/00-folders b/organizr/rootfs/etc/cont-init.d/00-folders new file mode 100644 index 000000000..73c65e4d3 --- /dev/null +++ b/organizr/rootfs/etc/cont-init.d/00-folders @@ -0,0 +1,7 @@ +#!/usr/bin/with-contenv bash + +if [ ! -d /data/organizr ]; then + echo "Creating /data/organizr" + mkdir -p /data/organizr + chown -R abc:abc /data/organizr +fi diff --git a/paperless_ng/CHANGELOG.md b/paperless_ng/CHANGELOG.md index cc74fde3c..db30fd1c7 100644 --- a/paperless_ng/CHANGELOG.md +++ b/paperless_ng/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation - allow !secrets in config.yaml (see Home Assistant documentation) ## 1.5.0 (27-11-2021) diff --git a/paperless_ng/Dockerfile b/paperless_ng/Dockerfile index 677a1693b..4d07acb10 100644 --- a/paperless_ng/Dockerfile +++ b/paperless_ng/Dockerfile @@ -1,35 +1,16 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -# Set shell -ENV BASHIO_VERSION=0.14.3 -ENV PAPERLESS_DATA_DIR=/config/paperless_ng -ENV PACKAGES="jq \ - curl \ - cifs-utils \ - keyutils \ - smbclient \ - samba \ - yamllint" - -RUN apt-get clean && \ - apt-get update && \ - apt-get install -y --no-install-recommends ${PACKAGES} \ - \ - ################## - # 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 || true - -# copy local files -COPY rootfs/ / +################## +# 2 Modify Image # +################## +ENV PAPERLESS_DATA_DIR=/config/paperless_ng RUN \ ################# # Correct image # @@ -42,7 +23,44 @@ RUN \ && sed -i "s|/config|$PAPERLESS_DATA_DIR|g" /etc/cont-init.d/10-adduser \ && sed -i "s|/config|$PAPERLESS_DATA_DIR|g" /etc/cont-init.d/50-config -### LABELS +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="jq \ + curl \ + cifs-utils \ + keyutils \ + smbclient \ + samba \ + yamllint" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ + ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/paperless_ng/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/paperless_ng/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 612e26d7e..4f9ed9c51 100644 --- a/paperless_ng/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/paperless_ng/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -1,29 +1,18 @@ #!/bin/bash # If dockerfile failed install manually -if [ ! -f "/usr/bin/bashio" ]; then - echo "Bashio does not exist, executing script" +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null \ - || apk add --no-cache ${PACKAGES} - - ################### - # 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 - + ####################### + # Automatic installer # + ####################### + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/paperless_ng/rootfs/etc/cont-init.d/90-config_yaml.sh b/paperless_ng/rootfs/etc/cont-init.d/90-config_yaml.sh index 00646fc3f..e37468ce2 100644 --- a/paperless_ng/rootfs/etc/cont-init.d/90-config_yaml.sh +++ b/paperless_ng/rootfs/etc/cont-init.d/90-config_yaml.sh @@ -83,8 +83,8 @@ while IFS= read -r line; do if [[ $line =~ ^.+[=].+$ ]]; then export $line # Export the variable - sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || sed -i "1a export $line" /scripts/*run* - + sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || true + sed -i "1a export $line" /scripts/*run* 2>/dev/null || true # Show in log bashio::log.blue "$line" else diff --git a/papermerge/CHANGELOG.md b/papermerge/CHANGELOG.md index 78ae76daa..d5a91d9b5 100644 --- a/papermerge/CHANGELOG.md +++ b/papermerge/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation - OCR repaired - Improve SMB mount code to v1.5 ; accepts several network disks separated by commas (//123.12.12.12/share,//123.12.12.12/hello) that are mount to /mnt/$sharename diff --git a/papermerge/Dockerfile b/papermerge/Dockerfile index dff969a6c..b8dd80591 100644 --- a/papermerge/Dockerfile +++ b/papermerge/Dockerfile @@ -1,37 +1,14 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION - FROM ${BUILD_FROM} -# Add bashio -ENV BASHIO_VERSION=0.14.3 -ENV PACKAGES="jq \ - curl \ - cifs-utils \ - keyutils \ - samba \ - smbclient" - -RUN \ - ################ - # Install apps # - ################ - apt-get clean \ - && apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} \ - \ - ################## - # 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 || true - -# Copy root filesystem -COPY rootfs / +################## +# 2 Modify Image # +################## RUN \ # Allow UID and GID setting @@ -42,9 +19,43 @@ RUN \ && sed -i "s| /config| /data/config|g" /etc/cont-init.d/* \ && sed -i "s| /config| /data/config|g" /defaults/* || true -VOLUME [ "/data" ] +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="jq \ + curl \ + cifs-utils \ + keyutils \ + samba \ + smbclient" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/papermerge/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/papermerge/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 612e26d7e..4f9ed9c51 100644 --- a/papermerge/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/papermerge/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -1,29 +1,18 @@ #!/bin/bash # If dockerfile failed install manually -if [ ! -f "/usr/bin/bashio" ]; then - echo "Bashio does not exist, executing script" +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null \ - || apk add --no-cache ${PACKAGES} - - ################### - # 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 - + ####################### + # Automatic installer # + ####################### + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/papermerge/rootfs/etc/cont-init.d/91-OCR b/papermerge/rootfs/etc/cont-init.d/91-OCR index 6bfb0ccf8..e642780f0 100644 --- a/papermerge/rootfs/etc/cont-init.d/91-OCR +++ b/papermerge/rootfs/etc/cont-init.d/91-OCR @@ -4,17 +4,17 @@ OCRLANG="$(bashio::config "ocrlang")" if [ -n "$OCRLANG" ]; then - LINE=$(sed -n '/OCR_LANGUAGES/=' /data/config/papermerge.conf.py) + LINE=$(sed -n '/OCR_LANGUAGES/=' /data/config/papermerge.conf.py) bashio::log.info "OCRLANG variable is set, processing the language packages" apt-get update >/dev/null for i in $(echo "$OCRLANG" | tr "," " "); do - if apt-cache show tesseract-ocr-"${i}" > /dev/null 2>&1; then + if apt-cache show tesseract-ocr-"${i}" >/dev/null 2>&1; then echo "installing tesseract-ocr-${i}" >/dev/null - apt-get install -y tesseract-ocr-"${i}" >/dev/null + apt-get install -yqq tesseract-ocr-"${i}" >/dev/null else echo "package tesseract-ocr-${i} not found in the repository, skipping" fi - sed -i "$LINE a \"${i}\": \"${i}\"," /data/config/papermerge.conf.py - bashio::log.info "... ${i} installed" + sed -i "$LINE a \"${i}\": \"${i}\"," /data/config/papermerge.conf.py + bashio::log.info "... ${i} installed" done fi diff --git a/photoprism/CHANGELOG.md b/photoprism/CHANGELOG.md index 5bedd9f1d..ff6989aff 100644 --- a/photoprism/CHANGELOG.md +++ b/photoprism/CHANGELOG.md @@ -1,3 +1,7 @@ + +## 20211210 (12-12-2021) +- Update to latest version from photoprism/photoprism +- New standardized logic for Dockerfile build and packages installation - Allow mounting local drives by label. Just pust the label instead of sda1 for example - Allow mounting of devices up to sdg2 - Improve SMB mount code to v1.5 ; accepts several network disks separated by commas (//123.12.12.12/share,//123.12.12.12/hello) that are mount to /mnt/$sharename diff --git a/photoprism/Dockerfile b/photoprism/Dockerfile index 4f1bbebc2..3f59e29c1 100644 --- a/photoprism/Dockerfile +++ b/photoprism/Dockerfile @@ -1,43 +1,17 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION -ARG BUILD_UPSTREAM="210217-49039368" -FROM photoprism/photoprism:preview +ARG BUILD_UPSTREAM="20211210" +FROM photoprism/photoprism:20211203 -# Copy root filesystem -COPY rootfs / - -ENV BASHIO_VERSION=0.14.3 -ENV PACKAGES="jq \ - curl \ - cifs-utils \ - keyutils \ - samba \ - smbclient \ - coreutils" +################## +# 2 Modify Image # +################## RUN \ - ################ - # Install apps # - ################ - apt-get clean \ - && apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} \ - \ - ################## - # 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 || true - -RUN \ - ################### - # Configure image # - ################### - \ # Create directories mkdir -m 777 -p \ /data/photoprism/originals \ @@ -46,14 +20,47 @@ RUN \ /data/photoprism/backup \ /data/photoprism/storage/cache && \ chown -Rf photoprism:photoprism /data/photoprism && \ - chmod -Rf a+rwx /data/photoprism \ - # Allow execution of run - && chmod 777 /run.sh + chmod -Rf a+rwx /data/photoprism && \ + # rename entrypoint + mv /entrypoint.sh /entrypoint_photoprism.sh + +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="jq \ + curl \ + cifs-utils \ + keyutils \ + samba \ + smbclient \ + coreutils" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +RUN chmod 777 /entrypoint.sh ENTRYPOINT [ "/usr/bin/env" ] -CMD [ "/run.sh" ] +CMD [ "/entrypoint.sh" ] + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/photoprism/config.json b/photoprism/config.json index f6b5e0d67..017fcea2d 100644 --- a/photoprism/config.json +++ b/photoprism/config.json @@ -1,6 +1,8 @@ { "apparmor": true, - "arch": ["aarch64", "amd64", "armhf", "armv7"], + "arch": [ + "amd64" + ], "description": "A server-based application for browsing, organizing and sharing your personal photo collection", "devices": [ "/dev/sda", @@ -33,7 +35,10 @@ "environment": { "PHOTOPRISM_ADMIN_PASSWORD": "please_change_password" }, - "map": ["media:rw", "share:rw"], + "map": [ + "media:rw", + "share:rw" + ], "name": "Photoprism", "options": { "networkdisks": "//server/share", @@ -52,7 +57,10 @@ "ports_description": { "2342/tcp": "Web interface" }, - "privileged": ["SYS_ADMIN", "DAC_READ_SEARCH"], + "privileged": [ + "SYS_ADMIN", + "DAC_READ_SEARCH" + ], "schema": { "localdisks": "str?", "networkdisks": "str?", @@ -66,8 +74,8 @@ "CUSTOM_OPTIONS": "str?" }, "slug": "photoprism", - "upstream": "210217-49039368", + "upstream": "20211210", "url": "https://github.com/alexbelgium/hassio-addons-test", - "version": "210217-49039368-5", + "version": "20211210", "webui": "http://[HOST]:[PORT:2342]" } diff --git a/photoprism/rootfs/entrypoint.sh b/photoprism/rootfs/entrypoint.sh new file mode 100644 index 000000000..35ccb7382 --- /dev/null +++ b/photoprism/rootfs/entrypoint.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +echo "Starting..." + +#################### +# Starting scripts # +#################### + +cd / +for SCRIPTS in scripts/*; do + [ -e "$SCRIPTS" ] || continue + echo "$SCRIPTS: executing" + chown $(id -u):$(id -g) $SCRIPTS + chmod a+x $SCRIPTS + sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' $SCRIPTS || true + ./$SCRIPTS || echo "$SCRIPTS: exiting $?" +done diff --git a/photoprism/rootfs/scripts/00-aaa_dockerfile_backup.sh b/photoprism/rootfs/scripts/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/photoprism/rootfs/scripts/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/photoprism/rootfs/scripts/00-banner.sh b/photoprism/rootfs/scripts/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/photoprism/rootfs/scripts/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/photoprism/rootfs/scripts/92-local_mounts.sh b/photoprism/rootfs/scripts/92-local_mounts.sh new file mode 100644 index 000000000..0920d68bd --- /dev/null +++ b/photoprism/rootfs/scripts/92-local_mounts.sh @@ -0,0 +1,32 @@ +#!/usr/bin/with-contenv bashio + +###################### +# MOUNT LOCAL SHARES # +###################### + +# Mount local Share if configured +if bashio::config.has_value 'localdisks'; then + + MOREDISKS=$(bashio::config 'localdisks') + echo "Local Disks mounting..." + + # Separate comma separated values + for disk in ${MOREDISKS//,/ }; do + + # Mount by device as default + devpath=/dev + + # Mount as label + [ ${disk:0:2} != "sd" ] && devpath=/dev/disk/by-label + + # Creates dir + mkdir -p /mnt/$disk + chown -R $(id -u):$(id -g) /mnt/$disk + # Legacy mounting : mount to share if still exists (avoid breaking changes) + [ -d /share/$disk ] && mount $devpath/$disk /share/$disk || true + # Mount + mount $devpath/$disk /mnt/$disk && bashio::log.info "Success! $disk mounted to /mnt/$disk" || (bashio::log.fatal "Unable to mount local drives! Please check the name." && rmdir /mnt/$disk) + + done + +fi diff --git a/photoprism/rootfs/scripts/92-smb_mounts.sh b/photoprism/rootfs/scripts/92-smb_mounts.sh new file mode 100644 index 000000000..06410e554 --- /dev/null +++ b/photoprism/rootfs/scripts/92-smb_mounts.sh @@ -0,0 +1,83 @@ +#!/usr/bin/with-contenv bashio + +######################### +# MOUNT SMB SHARES v1.6 # +######################### +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="" + + # Mount CIFS Share if configured and if Protection Mode is active + echo '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//,/ }; do # Separate comma separated values + + # 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 + + # Data validation + if [[ ! $disk =~ ^.*+[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[/]+.*+$ ]]; then + bashio::log.fatal "The structure of your \"networkdisks\" option : \"$disk\" doesn't seem correct, please use a structure like //123.12.12.12/sharedfolder,//123.12.12.12/sharedfolder2. If you don't use it, you can simply remove the text, this will avoid this error message in the future." + exit 0 + fi + + # 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:-WORKGROUP}"; 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 + + # Messages + if [ $MOUNTED = true ] && [ "mountpoint -q /mnt/$diskname" ]; 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 + # Mounting failed messages + bashio::log.fatal "Error, 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" + bashio::log.fatal "Here is some debugging info :" + + # Provide debugging info + smbclient -V &>/dev/null || apt-get install smbclient || apk add --no-cache samba-client + #smbclient $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + smbclient -L $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + + # Error code + bashio::log.fatal "Error read : $(/dev/null || true + rmdir /mnt/$diskname || true + fi + + done +fi diff --git a/photoprism/rootfs/scripts/99-run.sh b/photoprism/rootfs/scripts/99-run.sh new file mode 100644 index 000000000..7bc8615af --- /dev/null +++ b/photoprism/rootfs/scripts/99-run.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bashio + +############## +# LAUNCH APP # +############## + +# Configure app +export PHOTOPRISM_UPLOAD_NSFW=$(bashio::config 'UPLOAD_NSFW') +export PHOTOPRISM_STORAGE_PATH=$(bashio::config 'STORAGE_PATH') +export PHOTOPRISM_ORIGINALS_PATH=$(bashio::config 'ORIGINALS_PATH') +export PHOTOPRISM_IMPORT_PATH=$(bashio::config 'IMPORT_PATH') +export PHOTOPRISM_BACKUP_PATH=$(bashio::config 'BACKUP_PATH') + +if bashio::config.has_value 'CUSTOM_OPTIONS'; then + CUSTOMOPTIONS=$(bashio::config 'CUSTOM_OPTIONS') +else + CUSTOMOPTIONS="" +fi + +# Test configs +for variabletest in $PHOTOPRISM_STORAGE_PATH $PHOTOPRISM_ORIGINALS_PATH $PHOTOPRISM_IMPORT_PATH $PHOTOPRISM_BACKUP_PATH; do + # Check if path exists + if bashio::fs.directory_exists $variabletest; then + true + else + bashio::log.info "Path $variabletest doesn't exist. Creating it now..." + mkdir -p $variabletest || bashio::log.fatal "Can't create $variabletest path" + fi + # Check if path writable + touch $variabletest/aze && rm $variabletest/aze || bashio::log.fatal "$variable path is not writable" +done + +# Start messages +bashio::log.info "Please wait 1 or 2 minutes to allow the server to load" +bashio::log.info 'Default username : admin, default password: "please_change_password"' + +cd / +./entrypoint_photoprism.sh photoprism start '"'$CUSTOMOPTIONS'"' diff --git a/piwigo/CHANGELOG.md b/piwigo/CHANGELOG.md index 0adf39619..2b0ff66c3 100644 --- a/piwigo/CHANGELOG.md +++ b/piwigo/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation ## 12.1.0 (13-11-2021) - Update to latest version from linuxserver/docker-piwigo diff --git a/piwigo/Dockerfile b/piwigo/Dockerfile index f2e9ec040..311ee065e 100644 --- a/piwigo/Dockerfile +++ b/piwigo/Dockerfile @@ -1,50 +1,56 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -ENV BASHIO_VERSION=0.14.3 -ENV PACKAGES="jq \ - curl \ - cifs-utils" -# Copy root filesystem -COPY rootfs / - -VOLUME [ "/data" ] - -RUN \ - # Install bashio - apk add --no-cache ${PACKAGES} \ - \ - && curl -J -L -o /tmp/bashio.tar.gz \ - "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.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/* || true +################## +# 2 Modify Image # +################## RUN \ # 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 -# Use subfolder in config -# Protect files starting by config. -# && files=$(grep -rl '/config.' /etc/cont-init.d/*) && echo $files | xargs sed -i 's|/config.|/temptemp.|g' \ -# && files=$(grep -rl '/config' /defaults/*) && echo $files | xargs sed -i 's|/config|/share/piwigo|g' \ -# && files=$(grep -rl '/config' /etc/cont-init.d/*) && echo $files | xargs sed -i 's|/config|/share/piwigo|g' \ -# && files=$(grep -rl '/temptemp.' /etc/cont-init.d/*) && echo $files | xargs sed -i 's|/temptemp.|/config.|g' -# && files=$(grep -rl "/config/" /etc/services.d/*) && echo $files | xargs sed -i "s|/config/|/share/piwigo|g" -# && files=$(grep -rl " /config" /etc/cont-init.d/*) && echo $files | xargs sed -i "s= /config= /config/piwigo=g" -# && files=$(grep -rl '/data/config.inc.php' /defaults/*) && echo $files | xargs sed -i 's|/data/config.inc.php|/config/config.inc.php|g' || true \ -# && files=$(grep -rl '/data/config.inc.php' /etc/cont-init.d/*) && echo $files | xargs sed -i 's|/data/config.inc.php|/config/config.inc.php|g' \ -# && sed -i '2i cp -vnpr /config/* /data || true' /etc/cont-init.d/00-banner.sh -### LABELS + +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="jq \ + curl \ + cifs-utils" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ + ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/piwigo/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/piwigo/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 612e26d7e..4f9ed9c51 100644 --- a/piwigo/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/piwigo/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -1,29 +1,18 @@ #!/bin/bash # If dockerfile failed install manually -if [ ! -f "/usr/bin/bashio" ]; then - echo "Bashio does not exist, executing script" +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null \ - || apk add --no-cache ${PACKAGES} - - ################### - # 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 - + ####################### + # Automatic installer # + ####################### + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/plex/CHANGELOG.md b/plex/CHANGELOG.md index fd3718277..1e1d5a54a 100644 --- a/plex/CHANGELOG.md +++ b/plex/CHANGELOG.md @@ -1,4 +1,8 @@ +## 1.25.2.5319-c43dc0277-ls92 (14-12-2021) +- Update to latest version from linuxserver/docker-plex +- New standardized logic for Dockerfile build and packages installation + ## 1.25.1.5286-34f965be8-ls91 (07-12-2021) - Update to latest version from linuxserver/docker-plex - localdisks: sda1 #put the hardware name of your drive to mount separated by commas, or its label. Ex: sda1, sdb1, MYNAS... diff --git a/plex/Dockerfile b/plex/Dockerfile index 3d1a78b03..b7d3b5309 100644 --- a/plex/Dockerfile +++ b/plex/Dockerfile @@ -1,38 +1,18 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} +################## +# 2 Modify Image # +################## + # Set shell SHELL ["/bin/bash", "-o", "pipefail", "-c"] -# copy local files -COPY root/ / - -ENV BASHIO_VERSION=0.14.3 -ENV PACKAGES="jq \ - cifs-utils \ - keyutils \ - samba \ - smbclient" - -RUN \ - ################ - # Install apps # - ################ - apt-get clean \ - && apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} \ - \ - ################## - # 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 || true - RUN \ ############################# # Allow UID and GID setting # @@ -50,14 +30,44 @@ RUN \ && sed -i 's/with-contenv bash/with-contenv bashio/g' /etc/cont-init.d/45-plex-claim \ && sed -i '2iexport PLEX_CLAIM=$(bashio::config "claim")' /etc/cont-init.d/45-plex-claim \ && sed -i '3i[ $PLEX_CLAIM = "Get_from_https://www.plex.tv/claim" ] && bashio::log.warning "Please change the PLEX_CLAIM code from the options" && exit 1 || true' /etc/cont-init.d/45-plex-claim -########### -# FOLDERS # -########### -# && files=$(grep -rl '/config' /etc/cont-init.d/*) && echo $files | xargs sed -i 's|/config|/data|g' \ -# && sed -i "s|/config|/data|g" /defaults/plexmediaserver \ -# && sed -i '2i cp -vnpr /config /data || true' /etc/cont-init.d/00-banner.sh -### LABELS + +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="jq \ + cifs-utils \ + keyutils \ + samba \ + smbclient" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ + ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/plex/config.json b/plex/config.json index 748daffe5..13a2b69cc 100644 --- a/plex/config.json +++ b/plex/config.json @@ -109,9 +109,9 @@ }, "slug": "plex_nas", "startup": "services", - "upstream": "1.25.1.5286-34f965be8-ls91", + "upstream": "1.25.2.5319-c43dc0277-ls92", "url": "https://github.com/alexbelgium/hassio-addons", - "version": "1.25.1.5286-34f965be8-ls91", + "version": "1.25.2.5319-c43dc0277-ls92", "video": true, "webui": "http://[HOST]:[PORT:32400]/web" } diff --git a/plex/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/plex/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/plex/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/plex/rootfs/etc/cont-init.d/00-banner.sh b/plex/rootfs/etc/cont-init.d/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/plex/rootfs/etc/cont-init.d/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/plex/rootfs/etc/cont-init.d/21-folders b/plex/rootfs/etc/cont-init.d/21-folders new file mode 100644 index 000000000..afb2a6707 --- /dev/null +++ b/plex/rootfs/etc/cont-init.d/21-folders @@ -0,0 +1,26 @@ +#!/usr/bin/with-contenv bash + +################## +# SYMLINK CONFIG # +################## + +echo "Database stored in /share/plex" + +if [ ! -d "/share/plex/Plex Media Server" ]; then +echo "... creating /share/plex/Plex Media Server" +mkdir -p "/share/plex/Plex Media Server" +fi + +if [ -d "/config/Library/Application Support/Plex Media Server" ]; then + echo "... creating /symlink" + rm -r "/config/Library/Application Support/*" + ln -s "/share/plex/Plex Media Server" "/config/Library/Application Support" +fi + +if [ ! -d "/config/Library/Application Support" ]; then + echo "... creating /symlink" + mkdir -p "/config/Library/Application Support" + ln -s "/share/plex/Plex Media Server" "/config/Library/Application Support" +fi + +chown -R abc:abc /share/plex diff --git a/plex/rootfs/etc/cont-init.d/90-create_links b/plex/rootfs/etc/cont-init.d/90-create_links new file mode 100644 index 000000000..8cca2b550 --- /dev/null +++ b/plex/rootfs/etc/cont-init.d/90-create_links @@ -0,0 +1,24 @@ +#!/usr/bin/with-contenv bash + +################## +# SYMLINK CONFIG # +################## + +if [ ! -d /share/plex ]; then + echo "Creating /share/plex" + mkdir -p /share/plex + chown -R abc:abc /share/plex +else + chown -R abc:abc /share/plex +fi + +if [ ! -d /share/plex/Library ]; then + echo "moving Library folder" + mv /config/Library /share/plex + ln -s /share/plex/Library /config + echo "links done" +else + rm -r /config/Library + ln -s /share/plex/Library /config + echo "Using existing config" +fi diff --git a/plex/rootfs/etc/cont-init.d/92-local_mounts.sh b/plex/rootfs/etc/cont-init.d/92-local_mounts.sh new file mode 100644 index 000000000..0920d68bd --- /dev/null +++ b/plex/rootfs/etc/cont-init.d/92-local_mounts.sh @@ -0,0 +1,32 @@ +#!/usr/bin/with-contenv bashio + +###################### +# MOUNT LOCAL SHARES # +###################### + +# Mount local Share if configured +if bashio::config.has_value 'localdisks'; then + + MOREDISKS=$(bashio::config 'localdisks') + echo "Local Disks mounting..." + + # Separate comma separated values + for disk in ${MOREDISKS//,/ }; do + + # Mount by device as default + devpath=/dev + + # Mount as label + [ ${disk:0:2} != "sd" ] && devpath=/dev/disk/by-label + + # Creates dir + mkdir -p /mnt/$disk + chown -R $(id -u):$(id -g) /mnt/$disk + # Legacy mounting : mount to share if still exists (avoid breaking changes) + [ -d /share/$disk ] && mount $devpath/$disk /share/$disk || true + # Mount + mount $devpath/$disk /mnt/$disk && bashio::log.info "Success! $disk mounted to /mnt/$disk" || (bashio::log.fatal "Unable to mount local drives! Please check the name." && rmdir /mnt/$disk) + + done + +fi diff --git a/plex/rootfs/etc/cont-init.d/92-smb_mounts.sh b/plex/rootfs/etc/cont-init.d/92-smb_mounts.sh new file mode 100644 index 000000000..06410e554 --- /dev/null +++ b/plex/rootfs/etc/cont-init.d/92-smb_mounts.sh @@ -0,0 +1,83 @@ +#!/usr/bin/with-contenv bashio + +######################### +# MOUNT SMB SHARES v1.6 # +######################### +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="" + + # Mount CIFS Share if configured and if Protection Mode is active + echo '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//,/ }; do # Separate comma separated values + + # 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 + + # Data validation + if [[ ! $disk =~ ^.*+[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[/]+.*+$ ]]; then + bashio::log.fatal "The structure of your \"networkdisks\" option : \"$disk\" doesn't seem correct, please use a structure like //123.12.12.12/sharedfolder,//123.12.12.12/sharedfolder2. If you don't use it, you can simply remove the text, this will avoid this error message in the future." + exit 0 + fi + + # 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:-WORKGROUP}"; 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 + + # Messages + if [ $MOUNTED = true ] && [ "mountpoint -q /mnt/$diskname" ]; 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 + # Mounting failed messages + bashio::log.fatal "Error, 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" + bashio::log.fatal "Here is some debugging info :" + + # Provide debugging info + smbclient -V &>/dev/null || apt-get install smbclient || apk add --no-cache samba-client + #smbclient $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + smbclient -L $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + + # Error code + bashio::log.fatal "Error read : $(/dev/null || true + rmdir /mnt/$diskname || true + fi + + done +fi diff --git a/portainer/CHANGELOG.md b/portainer/CHANGELOG.md index 3afb43cf5..f75560a0c 100644 --- a/portainer/CHANGELOG.md +++ b/portainer/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation ## 2.11.0 (09-12-2021) - Update to latest version from portainer/portainer diff --git a/portainer/Dockerfile b/portainer/Dockerfile index f575ddf29..1aad2aed6 100644 --- a/portainer/Dockerfile +++ b/portainer/Dockerfile @@ -1,14 +1,20 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:9.2.0 -# hadolint ignore=DL3006 FROM ${BUILD_FROM} +################## +# 2 Modify Image # +################## + # Set shell SHELL ["/bin/bash", "-o", "pipefail", "-c"] # Setup base ARG BUILD_ARCH=amd64 ARG BUILD_UPSTREAM="2.11.0" -ENV PACKAGES="nginx" RUN \ if [ "${BUILD_ARCH}" = "aarch64" ]; then ARCH="arm64"; fi \ @@ -20,13 +26,38 @@ RUN \ "https://github.com/portainer/portainer/releases/download/${BUILD_UPSTREAM}/portainer-${BUILD_UPSTREAM}-linux-${ARCH}.tar.gz" \ | tar zxvf - -C /opt/ -RUN \ - apk add --no-cache ${PACKAGES} || true +################## +# 3 Install apps # +################## -# Copy root filesystem -COPY rootfs / +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="nginx" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/portainer/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/portainer/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 612e26d7e..4f9ed9c51 100644 --- a/portainer/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/portainer/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -1,29 +1,18 @@ #!/bin/bash # If dockerfile failed install manually -if [ ! -f "/usr/bin/bashio" ]; then - echo "Bashio does not exist, executing script" +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null \ - || apk add --no-cache ${PACKAGES} - - ################### - # 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 - + ####################### + # Automatic installer # + ####################### + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/prowlarr/CHANGELOG.md b/prowlarr/CHANGELOG.md index 7e164722d..cdbf54a11 100644 --- a/prowlarr/CHANGELOG.md +++ b/prowlarr/CHANGELOG.md @@ -1,4 +1,11 @@ +## nightly-0.1.8.1253-ls229 (14-12-2021) +- Update to latest version from linuxserver/docker-prowlarr + +## nightly-0.1.8.1238-ls228 (12-12-2021) +- Update to latest version from linuxserver/docker-prowlarr +- New standardized logic for Dockerfile build and packages installation + ## nightly-0.1.8.1232-ls226 (10-12-2021) - Update to latest version from linuxserver/docker-prowlarr diff --git a/prowlarr/Dockerfile b/prowlarr/Dockerfile index 59efa0590..b35361e06 100644 --- a/prowlarr/Dockerfile +++ b/prowlarr/Dockerfile @@ -1,38 +1,18 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -ENV BASHIO_VERSION=0.14.3 -ENV PACKAGES="jq \ - curl \ - cifs-utils \ - keyutils \ - samba \ - smbclient" + +################## +# 2 Modify Image # +################## RUN \ - ################ - # Install apps # - ################ - apt-get clean \ - && apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} \ - \ - ################### - # 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 \ - \ - ######################################## - # Correct upstream image folders links # - ######################################## - \ # Allow UID and GID setting - && sed -i 's/bash/bashio/g' /etc/cont-init.d/10-adduser \ + 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 \ \ @@ -41,10 +21,43 @@ RUN \ && sed -i 's= /config=/config/prowlarr || true=g' /etc/cont-init.d/30-config \ && sed -i 's|/config|/config/prowlarr|g' /etc/services.d/prowlarr/run -# copy local files -COPY root/ / +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="jq \ + curl \ + cifs-utils \ + keyutils \ + samba \ + smbclient" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/prowlarr/config.json b/prowlarr/config.json index 9d0e0683c..5261eee03 100644 --- a/prowlarr/config.json +++ b/prowlarr/config.json @@ -47,8 +47,8 @@ }, "slug": "prowlarr", "startup": "services", - "upstream": "nightly-0.1.8.1232-ls226", + "upstream": "nightly-0.1.8.1253-ls229", "url": "https://github.com/alexbelgium/hassio-addons", - "version": "nightly-0.1.8.1232-ls226", + "version": "nightly-0.1.8.1253-ls229", "webui": "http://[HOST]:[PORT:9696]" } diff --git a/prowlarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/prowlarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/prowlarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/prowlarr/rootfs/etc/cont-init.d/00-banner.sh b/prowlarr/rootfs/etc/cont-init.d/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/prowlarr/rootfs/etc/cont-init.d/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/prowlarr/rootfs/etc/cont-init.d/00-ha-env b/prowlarr/rootfs/etc/cont-init.d/00-ha-env new file mode 100644 index 000000000..3b3e69246 --- /dev/null +++ b/prowlarr/rootfs/etc/cont-init.d/00-ha-env @@ -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 \ No newline at end of file diff --git a/prowlarr/rootfs/etc/cont-init.d/20-folders b/prowlarr/rootfs/etc/cont-init.d/20-folders new file mode 100644 index 000000000..a40d5c92e --- /dev/null +++ b/prowlarr/rootfs/etc/cont-init.d/20-folders @@ -0,0 +1,7 @@ +#!/usr/bin/with-contenv bash + +if [ ! -d /config/prowlarr ]; then + echo "Creating /config/radarr" + mkdir -p /config/prowlarr + chown -R abc:abc /config/prowlarr +fi diff --git a/prowlarr/rootfs/etc/cont-init.d/92-smb_mounts.sh b/prowlarr/rootfs/etc/cont-init.d/92-smb_mounts.sh new file mode 100644 index 000000000..06410e554 --- /dev/null +++ b/prowlarr/rootfs/etc/cont-init.d/92-smb_mounts.sh @@ -0,0 +1,83 @@ +#!/usr/bin/with-contenv bashio + +######################### +# MOUNT SMB SHARES v1.6 # +######################### +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="" + + # Mount CIFS Share if configured and if Protection Mode is active + echo '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//,/ }; do # Separate comma separated values + + # 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 + + # Data validation + if [[ ! $disk =~ ^.*+[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[/]+.*+$ ]]; then + bashio::log.fatal "The structure of your \"networkdisks\" option : \"$disk\" doesn't seem correct, please use a structure like //123.12.12.12/sharedfolder,//123.12.12.12/sharedfolder2. If you don't use it, you can simply remove the text, this will avoid this error message in the future." + exit 0 + fi + + # 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:-WORKGROUP}"; 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 + + # Messages + if [ $MOUNTED = true ] && [ "mountpoint -q /mnt/$diskname" ]; 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 + # Mounting failed messages + bashio::log.fatal "Error, 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" + bashio::log.fatal "Here is some debugging info :" + + # Provide debugging info + smbclient -V &>/dev/null || apt-get install smbclient || apk add --no-cache samba-client + #smbclient $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + smbclient -L $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + + # Error code + bashio::log.fatal "Error read : $(/dev/null || true + rmdir /mnt/$diskname || true + fi + + done +fi diff --git a/qbittorrent/CHANGELOG.md b/qbittorrent/CHANGELOG.md index 12a8d0cac..35eb5e419 100644 --- a/qbittorrent/CHANGELOG.md +++ b/qbittorrent/CHANGELOG.md @@ -1,3 +1,6 @@ +- Removed watchdog +- New standardized logic for Dockerfile build and packages installation +- Allow mounting nvme - Allow mounting local drives by label. Just pust the label instead of sda1 for example ## 14.3.9.99202110311443-7435-01519b5e7ubuntu20.04.1-ls159 (31-10-2021) diff --git a/qbittorrent/Dockerfile b/qbittorrent/Dockerfile index 1710c7e53..af4977373 100644 --- a/qbittorrent/Dockerfile +++ b/qbittorrent/Dockerfile @@ -1,14 +1,14 @@ -############### -# Build Image # -############### +################# +# 1 Build Image # +################# ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -################ -# Modify Image # -################ +################## +# 2 Modify Image # +################## # Environment variables ENV \ @@ -20,9 +20,6 @@ ENV \ TERM="xterm-256color" RUN \ - ######################################## - # Correct upstream image folders links # - ######################################## # 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 \ @@ -40,9 +37,9 @@ RUN \ && echo 'WebUI\HostHeaderValidation=false' >> /defaults/qBittorrent.conf \ && echo 'WebUI\LocalHostAuth=false' >> /defaults/qBittorrent.conf || true -################ -# Install apps # -################ +################## +# 3 Install apps # +################## # Copy local files COPY rootfs/ / @@ -58,20 +55,20 @@ ENV PACKAGES="jq \ openvpn" # Automatic apps & bashio -RUN $(ls /bin/bash &>/dev/null) || (apt-get install -y --no-install-recommends bash || apk add --no-cache bash) && \ - $(curl --help &>/dev/null) || (apt-get install -y --no-install-recommends curl || apk add --no-cache curl) && \ +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ chmod 777 /automatic_packages.sh && \ /automatic_packages.sh "${PACKAGES:-}" && \ rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE -############## -# Entrypoint # -############## +################ +# 4 Entrypoint # +################ -########## -# Labels # -########## +############ +# 5 Labels # +############ ARG BUILD_ARCH ARG BUILD_DATE diff --git a/qbittorrent/config.json b/qbittorrent/config.json index 36571c8d9..2354f2f2d 100644 --- a/qbittorrent/config.json +++ b/qbittorrent/config.json @@ -98,7 +98,6 @@ "slug": "qbittorrent", "upstream": "14.3.9.99202110311443-7435-01519b5e7ubuntu20.04.1-ls159", "url": "https://github.com/alexbelgium/hassio-addons", - "version": "14.3.9.99202110311443-7435-01519b5e7ubuntu20.04.1-ls160", - "watchdog": "[PROTO:ssl]://[HOST]:[PORT:8080]", + "version": "14.3.9.99202110311443-7435-01519b5e7ubuntu20.04.1-ls160-2", "webui": "[PROTO:ssl]://[HOST]:[PORT:8080]" } diff --git a/qbittorrent/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/qbittorrent/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index e33f7f063..187df42f7 100644 --- a/qbittorrent/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/qbittorrent/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -2,14 +2,14 @@ # If dockerfile failed install manually if [ -e "/ENVFILE" ]; then echo "Executing script" - PACKAGES=$(< /ENVFILE) + PACKAGES=$(/dev/null) || (apt-get install -y --no-install-recommends bash || apk add --no-cache bash) && \ - $(curl --help &>/dev/null) || (apt-get install -y --no-install-recommends curl &>/dev/null || apk add --no-cache curl) && \ - curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + $(curl --help &>/dev/null) || (apt-get update && apt-get install -yqq --no-install-recommends curl &>/dev/null || apk add --no-cache curl) && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ chmod 777 /automatic_packages.sh && \ eval /./automatic_packages.sh "$PACKAGES" && \ rm /automatic_packages.sh diff --git a/radarr/CHANGELOG.md b/radarr/CHANGELOG.md index a7a3d6190..af078aef5 100644 --- a/radarr/CHANGELOG.md +++ b/radarr/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation - Allow mounting local drives by label. Just pust the label instead of sda1 for example - Improve SMB mount code to v1.5 ; accepts several network disks separated by commas (//123.12.12.12/share,//123.12.12.12/hello) that are mount to /mnt/$sharename - Breaking changes : multiple network disks must be separated by a "," and they are mounted to a folder with the name of the external share. diff --git a/radarr/Dockerfile b/radarr/Dockerfile index ea95c9f49..a728b068c 100644 --- a/radarr/Dockerfile +++ b/radarr/Dockerfile @@ -1,31 +1,14 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -ENV BASHIO_VERSION=0.14.3 -ENV PACKAGES="jq \ - curl \ - cifs-utils \ - keyutils \ - samba \ - smbclient" -RUN \ - ################ - # Install apps # - ################ - apt-get clean \ - && apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} \ - \ - ################### - # 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 || true +################## +# 2 Modify Image # +################## RUN \ # use /data instead of /config for hass.io environment @@ -37,10 +20,45 @@ RUN \ && 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 +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV BASHIO_VERSION=0.14.3 +ENV PACKAGES="jq \ + curl \ + cifs-utils \ + keyutils \ + samba \ + smbclient" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ + ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/radarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/radarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/radarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/radarr/rootfs/etc/cont-init.d/00-banner.sh b/radarr/rootfs/etc/cont-init.d/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/radarr/rootfs/etc/cont-init.d/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/radarr/rootfs/etc/cont-init.d/00-ha-env b/radarr/rootfs/etc/cont-init.d/00-ha-env new file mode 100644 index 000000000..d0b511f60 --- /dev/null +++ b/radarr/rootfs/etc/cont-init.d/00-ha-env @@ -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 diff --git a/radarr/rootfs/etc/cont-init.d/20-folders b/radarr/rootfs/etc/cont-init.d/20-folders new file mode 100644 index 000000000..9fcadd756 --- /dev/null +++ b/radarr/rootfs/etc/cont-init.d/20-folders @@ -0,0 +1,19 @@ +#!/usr/bin/with-contenv bash + +if [ ! -d /share/storage/movies ]; then + echo "Creating /share/storage/movies" + mkdir -p /share/storage/movies + chown -R abc:abc /share/storage/movies +fi + +if [ ! -d /share/downloads ]; then + echo "Creating /share/downloads" + mkdir -p /share/downloads + chown -R abc:abc /share/downloads +fi + +if [ ! -d /config/radarr ]; then + echo "Creating /config/radarr" + mkdir -p /config/radarr + chown -R abc:abc /config/radarr +fi diff --git a/radarr/rootfs/etc/cont-init.d/92-local_mounts.sh b/radarr/rootfs/etc/cont-init.d/92-local_mounts.sh new file mode 100644 index 000000000..0920d68bd --- /dev/null +++ b/radarr/rootfs/etc/cont-init.d/92-local_mounts.sh @@ -0,0 +1,32 @@ +#!/usr/bin/with-contenv bashio + +###################### +# MOUNT LOCAL SHARES # +###################### + +# Mount local Share if configured +if bashio::config.has_value 'localdisks'; then + + MOREDISKS=$(bashio::config 'localdisks') + echo "Local Disks mounting..." + + # Separate comma separated values + for disk in ${MOREDISKS//,/ }; do + + # Mount by device as default + devpath=/dev + + # Mount as label + [ ${disk:0:2} != "sd" ] && devpath=/dev/disk/by-label + + # Creates dir + mkdir -p /mnt/$disk + chown -R $(id -u):$(id -g) /mnt/$disk + # Legacy mounting : mount to share if still exists (avoid breaking changes) + [ -d /share/$disk ] && mount $devpath/$disk /share/$disk || true + # Mount + mount $devpath/$disk /mnt/$disk && bashio::log.info "Success! $disk mounted to /mnt/$disk" || (bashio::log.fatal "Unable to mount local drives! Please check the name." && rmdir /mnt/$disk) + + done + +fi diff --git a/radarr/rootfs/etc/cont-init.d/92-smb_mounts.sh b/radarr/rootfs/etc/cont-init.d/92-smb_mounts.sh new file mode 100644 index 000000000..06410e554 --- /dev/null +++ b/radarr/rootfs/etc/cont-init.d/92-smb_mounts.sh @@ -0,0 +1,83 @@ +#!/usr/bin/with-contenv bashio + +######################### +# MOUNT SMB SHARES v1.6 # +######################### +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="" + + # Mount CIFS Share if configured and if Protection Mode is active + echo '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//,/ }; do # Separate comma separated values + + # 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 + + # Data validation + if [[ ! $disk =~ ^.*+[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[/]+.*+$ ]]; then + bashio::log.fatal "The structure of your \"networkdisks\" option : \"$disk\" doesn't seem correct, please use a structure like //123.12.12.12/sharedfolder,//123.12.12.12/sharedfolder2. If you don't use it, you can simply remove the text, this will avoid this error message in the future." + exit 0 + fi + + # 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:-WORKGROUP}"; 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 + + # Messages + if [ $MOUNTED = true ] && [ "mountpoint -q /mnt/$diskname" ]; 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 + # Mounting failed messages + bashio::log.fatal "Error, 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" + bashio::log.fatal "Here is some debugging info :" + + # Provide debugging info + smbclient -V &>/dev/null || apt-get install smbclient || apk add --no-cache samba-client + #smbclient $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + smbclient -L $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + + # Error code + bashio::log.fatal "Error read : $(/dev/null || true + rmdir /mnt/$diskname || true + fi + + done +fi diff --git a/readarr/CHANGELOG.md b/readarr/CHANGELOG.md index c7ff437ae..5761a44d1 100644 --- a/readarr/CHANGELOG.md +++ b/readarr/CHANGELOG.md @@ -1,3 +1,7 @@ + +## nightly-0.1.0.1117-ls52 (12-12-2021) +- Update to latest version from linuxserver/docker-readarr +- New standardized logic for Dockerfile build and packages installation - Allow to define the config location ## nightly-0.1.0.1095-ls51 (09-12-2021) diff --git a/readarr/Dockerfile b/readarr/Dockerfile index 05b184403..fc75c8b4c 100644 --- a/readarr/Dockerfile +++ b/readarr/Dockerfile @@ -1,15 +1,15 @@ -############### -# Build Image # -############### +################# +# 1 Build Image # +################# ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} ENV BASHIO_VERSION=0.14.3 -################ -# Modify Image # -################ +################## +# 2 Modify Image # +################## RUN sed -i "s|/config|/config/readarr|g" /etc/services.d/readarr/run \ && sed -i "s|/config|/config/readarr|g" /etc/cont-init.d/30-config \ @@ -19,9 +19,9 @@ RUN sed -i "s|/config|/config/readarr|g" /etc/services.d/readarr/run \ && 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 -################ -# Install apps # -################ +################## +# 3 Install apps # +################## # Copy local files COPY rootfs/ / @@ -30,25 +30,25 @@ COPY rootfs/ / ENV PACKAGES="" # Automatic apps & bashio -RUN $(ls /bin/bash &>/dev/null) || (apt-get install -y --no-install-recommends bash || apk add --no-cache bash) && \ - $(curl --help &>/dev/null) || (apt-get install -y --no-install-recommends curl || apk add --no-cache curl) && \ +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ chmod 777 /automatic_packages.sh && \ /automatic_packages.sh "${PACKAGES:-}" && \ rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE - -############## -# Entrypoint # -############## + +################ +# 4 Entrypoint # +################ #RUN chmod 777 /entrypoint.sh #WORKDIR / #ENTRYPOINT [ "/usr/bin/env" ] #CMD [ "/entrypoint.sh" ] - -########## -# Labels # -########## + +############ +# 5 Labels # +############ ARG BUILD_ARCH ARG BUILD_DATE diff --git a/readarr/config.json b/readarr/config.json index 48f6a0a59..32896897b 100644 --- a/readarr/config.json +++ b/readarr/config.json @@ -73,8 +73,8 @@ "CONFIG_LOCATION": "str" }, "slug": "readarr_nas", - "upstream": "nightly-0.1.0.1095-ls51", + "upstream": "nightly-0.1.0.1117-ls52", "url": "https://github.com/alexbelgium/hassio-addons", - "version": "nightly-0.1.0.1095-ls51-4", + "version": "nightly-0.1.0.1117-ls52", "webui": "http://[HOST]:[PORT:8787]" } diff --git a/readarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/readarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index e33f7f063..4f9ed9c51 100644 --- a/readarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/readarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -2,18 +2,17 @@ # If dockerfile failed install manually if [ -e "/ENVFILE" ]; then echo "Executing script" - PACKAGES=$(< /ENVFILE) + PACKAGES=$(/dev/null) || (apt-get install -y --no-install-recommends bash || apk add --no-cache bash) && \ - $(curl --help &>/dev/null) || (apt-get install -y --no-install-recommends curl &>/dev/null || apk add --no-cache curl) && \ - curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ - chmod 777 /automatic_packages.sh && \ - eval /./automatic_packages.sh "$PACKAGES" && \ - rm /automatic_packages.sh - + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/requestrr/CHANGELOG.md b/requestrr/CHANGELOG.md index 71f658149..0fb9302ca 100644 --- a/requestrr/CHANGELOG.md +++ b/requestrr/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation ## 2.1.1 (15-10-2021) - Update to latest version from linuxserver/docker-requestrr diff --git a/requestrr/Dockerfile b/requestrr/Dockerfile index f7432f6b0..c423dd8bd 100644 --- a/requestrr/Dockerfile +++ b/requestrr/Dockerfile @@ -1,34 +1,18 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -ENV BASHIO_VERSION=0.14.3 -ENV PACKAGES="jq \ - curl \ - cifs-utils \ - keyutils \ - samba \ - smbclient" + +################## +# 2 Modify Image # +################## RUN \ - ################ - # Install apps # - ################ - apt-get clean \ - && apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} \ - \ - ################## - # 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|/data|g" /etc/services.d/requestrr/run \ + sed -i "s|/config|/data|g" /etc/services.d/requestrr/run \ && sed -i "s|/config|/data|g" /etc/cont-init.d/30-config \ \ # Allow UID and GID setting @@ -36,10 +20,43 @@ RUN \ && 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/ / +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="jq \ + curl \ + cifs-utils \ + keyutils \ + samba \ + smbclient" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/requestrr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/requestrr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/requestrr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/requestrr/rootfs/etc/cont-init.d/00-banner.sh b/requestrr/rootfs/etc/cont-init.d/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/requestrr/rootfs/etc/cont-init.d/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/requestrr/rootfs/etc/cont-init.d/00-ha-env b/requestrr/rootfs/etc/cont-init.d/00-ha-env new file mode 100644 index 000000000..342068f41 --- /dev/null +++ b/requestrr/rootfs/etc/cont-init.d/00-ha-env @@ -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 diff --git a/resiliosync/CHANGELOG.md b/resiliosync/CHANGELOG.md index 111d2751b..f71437092 100644 --- a/resiliosync/CHANGELOG.md +++ b/resiliosync/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation - Add local & smb mounts (see readme) - Config changed from /config/resiliosync to /share/resiliosync_config diff --git a/resiliosync/Dockerfile b/resiliosync/Dockerfile index b61fbed9c..f0c0ea59a 100644 --- a/resiliosync/Dockerfile +++ b/resiliosync/Dockerfile @@ -1,36 +1,15 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -ENV BASHIO_VERSION=0.14.3 -ENV PACKAGES="jq \ - curl \ - cifs-utils \ - keyutils \ - samba \ - smbclient" -RUN \ - ################ - # Install apps # - ################ - apt-get clean \ - && apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} \ - \ - ################## - # Install bashio # - ################## - && curl -J -L -o /tmp/bashio.tar.gz \ - "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.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/* + +################## +# 2 Modify Image # +################## RUN \ ############### @@ -51,12 +30,43 @@ RUN \ && grep -rl " /sync" /etc/cont-init.d | xargs sed -i 's| /sync| /share/resiliosync|g' || true \ && sed -i 's=/sync/=/share/resiliosync/=g' /defaults/* -# Copy root filesystem -COPY rootfs / +################## +# 3 Install apps # +################## -VOLUME [ "/data" ] +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="jq \ + curl \ + cifs-utils \ + keyutils \ + samba \ + smbclient" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/resiliosync/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/resiliosync/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 612e26d7e..4f9ed9c51 100644 --- a/resiliosync/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/resiliosync/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -1,29 +1,18 @@ #!/bin/bash # If dockerfile failed install manually -if [ ! -f "/usr/bin/bashio" ]; then - echo "Bashio does not exist, executing script" +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null \ - || apk add --no-cache ${PACKAGES} - - ################### - # 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 - + ####################### + # Automatic installer # + ####################### + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/scrutiny/CHANGELOG.md b/scrutiny/CHANGELOG.md index 48a50a9be..a7d46134e 100644 --- a/scrutiny/CHANGELOG.md +++ b/scrutiny/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation - Added : "/dev/nvme0" ## 0.3.13 (26-10-2021) diff --git a/scrutiny/Dockerfile b/scrutiny/Dockerfile index 19e641ab1..200ef9a52 100644 --- a/scrutiny/Dockerfile +++ b/scrutiny/Dockerfile @@ -1,31 +1,14 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -# Copy root filesystem -COPY rootfs / - -# Base system -ENV BASHIO_VERSION=0.14.3 -ARG BUILD_ARCH -ENV PACKAGES="jq \ - curl \ - cifs-utils \ - nginx" - -RUN \ - # Add apps - apk add --no-cache ${PACKAGES} \ - \ - ################## - # 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 || true +################## +# 2 Modify Image # +################## RUN \ # Install script @@ -35,23 +18,49 @@ RUN \ && 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 \ - # Correct visualization bug on mobile - # && sed -i 's|content="width=device-width, height=device-height, initial-scale=1.0, minimum-scale=1.0"|content="width=980, initial-scale=1.0"|g' /app/scrutiny-web/index.html \ # use /data instead of /config for database && sed -i 's| /config| /data|g' /defaults/scrutiny.yaml \ && sed -i 's| /config| /data|g' /etc/cont-init.d/* \ && sed -i 's| /config| /data|g' /etc/logrotate.d/scrutiny \ && sed -i 's| /config| /data|g' /etc/crontabs/root \ - # analyse local devices at reboot - # && sed -i '$d' /etc/crontabs/root \ - # && sed -i -e '$a @reboot /run.sh' /etc/crontabs/root \ - # && sed -i -e '$a 0 * * * * /run.sh' /etc/crontabs/root \ # correct url paths && grep -rl '/web/' /app/scrutiny-web/ | xargs sed -i 's|/web/|./|g' -VOLUME [ "/data" ] +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="jq \ + curl \ + cifs-utils \ + nginx" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/scrutiny/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/scrutiny/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 612e26d7e..4f9ed9c51 100644 --- a/scrutiny/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/scrutiny/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -1,29 +1,18 @@ #!/bin/bash # If dockerfile failed install manually -if [ ! -f "/usr/bin/bashio" ]; then - echo "Bashio does not exist, executing script" +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null \ - || apk add --no-cache ${PACKAGES} - - ################### - # 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 - + ####################### + # Automatic installer # + ####################### + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/sonarr/CHANGELOG.md b/sonarr/CHANGELOG.md index d29530e56..0e87ee67b 100644 --- a/sonarr/CHANGELOG.md +++ b/sonarr/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation - Allow mounting local drives by label. Just pust the label instead of sda1 for example - Allow mounting local drives by label. Just pust the label instead of sda1 for example - Improve SMB mount code to v1.5 ; accepts several network disks separated by commas (//123.12.12.12/share,//123.12.12.12/hello) that are mount to /mnt/$sharename diff --git a/sonarr/Dockerfile b/sonarr/Dockerfile index 6576aeb86..317982dd9 100644 --- a/sonarr/Dockerfile +++ b/sonarr/Dockerfile @@ -1,35 +1,19 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION ARG BUILD_UPSTREAM="3.0.6.1342" FROM ${BUILD_FROM} -ENV BASHIO_VERSION=0.14.3 -ENV PACKAGES="jq \ - curl \ - cifs-utils \ - keyutils \ - samba \ - smbclient" + +################## +# 2 Modify Image # +################## RUN \ - ################ - # Install apps # - ################ - apt-get clean \ - && apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} \ - \ - ################## - # 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|/config/sonarr|g" /etc/services.d/sonarr/run \ + sed -i "s|/config|/config/sonarr|g" /etc/services.d/sonarr/run \ && sed -i "s|/config|/config/sonarr|g" /etc/cont-init.d/30-config \ \ # Allow UID and GID setting @@ -37,10 +21,43 @@ RUN \ && 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/ / +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="jq \ + curl \ + cifs-utils \ + keyutils \ + samba \ + smbclient" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/sonarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/sonarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/sonarr/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/sonarr/rootfs/etc/cont-init.d/00-banner.sh b/sonarr/rootfs/etc/cont-init.d/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/sonarr/rootfs/etc/cont-init.d/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/sonarr/rootfs/etc/cont-init.d/00-ha-env b/sonarr/rootfs/etc/cont-init.d/00-ha-env new file mode 100644 index 000000000..3b3e69246 --- /dev/null +++ b/sonarr/rootfs/etc/cont-init.d/00-ha-env @@ -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 \ No newline at end of file diff --git a/sonarr/rootfs/etc/cont-init.d/20-folders b/sonarr/rootfs/etc/cont-init.d/20-folders new file mode 100644 index 000000000..17b3689df --- /dev/null +++ b/sonarr/rootfs/etc/cont-init.d/20-folders @@ -0,0 +1,19 @@ +#!/usr/bin/with-contenv bash + +if [ ! -d /share/storage/movies ]; then + echo "Creating /share/storage/movies" + mkdir -p /share/storage/movies + chown -R abc:abc /share/storage/movies +fi + +if [ ! -d /share/downloads ]; then + echo "Creating /share/downloads" + mkdir -p /share/downloads + chown -R abc:abc /share/downloads +fi + +if [ ! -d /config/sonarr ]; then + echo "Creating /config/sonarr" + mkdir -p /config/sonarr + chown -R abc:abc /config/sonarr +fi diff --git a/sonarr/rootfs/etc/cont-init.d/92-local_mounts.sh b/sonarr/rootfs/etc/cont-init.d/92-local_mounts.sh new file mode 100644 index 000000000..0920d68bd --- /dev/null +++ b/sonarr/rootfs/etc/cont-init.d/92-local_mounts.sh @@ -0,0 +1,32 @@ +#!/usr/bin/with-contenv bashio + +###################### +# MOUNT LOCAL SHARES # +###################### + +# Mount local Share if configured +if bashio::config.has_value 'localdisks'; then + + MOREDISKS=$(bashio::config 'localdisks') + echo "Local Disks mounting..." + + # Separate comma separated values + for disk in ${MOREDISKS//,/ }; do + + # Mount by device as default + devpath=/dev + + # Mount as label + [ ${disk:0:2} != "sd" ] && devpath=/dev/disk/by-label + + # Creates dir + mkdir -p /mnt/$disk + chown -R $(id -u):$(id -g) /mnt/$disk + # Legacy mounting : mount to share if still exists (avoid breaking changes) + [ -d /share/$disk ] && mount $devpath/$disk /share/$disk || true + # Mount + mount $devpath/$disk /mnt/$disk && bashio::log.info "Success! $disk mounted to /mnt/$disk" || (bashio::log.fatal "Unable to mount local drives! Please check the name." && rmdir /mnt/$disk) + + done + +fi diff --git a/sonarr/rootfs/etc/cont-init.d/92-smb_mounts.sh b/sonarr/rootfs/etc/cont-init.d/92-smb_mounts.sh new file mode 100644 index 000000000..06410e554 --- /dev/null +++ b/sonarr/rootfs/etc/cont-init.d/92-smb_mounts.sh @@ -0,0 +1,83 @@ +#!/usr/bin/with-contenv bashio + +######################### +# MOUNT SMB SHARES v1.6 # +######################### +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="" + + # Mount CIFS Share if configured and if Protection Mode is active + echo '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//,/ }; do # Separate comma separated values + + # 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 + + # Data validation + if [[ ! $disk =~ ^.*+[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[/]+.*+$ ]]; then + bashio::log.fatal "The structure of your \"networkdisks\" option : \"$disk\" doesn't seem correct, please use a structure like //123.12.12.12/sharedfolder,//123.12.12.12/sharedfolder2. If you don't use it, you can simply remove the text, this will avoid this error message in the future." + exit 0 + fi + + # 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:-WORKGROUP}"; 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 + + # Messages + if [ $MOUNTED = true ] && [ "mountpoint -q /mnt/$diskname" ]; 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 + # Mounting failed messages + bashio::log.fatal "Error, 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" + bashio::log.fatal "Here is some debugging info :" + + # Provide debugging info + smbclient -V &>/dev/null || apt-get install smbclient || apk add --no-cache samba-client + #smbclient $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + smbclient -L $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + + # Error code + bashio::log.fatal "Error read : $(/dev/null || true + rmdir /mnt/$diskname || true + fi + + done +fi diff --git a/teamspeak/CHANGELOG.md b/teamspeak/CHANGELOG.md index 8372cb6c5..c62b3b963 100644 --- a/teamspeak/CHANGELOG.md +++ b/teamspeak/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation ## debian (04-12-2021) - Update to latest version from mbentley/teamspeak diff --git a/teamspeak/Dockerfile b/teamspeak/Dockerfile index 83210007a..68167a772 100644 --- a/teamspeak/Dockerfile +++ b/teamspeak/Dockerfile @@ -1,6 +1,14 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM FROM ${BUILD_FROM} +################## +# 2 Modify Image # +################## + RUN mkdir -p /data \ && chown -R 503:503 /data @@ -8,7 +16,24 @@ ENV PATH "${PATH}:/data" VOLUME [ "/data:/var/ts3server/" ] -### LABELS +################## +# 3 Install apps # +################## + +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ + ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/teamspeak/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/teamspeak/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/teamspeak/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/teamspeak/rootfs/etc/cont-init.d/00-banner.sh b/teamspeak/rootfs/etc/cont-init.d/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/teamspeak/rootfs/etc/cont-init.d/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/transmission/CHANGELOG.md b/transmission/CHANGELOG.md index abdcd7305..ca78ee965 100644 --- a/transmission/CHANGELOG.md +++ b/transmission/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation - Removal of requirement for unprotected mode - Addition of local disks mount - Addition of repair capabilities for the json diff --git a/transmission/Dockerfile b/transmission/Dockerfile index 65f488df7..0e69964af 100644 --- a/transmission/Dockerfile +++ b/transmission/Dockerfile @@ -1,35 +1,14 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -ENV BASHIO_VERSION=0.14.3 -ENV PACKAGES="curl \ - jq \ - samba \ - samba-client" -# Add bashio -RUN apk add --no-cache ${PACKAGES} \ - \ - && curl -J -L -o /tmp/bashio.tar.gz \ - "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.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 || true - -RUN \ - ln -s /usr/share/transmission/web/style /transmission-web-control && \ - ln -s /usr/share/transmission/web/images /transmission-web-control && \ - ln -s /usr/share/transmission/web/javascript /transmission-web-control && \ - ln -s /usr/share/transmission/web/index.html /transmission-web-control/index.original.html - - -# Copy root filesystem -COPY rootfs / +################## +# 2 Modify Image # +################## # MOFIFY DATA PATH RUN sed -i "s|config|config/transmission|g" /etc/services.d/transmission/run \ @@ -37,11 +16,45 @@ RUN sed -i "s|config|config/transmission|g" /etc/services.d/transmission/run \ # 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 + && sed -i 's/{PGID:-911}/(bashio::config "PGID")/g' /etc/cont-init.d/10-adduser \ + # Allow return to original UI + && ln -s /usr/share/transmission/web/style /transmission-web-control && \ + ln -s /usr/share/transmission/web/images /transmission-web-control && \ + ln -s /usr/share/transmission/web/javascript /transmission-web-control && \ + ln -s /usr/share/transmission/web/index.html /transmission-web-control/index.original.html -VOLUME [ "/data" ] +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/transmission/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/transmission/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 612e26d7e..4f9ed9c51 100644 --- a/transmission/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/transmission/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -1,29 +1,18 @@ #!/bin/bash # If dockerfile failed install manually -if [ ! -f "/usr/bin/bashio" ]; then - echo "Bashio does not exist, executing script" +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null \ - || apk add --no-cache ${PACKAGES} - - ################### - # 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 - + ####################### + # Automatic installer # + ####################### + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/ubooquity/CHANGELOG.md b/ubooquity/CHANGELOG.md index 991d1d961..04321bac2 100644 --- a/ubooquity/CHANGELOG.md +++ b/ubooquity/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation - Improve SMB mount code to v1.5 ; accepts several network disks separated by commas (//123.12.12.12/share,//123.12.12.12/hello) that are mount to /mnt/$sharename - Add local drives mounts : used localdisks with the text "sda1, sdb1" according to your needs - Add ssl diff --git a/ubooquity/Dockerfile b/ubooquity/Dockerfile index 8cd04cc9a..e30f46e3d 100644 --- a/ubooquity/Dockerfile +++ b/ubooquity/Dockerfile @@ -1,30 +1,15 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION ARG BUILD_UPSTREAM="2.1.2" FROM ${BUILD_FROM} -ENV BASHIO_VERSION=0.14.3 -ENV PACKAGES="curl \ - jq \ - moreutils \ - samba \ - nginx" -# Add bashio -RUN apk add --no-cache ${PACKAGES} \ - \ - && curl -J -L -o /tmp/bashio.tar.gz \ - "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.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 || true - -# Copy root filesystem -COPY rootfs / +################## +# 2 Modify Image # +################## RUN \ # Set config directory @@ -43,9 +28,42 @@ RUN \ && sed -i 's|bash|bashio|g' /etc/services.d/ubooquity/run \ && sed -i 's|{MAXMEM:-512}|(bashio::config "maxmem")|g' /etc/services.d/ubooquity/run -VOLUME [ "/data" ] +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="curl \ + jq \ + moreutils \ + samba \ + nginx" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/ubooquity/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/ubooquity/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh index 612e26d7e..4f9ed9c51 100644 --- a/ubooquity/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh +++ b/ubooquity/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -1,29 +1,18 @@ #!/bin/bash # If dockerfile failed install manually -if [ ! -f "/usr/bin/bashio" ]; then - echo "Bashio does not exist, executing script" +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null \ - || apk add --no-cache ${PACKAGES} - - ################### - # 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 - + ####################### + # Automatic installer # + ####################### + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/webtop/CHANGELOG.md b/webtop/CHANGELOG.md index 66f7e8b76..4ef647bc0 100644 --- a/webtop/CHANGELOG.md +++ b/webtop/CHANGELOG.md @@ -1 +1,2 @@ +- New standardized logic for Dockerfile build and packages installation - Initial release diff --git a/webtop/Dockerfile b/webtop/Dockerfile index 048226a6e..728e776d9 100644 --- a/webtop/Dockerfile +++ b/webtop/Dockerfile @@ -1,29 +1,15 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION FROM ${BUILD_FROM} -ENV BASHIO_VERSION=0.14.3 -ENV PACKAGES="curl \ - jq \ - cifs-utils \ - keyutils \ - samba" -RUN \ - ################ - # Install apps # - ################ - apk add --no-cache ${PACKAGES} \ - \ -################### -# 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 || true +# 2 Modify Image # +################## # Allow UID and GID setting RUN sed -i 's/bash/bashio/g' /etc/cont-init.d/10-adduser \ @@ -34,10 +20,42 @@ RUN sed -i 's/bash/bashio/g' /etc/cont-init.d/10-adduser \ && sed -i 's|/config|/data|g' /etc/cont-init.d/* \ && sed -i 's|/config|/data|g' /etc/services.d/*/run -# copy local files -COPY root/ / +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps +ENV PACKAGES="curl \ + jq \ + cifs-utils \ + keyutils \ + samba" + +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE + +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION @@ -46,20 +64,20 @@ 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} + 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} diff --git a/webtop/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/webtop/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/webtop/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/webtop/rootfs/etc/cont-init.d/00-banner.sh b/webtop/rootfs/etc/cont-init.d/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/webtop/rootfs/etc/cont-init.d/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/webtop/rootfs/etc/cont-init.d/90-dns_set.sh b/webtop/rootfs/etc/cont-init.d/90-dns_set.sh new file mode 100644 index 000000000..dd80ef417 --- /dev/null +++ b/webtop/rootfs/etc/cont-init.d/90-dns_set.sh @@ -0,0 +1,28 @@ +#!/usr/bin/with-contenv bashio + +############### +# DNS SETTING # +############### + +# Avoid usage of local dns such as adguard home or pihole\n" + +if bashio::config.has_value 'DNS_server'; then + # Define variables + DNSSERVER=$(bashio::config 'DNS_server') + DNS="" + DNSLIST="" + + # Get DNS servers + for server in ${DNSSERVER//,/ } # Separate comma separated values + do + DNS="${DNS}nameserver $server\n" + DNSLIST="$server $DNSLIST" + done + + # Write resolv.conf + printf "${DNS}" > /etc/resolv.conf + chmod 644 /etc/resolv.conf + bashio::log.info "DNS SERVERS set to $DNSLIST" +else + bashio::log.info "DNS Servers option empty. Using default router (or HA) dns servers." +fi diff --git a/webtop/rootfs/etc/cont-init.d/92-local_mounts.sh b/webtop/rootfs/etc/cont-init.d/92-local_mounts.sh new file mode 100644 index 000000000..0920d68bd --- /dev/null +++ b/webtop/rootfs/etc/cont-init.d/92-local_mounts.sh @@ -0,0 +1,32 @@ +#!/usr/bin/with-contenv bashio + +###################### +# MOUNT LOCAL SHARES # +###################### + +# Mount local Share if configured +if bashio::config.has_value 'localdisks'; then + + MOREDISKS=$(bashio::config 'localdisks') + echo "Local Disks mounting..." + + # Separate comma separated values + for disk in ${MOREDISKS//,/ }; do + + # Mount by device as default + devpath=/dev + + # Mount as label + [ ${disk:0:2} != "sd" ] && devpath=/dev/disk/by-label + + # Creates dir + mkdir -p /mnt/$disk + chown -R $(id -u):$(id -g) /mnt/$disk + # Legacy mounting : mount to share if still exists (avoid breaking changes) + [ -d /share/$disk ] && mount $devpath/$disk /share/$disk || true + # Mount + mount $devpath/$disk /mnt/$disk && bashio::log.info "Success! $disk mounted to /mnt/$disk" || (bashio::log.fatal "Unable to mount local drives! Please check the name." && rmdir /mnt/$disk) + + done + +fi diff --git a/webtop/rootfs/etc/cont-init.d/92-smb_mounts.sh b/webtop/rootfs/etc/cont-init.d/92-smb_mounts.sh new file mode 100644 index 000000000..06410e554 --- /dev/null +++ b/webtop/rootfs/etc/cont-init.d/92-smb_mounts.sh @@ -0,0 +1,83 @@ +#!/usr/bin/with-contenv bashio + +######################### +# MOUNT SMB SHARES v1.6 # +######################### +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="" + + # Mount CIFS Share if configured and if Protection Mode is active + echo '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//,/ }; do # Separate comma separated values + + # 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 + + # Data validation + if [[ ! $disk =~ ^.*+[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[/]+.*+$ ]]; then + bashio::log.fatal "The structure of your \"networkdisks\" option : \"$disk\" doesn't seem correct, please use a structure like //123.12.12.12/sharedfolder,//123.12.12.12/sharedfolder2. If you don't use it, you can simply remove the text, this will avoid this error message in the future." + exit 0 + fi + + # 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:-WORKGROUP}"; 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 + + # Messages + if [ $MOUNTED = true ] && [ "mountpoint -q /mnt/$diskname" ]; 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 + # Mounting failed messages + bashio::log.fatal "Error, 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" + bashio::log.fatal "Here is some debugging info :" + + # Provide debugging info + smbclient -V &>/dev/null || apt-get install smbclient || apk add --no-cache samba-client + #smbclient $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + smbclient -L $disk -U $CIFS_USERNAME%$CIFS_PASSWORD || true + + # Error code + bashio::log.fatal "Error read : $(/dev/null || true + rmdir /mnt/$diskname || true + fi + + done +fi diff --git a/webtrees/CHANGELOG.md b/webtrees/CHANGELOG.md index c192dadfc..eae95dfe9 100644 --- a/webtrees/CHANGELOG.md +++ b/webtrees/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation ## 2.0.19 (07-12-2021) - Update to latest version from nathanvaughn/webtrees-docker diff --git a/webtrees/Dockerfile b/webtrees/Dockerfile index ff7a63193..9504a3af6 100644 --- a/webtrees/Dockerfile +++ b/webtrees/Dockerfile @@ -1,53 +1,55 @@ +################# +# 1 Build Image # +################# + ARG BUILD_VERSION FROM nathanvaughn/webtrees:latest +################## +# 2 Modify Image # +################## + # Global variables -ENV BASHIO_VERSION=0.14.3 ENV WEBTREES_HOME="/data/webtrees" WORKDIR $WEBTREES_HOME -VOLUME ["/data"] +RUN \ + # Change data location + grep -rl "/var/www/webtrees" /etc/ | xargs sed -i 's|/var/www/webtrees|/data/webtrees|g' \ + # Add end script + && sed -i '$ d' /docker-entrypoint.sh + +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / + +# Manual apps ENV PACKAGES="jq \ curl \ yamllint" -RUN \ - ################ - # Install apps # - ################ - apt-get clean \ - && apt-get update \ - && apt-get install -y --no-install-recommends ${PACKAGES} \ - && apt-get clean \ - \ - ################## - # 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 || true +# Automatic apps & bashio +RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && \ + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && \ + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ + chmod 777 /automatic_packages.sh && \ + /automatic_packages.sh "${PACKAGES:-}" && \ + rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE -# Copy root filesystem -COPY rootfs/ / +################ +# 4 Entrypoint # +################ -RUN \ - ################ - # Modify image # - ################ - # Change data location - sed -i 's|/etc/services.d/*/run|/scripts/99-run.sh|g' /scripts/90-config_yaml.sh \ - && grep -rl "/var/www/webtrees" /etc/ | xargs sed -i 's|/var/www/webtrees|/data/webtrees|g' \ - # Add entry script - && chown root:root /entrypoint.sh \ - && chmod 777 /entrypoint.sh \ - # Add end script - && sed -i '$ d' /docker-entrypoint.sh +RUN chmod 777 /entrypoint.sh +ENTRYPOINT [ "/usr/bin/env" ] +CMD [ "/entrypoint.sh" ] -ENTRYPOINT ["/entrypoint.sh"] +############ +# 5 Labels # +############ -### LABELS ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/webtrees/rootfs/entrypoint.sh b/webtrees/rootfs/entrypoint.sh index bf5da4a6c..35ccb7382 100644 --- a/webtrees/rootfs/entrypoint.sh +++ b/webtrees/rootfs/entrypoint.sh @@ -2,34 +2,6 @@ echo "Starting..." -################################### -# Export all addon options as env # -################################### - -# For all keys in options.json -JSONSOURCE="/data/options.json" - -# Export keys as env variables -echo "All addon options were exported as variables" -mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE}) -for KEYS in ${arr[@]}; do - # export key - VALUE=$(jq .$KEYS ${JSONSOURCE}) - export ${KEYS}=${VALUE//[\"\']/} &>/dev/null -done - -################ -# Set timezone # -################ -if [ ! -z "TZ" ] && [ -f /etc/localtime ]; then - if [ -f /usr/share/zoneinfo/$TZ ]; then - echo "Timezone set from $(cat /etc/timezone) to $TZ" - ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone - else - echo "WARNING : Timezone $TZ is invalid, it will be kept to default value of $(cat /etc/timezone)" - fi -fi - #################### # Starting scripts # #################### diff --git a/webtrees/rootfs/scripts/00-aaa_dockerfile_backup.sh b/webtrees/rootfs/scripts/00-aaa_dockerfile_backup.sh index 612e26d7e..4f9ed9c51 100644 --- a/webtrees/rootfs/scripts/00-aaa_dockerfile_backup.sh +++ b/webtrees/rootfs/scripts/00-aaa_dockerfile_backup.sh @@ -1,29 +1,18 @@ #!/bin/bash # If dockerfile failed install manually -if [ ! -f "/usr/bin/bashio" ]; then - echo "Bashio does not exist, executing script" +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null \ - || apk add --no-cache ${PACKAGES} - - ################### - # 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 - + ####################### + # Automatic installer # + ####################### + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null fi diff --git a/webtrees/rootfs/scripts/90-config_yaml.sh b/webtrees/rootfs/scripts/90-config_yaml.sh index 00646fc3f..e37468ce2 100644 --- a/webtrees/rootfs/scripts/90-config_yaml.sh +++ b/webtrees/rootfs/scripts/90-config_yaml.sh @@ -83,8 +83,8 @@ while IFS= read -r line; do if [[ $line =~ ^.+[=].+$ ]]; then export $line # Export the variable - sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || sed -i "1a export $line" /scripts/*run* - + sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || true + sed -i "1a export $line" /scripts/*run* 2>/dev/null || true # Show in log bashio::log.blue "$line" else diff --git a/wger/Dockerfile b/wger/Dockerfile index 50d6e7f7d..12b751461 100644 --- a/wger/Dockerfile +++ b/wger/Dockerfile @@ -1,15 +1,39 @@ +################# +# 1 Build Image # +################# + ARG BUILD_VERSION FROM wger/devel:latest -VOLUME [ "/data" ] +################## +# 2 Modify Image # +################## +VOLUME [ "/data" ] USER root RUN touch /data/database.sqlite \ && chown wger /data/database.sqlite \ && ln -s /data/database.sqlite /home/wger/db -### LABELS +################## +# 3 Install apps # +################## + +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ + ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/wger/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/wger/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/wger/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/wger/rootfs/etc/cont-init.d/00-banner.sh b/wger/rootfs/etc/cont-init.d/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/wger/rootfs/etc/cont-init.d/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/xteve/CHANGELOG.md b/xteve/CHANGELOG.md index beb46de24..4bdf996ed 100644 --- a/xteve/CHANGELOG.md +++ b/xteve/CHANGELOG.md @@ -1,3 +1,4 @@ +- New standardized logic for Dockerfile build and packages installation ## 2.2.0.200 (29-09-2021) - Update to latest version from xteve-project/xTeVe diff --git a/xteve/Dockerfile b/xteve/Dockerfile index a0bd0588d..32f74245c 100644 --- a/xteve/Dockerfile +++ b/xteve/Dockerfile @@ -1,13 +1,34 @@ +################# +# 1 Build Image # +################# + ARG BUILD_FROM ARG BUILD_VERSION ARG BUILD_UPSTREAM="2.2.0.200" FROM collelog/xteve:latest-alpine +################## +# 2 Modify Image # +################## + RUN cp -vnpr /etc/opt/xteve* /data || true CMD ["-config", "/data", "-port", "34400"] -### LABELS +################ +# 4 Entrypoint # +################ + +#RUN chmod 777 /entrypoint.sh +#WORKDIR / +#ENTRYPOINT [ "/usr/bin/env" ] +#CMD [ "/entrypoint.sh" ] +#SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +############ +# 5 Labels # +############ + ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION diff --git a/xteve/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh b/xteve/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh new file mode 100644 index 000000000..4f9ed9c51 --- /dev/null +++ b/xteve/rootfs/etc/cont-init.d/00-aaa_dockerfile_backup.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# If dockerfile failed install manually +if [ -e "/ENVFILE" ]; then + echo "Executing script" + PACKAGES=$(/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh + ) >/dev/null + +fi diff --git a/xteve/rootfs/etc/cont-init.d/00-banner.sh b/xteve/rootfs/etc/cont-init.d/00-banner.sh new file mode 100644 index 000000000..0ac294e9a --- /dev/null +++ b/xteve/rootfs/etc/cont-init.d/00-banner.sh @@ -0,0 +1,39 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# 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' + bashio::log.green \ + ' https://github.com/alexbelgium/hassio-addons' + bashio::log.blue \ + '-----------------------------------------------------------' +fi diff --git a/zzz_templates/00-aaa_dockerfile_backup.sh b/zzz_templates/00-aaa_dockerfile_backup.sh index e33f7f063..ad7d5b3a3 100644 --- a/zzz_templates/00-aaa_dockerfile_backup.sh +++ b/zzz_templates/00-aaa_dockerfile_backup.sh @@ -2,17 +2,17 @@ # If dockerfile failed install manually if [ -e "/ENVFILE" ]; then echo "Executing script" - PACKAGES=$(< /ENVFILE) + PACKAGES=$(/dev/null) || (apt-get install -y --no-install-recommends bash || apk add --no-cache bash) && \ - $(curl --help &>/dev/null) || (apt-get install -y --no-install-recommends curl &>/dev/null || apk add --no-cache curl) && \ - curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && \ - chmod 777 /automatic_packages.sh && \ - eval /./automatic_packages.sh "$PACKAGES" && \ - rm /automatic_packages.sh + if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash); fi && + if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl); fi && + curl -L -f -s "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/zzz_templates/automatic_packages.sh" --output /automatic_packages.sh && + chmod 777 /automatic_packages.sh && + eval /./automatic_packages.sh "$PACKAGES" && + rm /automatic_packages.sh ) >/dev/null diff --git a/zzz_templates/00-banner.sh b/zzz_templates/00-banner.sh index 0ac294e9a..54d7d491a 100644 --- a/zzz_templates/00-banner.sh +++ b/zzz_templates/00-banner.sh @@ -5,35 +5,35 @@ 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)" + " 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::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' + ' Please, share the above information when looking for help' bashio::log.blue \ - ' or support in, e.g., GitHub, forums' + ' or support in, e.g., GitHub, forums' bashio::log.green \ - ' https://github.com/alexbelgium/hassio-addons' + ' https://github.com/alexbelgium/hassio-addons' bashio::log.blue \ - '-----------------------------------------------------------' + '-----------------------------------------------------------' fi diff --git a/zzz_templates/90-config_yaml.sh b/zzz_templates/90-config_yaml.sh index 00646fc3f..e37468ce2 100644 --- a/zzz_templates/90-config_yaml.sh +++ b/zzz_templates/90-config_yaml.sh @@ -83,8 +83,8 @@ while IFS= read -r line; do if [[ $line =~ ^.+[=].+$ ]]; then export $line # Export the variable - sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || sed -i "1a export $line" /scripts/*run* - + sed -i "1a export $line" /etc/services.d/*/*run* 2>/dev/null || true + sed -i "1a export $line" /scripts/*run* 2>/dev/null || true # Show in log bashio::log.blue "$line" else diff --git a/zzz_templates/automatic_packages.sh b/zzz_templates/automatic_packages.sh index 253f423b7..94d68af27 100644 --- a/zzz_templates/automatic_packages.sh +++ b/zzz_templates/automatic_packages.sh @@ -4,27 +4,27 @@ # INIT # ######## +VERBOSE=false set +u 2>/dev/null -PACKAGES="${1:-}" -VERBOSE="${2:-}" +PACKAGES="${*:-}" [ "$VERBOSE" = true ] && echo "ENV : $PACKAGES" ############################ # CHECK WHICH BASE IS USED # ############################ -if [[ "$(apk -h 2>/dev/null)" ]]; then -# If apk based -[ "$VERBOSE" = true ] && echo "apk based" -PACKMANAGER="apk" -PACKAGES="apk add --no-cache $PACKAGES" +COMMAND="apk" +if command -v $COMMAND &>/dev/null; then + # If apk based + [ "$VERBOSE" = true ] && echo "apk based" + PACKMANAGER="apk" + PACKAGES="apk add --no-cache $PACKAGES" else -# If apt-get based -[ "$VERBOSE" = true ] && echo "apt based" -PACKMANAGER="apt" -PACKAGES="apt-get clean \ - && apt-get update \ - && apt-get install -y --no-install-recommends $PACKAGES" + # If apt-get based + [ "$VERBOSE" = true ] && echo "apt based" + PACKMANAGER="apt" + PACKAGES="apt-get update \ + && apt-get install -yqq --no-install-recommends $PACKAGES" fi ################### @@ -42,85 +42,85 @@ PACKAGES="$PACKAGES jq curl" # Scripts for files in "/etc/cont-init.d" "/etc/services.d" "/scripts"; do # Next directory if does not exists - if ! ls $files 1> /dev/null 2>&1; then continue; fi + if ! ls $files 1>/dev/null 2>&1; then continue; fi # Test each possible command COMMAND="nginx" - if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then - [ "$VERBOSE" = true ] && echo "$COMMAND required" - [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES nginx" - [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES nginx" - if ls /etc/nginx 1> /dev/null 2>&1; then mv /etc/nginx /etc/nginx2; fi + if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then + [ "$VERBOSE" = true ] && echo "$COMMAND required" + [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES nginx" + [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES nginx" + if ls /etc/nginx 1>/dev/null 2>&1; then mv /etc/nginx /etc/nginx2; fi fi COMMAND="cifs" - if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then - [ "$VERBOSE" = true ] && echo "$COMMAND required" - [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES cifs-utils keyutils samba" - [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES cifs-utils keyutils samba" + if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then + [ "$VERBOSE" = true ] && echo "$COMMAND required" + [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES cifs-utils keyutils" + [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES cifs-utils keyutils" fi COMMAND="smbclient" - if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then - [ "$VERBOSE" = true ] && echo "$COMMAND required" - [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES samba samba-client" - [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES samba smbclient" + if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then + [ "$VERBOSE" = true ] && echo "$COMMAND required" + [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES samba samba-client" + [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES samba smbclient" fi COMMAND="openvpn" - if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then - [ "$VERBOSE" = true ] && echo "$COMMAND required" - [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES coreutils openvpn" - [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES coreutils openvpn" + if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then + [ "$VERBOSE" = true ] && echo "$COMMAND required" + [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES coreutils openvpn" + [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES coreutils openvpn" fi COMMAND="jq" - if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then - [ "$VERBOSE" = true ] && echo "$COMMAND required" - [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES jq" - [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES jq" + if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then + [ "$VERBOSE" = true ] && echo "$COMMAND required" + [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES jq" + [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES jq" fi COMMAND="yamllint" - if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then - [ "$VERBOSE" = true ] && echo "$COMMAND required" - [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES yamllint" - [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES yamllint" + if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then + [ "$VERBOSE" = true ] && echo "$COMMAND required" + [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES yamllint" + [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES yamllint" fi COMMAND="git" - if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then - [ "$VERBOSE" = true ] && echo "$COMMAND required" - [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES git" - [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES git" + if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then + [ "$VERBOSE" = true ] && echo "$COMMAND required" + [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES git" + [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES git" fi COMMAND="sponge" - if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then - [ "$VERBOSE" = true ] && echo "$COMMAND required" - [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES moreutils" - [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES moreutils" + if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then + [ "$VERBOSE" = true ] && echo "$COMMAND required" + [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES moreutils" + [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES moreutils" fi COMMAND="sqlite" - if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then - [ "$VERBOSE" = true ] && echo "$COMMAND required" - [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES sqlite" - [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES sqlite3" + if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then + [ "$VERBOSE" = true ] && echo "$COMMAND required" + [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES sqlite" + [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES sqlite3" fi COMMAND="pip" - if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then - [ "$VERBOSE" = true ] && echo "$COMMAND required" - [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES py3-pip" - [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES python-pip" + if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then + [ "$VERBOSE" = true ] && echo "$COMMAND required" + [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES py3-pip" + [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES python-pip" fi COMMAND="wget" - if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &> /dev/null; then - [ "$VERBOSE" = true ] && echo "$COMMAND required" - [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES wget" - [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES wget" + if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then + [ "$VERBOSE" = true ] && echo "$COMMAND required" + [ "$PACKMANAGER" = "apk" ] && PACKAGES="$PACKAGES wget" + [ "$PACKMANAGER" = "apt" ] && PACKAGES="$PACKAGES wget" fi done @@ -130,15 +130,19 @@ done #################### # Install apps -[ "$VERBOSE" = true ] && echo "installing packages $PACKAGES" -eval "$PACKAGES" +[ "$VERBOSE" = true ] && echo "installing packages $PACKAGES" +eval "$PACKAGES" + +# Clean after install +[ "$VERBOSE" = true ] && echo "Cleaning apt cache" +[ "$PACKMANAGER" = "apt" ] && apt-get clean || true # Replace nginx if installed -if ls /etc/nginx2 1> /dev/null 2>&1; then +if ls /etc/nginx2 1>/dev/null 2>&1; then [ "$VERBOSE" = true ] && echo "replace nginx2" rm -r /etc/nginx mv /etc/nginx2 /etc/nginx - mkdir -p /var/log/nginx + mkdir -p /var/log/nginx touch /var/log/nginx/error.log fi @@ -148,33 +152,48 @@ fi for files in "/scripts" "/etc/services.d" "/etc/cont-init.d"; do -# Next directory if does not exists - if ! ls $files 1> /dev/null 2>&1; then continue; fi + # Next directory if does not exists + if ! ls $files 1>/dev/null 2>&1; then continue; fi -# Bashio + # Bashio if grep -q -rnw "$files/" -e 'bashio' && [ ! -f "/usr/bin/bashio" ]; then - [ "$VERBOSE" = true ] && echo "install bashio" - BASHIO_VERSION="0.14.3" - 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 + [ "$VERBOSE" = true ] && echo "install bashio" + BASHIO_VERSION="0.14.3" + 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 fi -# Lastversion + # Lastversion if grep -q -rnw "$files/" -e 'lastversion'; then - [ "$VERBOSE" = true ] && echo "install lastversion" - pip install lastversion + [ "$VERBOSE" = true ] && echo "install lastversion" + pip install lastversion fi -# Tempio + # Tempio if grep -q -rnw "$files/" -e 'tempio' && [ ! -f "/usr/bin/tempio" ]; then - [ "$VERBOSE" = true ] && echo "install tempio" - TEMPIO_VERSION="2021.09.0" - BUILD_ARCH="$(bashio::info.arch)" - curl -L -f -s -o /usr/bin/tempio "https://github.com/home-assistant/tempio/releases/download/${TEMPIO_VERSION}/tempio_${BUILD_ARCH}" - chmod a+x /usr/bin/tempio + [ "$VERBOSE" = true ] && echo "install tempio" + TEMPIO_VERSION="2021.09.0" + BUILD_ARCH="$(bashio::info.arch)" + curl -L -f -s -o /usr/bin/tempio "https://github.com/home-assistant/tempio/releases/download/${TEMPIO_VERSION}/tempio_${BUILD_ARCH}" + chmod a+x /usr/bin/tempio fi - + + # Mustache + COMMAND="mustache" + if grep -q -rnw "$files/" -e "$COMMAND" && ! command -v $COMMAND &>/dev/null; then + [ "$VERBOSE" = true ] && echo "$COMMAND required" + [ "$PACKMANAGER" = "apk" ] && apk add --no-cache go npm && + apk upgrade --no-cache && + apk add --no-cache --virtual .build-deps build-base git go && + go get -u github.com/quantumew/mustache-cli && + cp "$GOPATH"/bin/* /usr/bin/ && + rm -rf "$GOPATH" /var/cache/apk/* /tmp/src && + apk del .build-deps xz build-base + [ "$PACKMANAGER" = "apt" ] && apt-get update && + apt-get install -yqq go npm node-mustache + fi + done