diff --git a/ssh/CHANGELOG.md b/ssh/CHANGELOG.md index fccc1c8..33c02f3 100644 --- a/ssh/CHANGELOG.md +++ b/ssh/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 7.0 + +- Added bash_profile as a persistent file + ## 6.4 - Changed logging from DEBUG -> INFO diff --git a/ssh/config.json b/ssh/config.json index 2ccd1ca..c211c31 100644 --- a/ssh/config.json +++ b/ssh/config.json @@ -1,6 +1,6 @@ { "name": "SSH server", - "version": "6.4", + "version": "7.0", "slug": "ssh", "description": "Allows connections over SSH", "url": "https://github.com/home-assistant/hassio-addons/tree/master/ssh", diff --git a/ssh/data/run.sh b/ssh/data/run.sh index f36707f..a3b09cc 100755 --- a/ssh/data/run.sh +++ b/ssh/data/run.sh @@ -47,8 +47,15 @@ touch /data/.bash_history chmod 600 /data/.bash_history ln -s -f /data/.bash_history /root/.bash_history -# Store token for Hass.io API -echo "export HASSIO_TOKEN=${HASSIO_TOKEN}" >> /root/.bash_profile +# Persist .bash_profile by redirecting .bash_profile to /data +if bashio::fs.file_exists /data/.bash_profile; then + sed -i "s/export HASSIO_TOKEN=.*/export HASSIO_TOKEN=${HASSIO_TOKEN}/" /data/.bash_profile +else + echo "export HASSIO_TOKEN=${HASSIO_TOKEN}" > /data/.bash_profile +fi + +chmod 600 /data/.bash_profile +ln -s -f /data/.bash_profile /root/.bash_profile # Start server bashio::log.info "Starting SSH daemon..."