🔨 Refactor of init scripts

parent e96798e2
Pipeline #57870190 passed with stages
in 8 minutes and 13 seconds
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Community Hass.io Add-ons: TasmoAdmin
# This files check if all user configuration requirements are met
# ==============================================================================
bashio::config.require.ssl
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Community Hass.io Add-ons: TasmoAdmin
# Migrates data from sonweb to TasmoAdmin
# ==============================================================================
if bashio::fs.directory_exists "/data/sonweb"; then
bashio::log.info 'Migrating data from sonweb to tasmoadmin...'
# Rename data folder
mv /data/sonweb /data/tasmoadmin
# Ensure file permissions
chown -R nginx:nginx /data/tasmoadmin
find /data/tasmoadmin -not -perm 0644 -type f -exec chmod 0644 {} \;
find /data/tasmoadmin -not -perm 0755 -type d -exec chmod 0755 {} \;
fi
......@@ -6,6 +6,8 @@
declare certfile
declare keyfile
bashio::config.require.ssl
if bashio::config.true 'ssl'; then
rm /etc/nginx/nginx.conf
mv /etc/nginx/nginx-ssl.conf /etc/nginx/nginx.conf
......
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Community Hass.io Add-ons: TasmoAdmin
# Ensures data is store in a persistent location
# Configures TasmoAdmin
# ==============================================================================
# Migrate from older installations
if bashio::fs.directory_exists "/data/sonweb"; then
bashio::log.info 'Migrating data from sonweb to tasmoadmin...'
# Rename data folder
mv /data/sonweb /data/tasmoadmin
# Ensure file permissions
chown -R nginx:nginx /data/tasmoadmin
find /data/tasmoadmin -not -perm 0644 -type f -exec chmod 0644 {} \;
find /data/tasmoadmin -not -perm 0755 -type d -exec chmod 0755 {} \;
fi
# Ensure persistant storage exists
if ! bashio::fs.directory_exists "/data/tasmoadmin"; then
bashio::log.debug 'Data directory not initialized, doing that now...'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment