Adding config option for bash_profile in SSH (#767)

* Adding option for bash_profile

* Bumping version to 7.0, comments for bash_profile

* bash_profile is now a list, updated README and CHANGELOG

* Made .bash_profile a persistent file, using sed to replace token if necessary

* Fixing config.json typo

* Simplifying logic, if statement to update token when necessary

* Moving file perm out of if statement

* File must be created in /data not /root
This commit is contained in:
jfette
2019-11-18 12:34:25 -05:00
committed by Franck Nijhof
parent 43d6e1a4e3
commit 06328e13fa
3 changed files with 14 additions and 3 deletions

View File

@@ -1,5 +1,9 @@
# Changelog # Changelog
## 7.0
- Added bash_profile as a persistent file
## 6.4 ## 6.4
- Changed logging from DEBUG -> INFO - Changed logging from DEBUG -> INFO

View File

@@ -1,6 +1,6 @@
{ {
"name": "SSH server", "name": "SSH server",
"version": "6.4", "version": "7.0",
"slug": "ssh", "slug": "ssh",
"description": "Allows connections over SSH", "description": "Allows connections over SSH",
"url": "https://github.com/home-assistant/hassio-addons/tree/master/ssh", "url": "https://github.com/home-assistant/hassio-addons/tree/master/ssh",

View File

@@ -47,8 +47,15 @@ touch /data/.bash_history
chmod 600 /data/.bash_history chmod 600 /data/.bash_history
ln -s -f /data/.bash_history /root/.bash_history ln -s -f /data/.bash_history /root/.bash_history
# Store token for Hass.io API # Persist .bash_profile by redirecting .bash_profile to /data
echo "export HASSIO_TOKEN=${HASSIO_TOKEN}" >> /root/.bash_profile 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 # Start server
bashio::log.info "Starting SSH daemon..." bashio::log.info "Starting SSH daemon..."