Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Releasing refs/heads/prerelease/12.2.0 into prerelease #190

Merged
merged 31 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2b689c2
Fix Bug 🐛 [SambaNAS] Can't mount `moredisks` with label that contains…
dianlight Jan 3, 2024
10dfe8d
CI statistic patch
dianlight Jan 3, 2024
c56c5d9
Fix 🐛 [sambanas] 0x80070032 The request is not supported #182
dianlight Jan 3, 2024
2dd7219
Version Bump base 15.0.3
dianlight Jan 3, 2024
4e874a8
Merge branch 'master' of github.com:dianlight/hassio-addons into prer…
dianlight Jan 3, 2024
07401e8
Fix automount for HA
dianlight Jan 4, 2024
76dbc60
tecnical user for ha mount
dianlight Jan 4, 2024
e92beb9
Correct ADDON_CONFIG driver name
dianlight Jan 4, 2024
0415a76
Create superuser only if needed
dianlight Jan 4, 2024
4481f67
Remove fruit vfs object on unsupported fs
dianlight Jan 4, 2024
dbcaa53
Correct unsupported xattr vsf object.
dianlight Jan 4, 2024
2d7de89
Add ro support to apfs ✨ [REQUEST] Support for APFS formatted hard dr…
dianlight Jan 4, 2024
8a45ba7
Initila python MQTT implementation
dianlight Jan 7, 2024
3c961b6
Prepare 12.2.0-nas release
dianlight Jan 7, 2024
c0087b6
fix spelling
dianlight Jan 7, 2024
9e8211d
Merge remote-tracking branch 'origin/master' into prerelease/12.2.0
dianlight Jan 7, 2024
6674650
Fix CI Banch creation
dianlight Jan 7, 2024
bc589d1
new version
dianlight Jan 7, 2024
d1e271e
CI retry
dianlight Jan 7, 2024
5b3febb
retry
dianlight Jan 7, 2024
79b890b
CI Update
dianlight Jan 7, 2024
f489f1e
CI Test
dianlight Jan 7, 2024
cac3994
CI Update
dianlight Jan 7, 2024
fb25385
CI
dianlight Jan 7, 2024
92f779d
CI
dianlight Jan 7, 2024
2228518
CI try branch more
dianlight Jan 7, 2024
a124778
CI
dianlight Jan 7, 2024
bec399d
CI
dianlight Jan 7, 2024
2092d47
CI
dianlight Jan 7, 2024
40db3cb
CI restore build
dianlight Jan 7, 2024
ed7eaea
Correct all CI yaml
dianlight Jan 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion .github/workflows/docker-image-dev.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
name: Docker Image CI - Build Pre-Release.
name: Docker Image CI - Build Dev

