Skip to content

Commit

Permalink
🔨 Migrate old-style base scripts s6-rc (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
frenck authored Dec 15, 2022
1 parent 0b090c6 commit 9623b3b
Show file tree
Hide file tree
Showing 18 changed files with 32 additions and 9 deletions.
19 changes: 11 additions & 8 deletions base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ ENV \
YARN_HTTP_TIMEOUT=1000000 \
TERM="xterm-256color"

# Copy root filesystem
COPY rootfs /

# Set shell
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Install base system
ARG BUILD_ARCH=amd64
ARG S6_OVERLAY_VERSION="3.1.2.1"
RUN \
apt-get update \
\
Expand All @@ -38,22 +36,21 @@ RUN \
tzdata=2022g-0ubuntu0.20.04.1 \
xz-utils=5.2.4-1ubuntu1.1 \
\
&& S6_VERSION="3.1.2.1" \
&& S6_ARCH="${BUILD_ARCH}" \
&& if [ "${BUILD_ARCH}" = "i386" ]; then S6_ARCH="i686"; \
elif [ "${BUILD_ARCH}" = "amd64" ]; then S6_ARCH="x86_64"; \
elif [ "${BUILD_ARCH}" = "armv7" ]; then S6_ARCH="arm"; fi \
\
&& curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_VERSION}/s6-overlay-noarch.tar.xz" \
&& curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz" \
| tar -C / -Jxpf - \
\
&& curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_VERSION}/s6-overlay-${S6_ARCH}.tar.xz" \
&& curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.xz" \
| tar -C / -Jxpf - \
\
&& curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_VERSION}/s6-overlay-symlinks-noarch.tar.xz" \
&& curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz" \
| tar -C / -Jxpf - \
\
&& curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_VERSION}/s6-overlay-symlinks-arch.tar.xz" \
&& curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz" \
| tar -C / -Jxpf - \
\
&& mkdir -p /etc/fix-attrs.d \
Expand Down Expand Up @@ -81,6 +78,12 @@ RUN \
/var/{cache,log}/* \
/var/lib/apt/lists/*

# Copy root filesystem
COPY rootfs /

# Copy s6-overlay adjustments
COPY s6-overlay /package/admin/s6-overlay-${S6_OVERLAY_VERSION}/

# Entrypoint & CMD
ENTRYPOINT [ "/init" ]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/command/with-contenv bashio
# shellcheck shell=bash
# ==============================================================================
# Home Assistant Community Add-on: Base Images
# Displays a simple add-on banner on startup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/command/with-contenv bashio
# shellcheck shell=bash
# ==============================================================================
# Home Assistant Community Add-on: Base Images
# Sets the log level correctly
Expand All @@ -9,7 +10,7 @@ declare log_level
if bashio::config.exists log_level; then

# Find the matching LOG_LEVEL
log_level=$(bashio::string.lower "$(bashio::config log_level)")
log_level=$(bashio::string.lower "$(bashio::config log_level)")
case "${log_level}" in
all)
log_level="${__BASHIO_LOG_LEVEL_ALL}"
Expand Down
12 changes: 12 additions & 0 deletions base/s6-overlay/etc/s6-rc/scripts/base-addon-timezone
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/command/with-contenv bashio
# shellcheck shell=bash
# ==============================================================================
# Home Assistant Community Add-on: Base Images
# Configures the timezone
# ==============================================================================

bashio::log.info "Configuring timezone (${TZ:-None})..."

ln --symbolic --no-dereference --force "/usr/share/zoneinfo/${TZ:-UTC}" /etc/localtime
echo "${TZ:-UTC}" > /etc/timezone
dpkg-reconfigure --frontend noninteractive tzdata 2> /dev/null
1 change: 1 addition & 0 deletions base/s6-overlay/etc/s6-rc/sources/base-addon-banner/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
1 change: 1 addition & 0 deletions base/s6-overlay/etc/s6-rc/sources/base-addon-banner/up
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/package/admin/s6-overlay/etc/s6-rc/scripts/base-addon-banner
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
1 change: 1 addition & 0 deletions base/s6-overlay/etc/s6-rc/sources/base-addon-log-level/up
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/package/admin/s6-overlay/etc/s6-rc/scripts/base-addon-log-level
Empty file.
1 change: 1 addition & 0 deletions base/s6-overlay/etc/s6-rc/sources/base-addon-timezone/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
1 change: 1 addition & 0 deletions base/s6-overlay/etc/s6-rc/sources/base-addon-timezone/up
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/package/admin/s6-overlay/etc/s6-rc/scripts/base-addon-timezone
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.

0 comments on commit 9623b3b

Please sign in to comment.