Update and rename 00-run.sh to 99-run.sh

This commit is contained in:
Alexandre
2023-11-30 21:12:45 +01:00
committed by GitHub
parent e6a9733ffa
commit 0f2ba5c36a
2 changed files with 55 additions and 51 deletions

View File

@@ -0,0 +1,55 @@
#!/bin/bash
# shellcheck shell=bash
set -e
CONFIGSOURCE="/config"
# Use ssl
if [ -d /ssl ]; then
mkdir -p /cert
cp -r /ssl/* /cert
chown -R 508:508 /cert
fi
# Create directory
if [ ! -f "$CONFIGSOURCE" ]; then
echo "Creating directory"
mkdir -p "$CONFIGSOURCE"
fi
# Migrate previous files
mkdir -p /config/data
mv /data/* /config/data
# Copy container files
cp -rnf /opt/tplink/EAPController/data/* "$CONFIGSOURCE"
rm -r /opt/tplink/EAPController/data/*
# Create symlinks
echo "Creating symlink"
# Create potentially missing folers
for folders in html keystore pdf db portal; do
mkdir -p "$CONFIGSOURCE/$folders"
done
touch /config/LAST_RAN_OMADA_VER.txt
# Create symlinks for all files in /data
for item in "$CONFIGSOURCE"/*; do
# Get the base name of the file or folder
base_name=$(basename "$item")
# Create a symbolic link in the current working directory
ln -s "$item" /opt/tplink/EAPController/data/"$base_name"
echo "Created symlink for '$base_name'"
done
# Make sure permissions are right
echo "Updating permissions"
chmod -R 777 "$CONFIGSOURCE"
chown -R "508:508" "$CONFIGSOURCE"
echo ""
echo ""
echo "Recommendation : please backup your database and migrated to this addon https://github.com/jkunczik/home-assistant-omada"
echo ""
echo ""