mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-15 20:09:13 +02:00
refactor: simplify addon config symlink setup
This commit is contained in:
committed by
GitHub
parent
c95c53eb63
commit
a158621de9
@@ -13,14 +13,15 @@ if [ -f /homeassistant/addons_config/filebrowser_quantum/filebrowser_quantum.db
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f /config/filebrowser_quantum.db ] && [ -d /addon_configs ]; then
|
if [ ! -f /config/filebrowser_quantum.db ] && [ -d /addon_configs ]; then
|
||||||
|
shopt -s nullglob
|
||||||
for addon_config_dir in /addon_configs/*_filebrowser_quantum; do
|
for addon_config_dir in /addon_configs/*_filebrowser_quantum; do
|
||||||
[ -d "$addon_config_dir" ] || continue
|
|
||||||
if [ -f "$addon_config_dir/filebrowser_quantum.db" ]; then
|
if [ -f "$addon_config_dir/filebrowser_quantum.db" ]; then
|
||||||
echo "Moving database from addon_configs location to /config"
|
echo "Moving database from addon_configs location to /config"
|
||||||
cp -rnf "$addon_config_dir"/. /config/
|
cp -rnf "$addon_config_dir"/. /config/
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
shopt -u nullglob
|
||||||
fi
|
fi
|
||||||
|
|
||||||
######################
|
######################
|
||||||
@@ -46,12 +47,16 @@ if [ -d /homeassistant ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Create symlinks with legacy folders
|
# Create symlinks with legacy folders
|
||||||
|
addon_configs_symlink_dir=""
|
||||||
if [ -d /homeassistant/addons_config ]; then
|
if [ -d /homeassistant/addons_config ]; then
|
||||||
ln -s /homeassistant/addons_config /config
|
ln -s /homeassistant/addons_config /config
|
||||||
find /addon_configs/ -maxdepth 1 -mindepth 1 -type d -not -name "*filebrowser_quantum*" -exec ln -s {} /config/addons_config/ \;
|
addon_configs_symlink_dir="/config/addons_config"
|
||||||
elif [ -d /addon_configs ]; then
|
elif [ -d /addon_configs ]; then
|
||||||
mkdir -p /config/addon_configs
|
mkdir -p /config/addon_configs
|
||||||
find /addon_configs/ -maxdepth 1 -mindepth 1 -type d -not -name "*filebrowser_quantum*" -exec ln -s {} /config/addon_configs/ \;
|
addon_configs_symlink_dir="/config/addon_configs"
|
||||||
|
fi
|
||||||
|
if [ -n "$addon_configs_symlink_dir" ]; then
|
||||||
|
find /addon_configs/ -maxdepth 1 -mindepth 1 -type d -not -name "*filebrowser_quantum*" -exec ln -s {} "$addon_configs_symlink_dir"/ \;
|
||||||
fi
|
fi
|
||||||
if [ -d /homeassistant/addons_autoscripts ]; then
|
if [ -d /homeassistant/addons_autoscripts ]; then
|
||||||
ln -s /homeassistant/addons_autoscripts /config
|
ln -s /homeassistant/addons_autoscripts /config
|
||||||
|
|||||||
Reference in New Issue
Block a user