mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-18 13:44:20 +01:00
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:
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## 7.0
|
||||
|
||||
- Added bash_profile as a persistent file
|
||||
|
||||
## 6.4
|
||||
|
||||
- Changed logging from DEBUG -> INFO
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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..."
|
||||
|
||||
Reference in New Issue
Block a user