mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-13 19:29:53 +03:00
41 lines
1.3 KiB
Bash
41 lines
1.3 KiB
Bash
#!/bin/sh
|
|
|
|
ver_old="$2"
|
|
|
|
if [ "$(apk version -t "$ver_old" '2.3.0-r0')" = '<' ]; then
|
|
confdir="/etc/zigbee2mqtt"
|
|
datadir="/var/lib/zigbee2mqtt"
|
|
|
|
# We used to install symlinks /var/lib/zigbee2mqtt/{configuration,secret}.yaml
|
|
# for configuration files in /etc/zigbee2mqtt. If they exist in /etc/zigbee2mqtt,
|
|
# recreate the symlinks to maintain backward compatibility.
|
|
for fname in configuration.yaml secret.yaml; do
|
|
if [ -f "$confdir/$fname" ] && ! [ -e "$datadir/$fname" ]; then
|
|
ln -s "$confdir/$fname" "$datadir/$fname"
|
|
fi
|
|
done
|
|
|
|
# We used to patch zigbee2mqtt to allow include pan_id in configuration.yaml
|
|
# from the secret.yaml.
|
|
if grep -Eq "pan_id:\s*.!secret\s+pan_id" "$datadir"/configuration.yaml 2>/dev/null; then
|
|
if pan_id="$(sed -En 's/^pan_id:\s*(\S+)/\1/p' "$datadir"/secret.yaml 2>/dev/null)"; then
|
|
cat >&2 <<-EOF
|
|
*
|
|
* Including pan_id from secret.yaml is no longer supported. Replacing
|
|
* "pan_id: !secret pan_id" in $datadir/configuration.yaml with "$pan_id"
|
|
* from $datadir/secret.yaml...
|
|
*
|
|
EOF
|
|
sed -Ei "s/^(\s+pan_id:\s*).!secret\s+pan_id.*/\1$pan_id" "$datadir"/configuration.yaml
|
|
else
|
|
cat >&2 <<-EOF
|
|
!!
|
|
!! Including pan_id from secret.yaml is no longer supported. you have to replace
|
|
!! "pan_id: '!secret pan_id'" in $datadir/configuration.yaml with the pan_id value.
|
|
!!
|
|
EOF
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
exit 0
|