on:
push:
branches:
- devrelease/*
workflow_dispatch:

permissions:
pull-requests: write

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -30,3 +33,16 @@ jobs:
--aarch64 \
--target sambanas \
--docker-hub dianlight

- name: Extract branch name
shell: bash
run: echo "BR_VERSION=${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT"
id: extract_branch

- name: pull-request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
shell: bash
run: |
gh pr create --base "prerelease/${{ steps.extract_branch.outputs.BR_VERSION }}" --title "Releasing ${{ github.ref }} into prerelease" --body ":crown: *An automated PR*"
25 changes: 10 additions & 15 deletions .github/workflows/docker-image-pre.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Publish SambaNAS Addon
if: ${{ false }}
uses: home-assistant/builder@master
env:
CAS_API_KEY: ${{ secrets.CAS_API_KEY }}
Expand All @@ -35,19 +34,15 @@ jobs:
--target sambanas \
--docker-hub dianlight

- name: Extract branch name
shell: bash
run: echo "BR_VERSION=${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT"
id: extract_branch

- name: pull-request
env:
BR_VERSION: ${GITHUB_REF##*/}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
shell: bash
run: |
env
gh auth login -s codespace
gh codespace create -b "release/${GITHUB_REF##*/}"
gh_pr_up() { gh pr create $* || gh pr edit $* }
gh_pr_up --base "release/${GITHUB_REF##*/}" --title "Releasing ${{ github.ref }} into release" --body ":crown: *An automated PR*"
# uses: repo-sync/pull-request@v2
# continue-on-error: true
# with:
# destination_branch: "release/${{ steps.extract_branch.outputs.branch }}"
# pr_title: "Releasing ${{ github.ref }} into master"
# pr_body: ":crown: *An automated PR*"
# github_token: ${{ secrets.GITHUB_TOKEN }}
gh pr create --base "release/${{ steps.extract_branch.outputs.BR_VERSION }}" --title "Releasing ${{ github.ref }} into release" --body ":crown: *An automated PR*"
14 changes: 9 additions & 5 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- release/*
workflow_dispatch:

permissions:
pull-requests: write

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -42,8 +45,9 @@ jobs:
--docker-hub dianlight

- name: pull-request
uses: repo-sync/pull-request@v2
with:
pr_title: "Releasing ${{ github.ref }} into master"
pr_body: ":crown: *An automated PR*"
github_token: ${{ secrets.GITHUB_TOKEN }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
shell: bash
run: |
gh pr create --title "Releasing ${{ github.ref }} into master" --body ":crown: *An automated PR*"
10 changes: 5 additions & 5 deletions .github/workflows/weekly_stats.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# yamllint disable rule:line-length
# THX to AlexBelgium - https://github.com/alexbelgium/hassio-addons
# yamllint disable rule:line-length
---
name: Generate weekly stats
on:
Expand All @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Create stats
run: |
echo "Starting"
Expand All @@ -23,7 +23,7 @@ jobs:
# Make sure file exists
file=Stats
touch "$file"
rm "$file"
rm "$file"2
if ! grep -q "Date" "$file"; then
sed -i "1i Date" "$file"
fi
Expand All @@ -45,14 +45,14 @@ jobs:
COUNT1="$COUNT"
echo "$COUNT $ARCH users with $SLUG" && DOWNLOADS="$(( DOWNLOADS + COUNT))"
else COUNT1="-"; fi
if [[ "$(jq '.arch[]' "$f/config.json")" == *"amd64"* ]]; then
if [[ "$(jq '.arch[]' "$f/config.json")" == *"amd64"* ]]; then
ARCH=amd64 && COUNT="$(curl -f -s -L https://github.com/dianlight/hassio-addons/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')"
until [ -n "$COUNT" ]; do COUNT="$(curl -f -s -L https://github.com/dianlight/hassio-addons/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')" && sleep 5; ((c++)) && ((c==10)) && break; done
COUNT="${COUNT//,/}"
COUNT2="$COUNT"
echo "$COUNT $ARCH users with $SLUG" && DOWNLOADS="$(( DOWNLOADS + COUNT))"
else COUNT2="-"; fi
if [[ "$(jq '.arch[]' "$f/config.json")" == *"aarch64"* ]]; then
if [[ "$(jq '.arch[]' "$f/config.json")" == *"aarch64"* ]]; then
ARCH=aarch64 && COUNT="$(curl -f -s -L https://github.com/dianlight/hassio-addons/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')"
until [ -n "$COUNT" ]; do COUNT="$(curl -f -s -L https://github.com/dianlight/hassio-addons/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')" && sleep 5; ((c++)) && ((c==10)) && break; done
COUNT="${COUNT//,/}"
Expand Down
30 changes: 30 additions & 0 deletions sambanas/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
# Changelog

## 12.2.0-nas

### ✨ Features
- Move addon config in `addons_config`
- Homeassitant Automount also with different user in acl
- ✨ [REQUEST] Support for APFS formatted hard drives [#184](https://github.com/dianlight/hassio-addons/issues/184) - Only ReadOnly for now

### 🩹 BugFix
- 🐛 [SambaNAS] Can't mount moredisks with label that contains a reserved word as substring [#188](https://github.com/dianlight/hassio-addons/issues/188)
- 🐛 [sambanas] 0x80070032 The request is not supported [#182](https://github.com/dianlight/hassio-addons/issues/182)
- 🐛 [SAMBA NAS] Unable to upload or rename files in external usb [#171](https://github.com/dianlight/hassio-addons/issues/171)
- 🐛 [SAMBA NAS] Getting error 100093 when trying to add a file via SMB on an external exFat disk attached to the pi [#175](https://github.com/dianlight/hassio-addons/issues/175)

### 💥 BREAKING CHANGE
- **This is the last version with** `mqtt_use_legacy_entities`. Legacy implementation will be removed in next version.
- "vfat" "msdos" "f2fs" "fuseblk" and "exfat" are now marked unsupported for timemachine.
- Internal HA Storage Mount is done with a generated superuser

### 🏗 Chore
- [Full Changelog from official addon 12.2.0][changelog_12.2.0]
- Decrease Samba log level (Skipped. Loglevel is configurable)
- Update Based Image to 15.0.3 (Alpine 3.19.0)

### 🧪 Experimental
- Rework on all MQTT client implementation. [In Progress]



[changelog_12.2.0]: https://github.com/home-assistant/addons/pull/3002

## 12.1.0-nas

### 🏗 Chore
Expand Down
16 changes: 14 additions & 2 deletions sambanas/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ARG HDDTEMP_VERSION
FROM $BUILD_FROM as builder

SHELL ["/bin/bash", "-eo", "pipefail", "-c"]
RUN apk add --no-cache make gcc libc-dev linux-headers build-base autoconf automake
RUN apk add --no-cache make gcc libc-dev linux-headers build-base autoconf automake git

ARG BUILD_ARCH
ARG HDDTEMP_VERSION
Expand All @@ -23,6 +23,9 @@ RUN cd / && wget -q -O - "http://download.savannah.nongnu.org/releases/hddtemp/h
RUN cd / && wget -q -O - "https://github.com/Netgear/wsdd2/archive/refs/heads/master.tar.gz" | tar zxvf - \
&& cd wsdd2-master && make

#RUN cd / && git clone https://github.com/linux-apfs/linux-apfs-rw.git \
# && cd linux-apfs-rw && make

# hadolint ignore=DL3006
FROM ${BUILD_FROM}

Expand Down Expand Up @@ -81,7 +84,10 @@ RUN apk add --no-cache \
wsdd \
udisks2 \
libcap \
hd-idle
hd-idle \
fuse3 \
apfs-fuse \
py3-pip

# HDDTEMP
ARG HDDTEMP_VERSION
Expand All @@ -107,6 +113,12 @@ RUN curl -Lso /usr/bin/ha "https://github.com/home-assistant/cli/releases/downlo

#RUN echo "devtmpfs /dev_ devtmpfs rw,relatime,size=1965288k,nr_inodes=182901,mode=755 0 0" >> /etc/fstab

# ENABLE FUSE APFS
RUN ln -s /usr/sbin/apfs-fuse /usr/sbin/mount.apfs

# PYTHON ADDONS
RUN pip install pySMART psutil ha-mqtt-discoverable humanize

# Copy data
COPY rootfs /

Expand Down
16 changes: 8 additions & 8 deletions sambanas/build.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
build_from:
aarch64: ghcr.io/hassio-addons/base:14.3.2
amd64: ghcr.io/hassio-addons/base:14.3.2
armhf: ghcr.io/hassio-addons/base:14.3.2
armv7: ghcr.io/hassio-addons/base:14.3.2
i386: ghcr.io/hassio-addons/base:14.3.2
codenotary:
signer: [email protected]
base_image: [email protected]
aarch64: ghcr.io/hassio-addons/base:15.0.3
amd64: ghcr.io/hassio-addons/base:15.0.3
armhf: ghcr.io/hassio-addons/base:15.0.3
armv7: ghcr.io/hassio-addons/base:15.0.3
i386: ghcr.io/hassio-addons/base:15.0.3
#codenotary:
# signer: [email protected]
# base_image: [email protected]
args:
HDDTEMP_VERSION: "0.3-beta15"
3 changes: 2 additions & 1 deletion sambanas/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Samba NAS
version: 12.1.0-nas
version: 12.2.0-nas
slug: sambanas
description: Expose Home Assistant disc with SMB/CIFS
url: https://github.com/dianlight/hassio-addons/tree/master/sambanas
Expand All @@ -19,6 +19,7 @@ hassio_role: admin
host_network: true
map:
- homeassistant_config:rw
- addon_config:rw
- ssl:rw
- all_addon_configs:rw
- addons:rw
Expand Down
15 changes: 6 additions & 9 deletions sambanas/rootfs/etc/s6-overlay/s6-rc.d/cifs-supervisor-mount/run
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@ if [ -f /tmp/cifs_network ]; then

bashio::log.info "Automount Shares..."

#interface=$(bashio::network.name)
#ipaddress=$(bashio::network.ipv4_address "${interface}")
#interface=$(bashio::network 'network.info.docker.inerface' '.docker.interface')
#ipaddress=$(bashio::network 'network.info.docker.network' '.docker.address')
#hostname=$(bashio::addon.hostname)
ipaddress=$(bashio::addon.ip_address)
#bashio::log "Addon IP: ${hostname}/${ipaddress}"

username=$(bashio::config 'username')
password=$(bashio::config 'password')
#username=$(bashio::config 'username')
#password=$(bashio::config 'password')

username=$(jq -r '.username' </tmp/auth.json)
password=$(jq -r '.password' </tmp/auth.json)

available_shares=$(awk '/\[(.*)\]/{ DISK=substr($1,2,length($1)-2); next } /.*path =(.*)/{ printf "%s\n",DISK,$0 }' /etc/samba/smb.conf)

Expand All @@ -36,7 +33,7 @@ if [ -f /tmp/cifs_network ]; then
timeout 30 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/$0/$1; do sleep 1; done' ${ipaddress/\/*/} 445

while read -r -a device; do
[[ "share config addons ssl backup media all_addon_configs homeassistant" =~ $device ]] && continue
[[ ${device,,} == @(share|config|addons|ssl|backup|media|addon_configs|homeassistant) ]] && continue
usage=$(jq -r --arg xshare "$device" '.acl[] | select(.share==$xshare) | .usage // "media"' <<<"$(bashio::addon.config)")
cmdshare=$(jq -nrc --arg usage "${usage:-media}" --arg share "$device" --arg ip "${ipaddress/\/*/}" --arg user "$username" --arg pwd "$password" '.name=$share|.usage=$usage|.type="cifs"|.server=$ip|.share=$share|.username=$user|.password=$pwd')
#bashio::log.info "${cmdshare}"
Expand Down
23 changes: 13 additions & 10 deletions sambanas/rootfs/etc/s6-overlay/s6-rc.d/init-automount/run
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ declare fstypes
declare dev
declare mntops
declare reserved_names
declare cleanmountdisks

function disk2label() { # $1 disk return (label disk or id)
local disk=$1
Expand Down Expand Up @@ -44,13 +43,12 @@ function disk2label() { # $1 disk return (label disk or id)
}

# Check for reserved mount name
function reserved_mount_name() { # $1 disk $2 cleanmountdisks
function reserved_mount_name() { # $1 disk
disk=$1
cleanmountdisks=$2
reserved_names=(config addons ssl share backup media all_addon_configs homeassistant)
for disk in "${reserved_names[@]}"; do
if [[ ${cleanmountdisks[@]} =~ $disk ]]; then
tomountdisks=("${cleanmountdisks[@]/$disk/}")
for rdisk in "${reserved_names[@]}"; do
if [[ ${rdisk,,} = ${disk,,} ]]; then
tomountdisks=("${tomountdisks[@]/$disk/}")
return 0
fi
done
Expand Down Expand Up @@ -114,7 +112,11 @@ function mount_disk() { # $1 disk $2 path $3 remote_mount $4 mount_options
echo "$dev" >>/tmp/remote_mount
fi || bashio::log.warning "Host Mount ${mdisk}[${fstype}] Fail!" || :
mount -t $type "$dev" "$path/$mdisk" -o $options &&
echo "$path"/"$mdisk" >>/tmp/local_mount && bashio::log.info "Mount ${mdisk}[${fstype}] Success!"
echo "$path"/"$mdisk" >>/tmp/local_mount &&
jq --arg dname "${mdisk}" --arg path "${path}/${mdisk}" --arg fs "${fstype}" ' . += {($dname):{"path":$path,"fs":$fs}}' /tmp/local_mount.json >/tmp/local_mount.json.tmp &&
mv /tmp/local_mount.json.tmp /tmp/local_mount.json &&
bashio::log.info "Mount ${mdisk}[${fstype}] Success!"

fi
}

Expand Down Expand Up @@ -151,7 +153,7 @@ elif bashio::config.has_value 'moredisks' || bashio::config.true 'automount'; th
fstypes=$(grep -v nodev </proc/filesystems | tr -d '\n')
bashio::log.blue "---------------------------------------------------"
bashio::log.green "Supported fs: ${fstypes}"
if grep -q fuseblk </proc/filesystems; then bashio::log.green "Supported fusefs: $(find /sbin -name "mount*fuse" | cut -c 13- | tr "\n" " " | sed s/fuse//g)"; fi
if grep -q fuseblk </proc/filesystems; then bashio::log.green "Supported fusefs: $(find /usr/sbin -name "mount*" | cut -c 17- | tr "\n" " " | sed s/fuse.//g)"; fi
bashio::log.blue "---------------------------------------------------"

# Check Host Ssh config
Expand Down Expand Up @@ -245,12 +247,13 @@ elif bashio::config.has_value 'moredisks' || bashio::config.true 'automount'; th
bashio::log.magenta "---------------------------------------------------"
bashio::log.info "Checking Mounting disks for reserved names:\n" $(printf "\t%s\n" "${tomountdisks[@]}")
bashio::log.magenta "---------------------------------------------------"
cleanmountdisks="${tomountdisks[@]}"
for disk in "${tomountdisks[@]}"; do
reserved_mount_name "$disk" "${cleanmountdisks[@]}" || bashio::log.warning "Fail to mount ${disk} due to reserved name!"
reserved_mount_name "$disk" || bashio::log.warning "Fail to mount ${disk} due to reserved name!"
done
fi

echo "{}" >/tmp/local_mount.json

if [ ${#tomountdisks[@]} -gt 0 ]; then
bashio::log.magenta "---------------------------------------------------"
bashio::log.info "Mounting disks:\n" $(printf "\t%s\n" "${tomountdisks[@]}")
Expand Down
Loading
Loading