Skip to content

Commit

Permalink
🔨 Refactor of init scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
frenck committed Apr 20, 2019
1 parent e96798e commit 0b4f6da
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 23 deletions.
6 changes: 0 additions & 6 deletions tasmoadmin/rootfs/etc/cont-init.d/10-requirements.sh

This file was deleted.

16 changes: 0 additions & 16 deletions tasmoadmin/rootfs/etc/cont-init.d/12-migrate.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
#!/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...'

Expand Down

0 comments on commit 0b4f6da

Please sign in to comment.