Skip to content
This repository has been archived by the owner on Oct 30, 2019. It is now read-only.

Commit

Permalink
Update Master with changes from dev branch (#246)
Browse files Browse the repository at this point in the history
* Set timeout value

* Adds hassbian manager script

* Should not be there

* Add note about port number

* fix remove premissions

* Fixes typo

* Remove controlfile when removing suite

* Add autocomplete for remove

* Added link in Readme

* Adds custom-component-store script

* should not be in this PR

* Adds basic auth support

* Adds basic auth

* Don't ask for confirmation during uninstall

* Don't ask for confirmation during uninstall

* cloud9: Add npm install to c9 script to make sure all packages are installed. (#236)

* Add npm install to c9 script to make sure all packages are installed.

* typo correction

* Typo correction

* only use NPM install if sdk install fails.

* Print the config issues

This will help with troubleshooting

* - Change all instances of NodeJS to install NodeJS 10.x
 - Remove NodeJS package from base install to avoid installing an old 
version of NodeJS

* Master (#244)

* Added postgres instructions (#224)
* Fixed example (#225)

* Update Master with changes from dev branch (#245)

* Added postgres instructions (#224)

Added database creation and configuration instructions.

* Fixed example (#225)

Sudo command was missing `-s` flag.
  • Loading branch information
Landrash committed Mar 17, 2019
1 parent 6d88ea7 commit 9ac6e49
Show file tree
Hide file tree
Showing 15 changed files with 371 additions and 7 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ below for usage and instructions.
- [hassbian-config](/docs/hassbian_config.md)
- [AppDaemon](/docs/appdaemon.md)
- [Cloud9](/docs/cloud9.md)
- [custom-component-store](/docs/custom-component-store.md)
- [Duck DNS](/docs/duckdns.md)
- [Fail2ban](/docs/fail2ban.md)
- [Hassbian](/docs/hassbian.md)
- [Home Assistant](/docs/homeassistant.md)
- [Homebridge](/docs/homebridge.md)
- [HUE](/docs/hue.md)
- [LibCEC](/docs/libcec.md)
- [Manager](/docs/manager.md)
- [MariaDB](/docs/mariadb.md)
- [Monitor](/docs/monitor.md)
- [Mosquitto](/docs/mosquitto.md)
Expand Down
45 changes: 45 additions & 0 deletions docs/custom-component-store.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Custom component store

Custom component store is a web UI tool that can help you manage your custom components.

![overview](https://camo.githubusercontent.com/b01a7e30e5c8d5938eed8091ec23ad9b4dc84cfe/68747470733a2f2f692e6962622e636f2f42737a714c58722f64656d6f2e676966)

When installed the WEB UI are running on port `8120`

## Installation

```bash
sudo hassbian-config install custom-component-store
```

## Upgrade

```bash
sudo hassbian-config upgrade custom-component-store
```

## Remove to beta channel

```bash
sudo hassbian-config remoev custom-component-store
```

## Additional info

Description | Command/value
:--- | :---
Running as: | homeassistant
Default user: | `pi`
Default password: | `raspberry`
Port: | `8120`
Start service: | `sudo systemctl start custom-component-store@homeassistant.service`
Stop service: | `sudo systemctl stop custom-component-store@homeassistant.service`
Restart service: | `sudo systemctl restart custom-component-store@homeassistant.service`
Service status: | `sudo systemctl status custom-component-store@homeassistant.service`

***

The script was originally contributed by [@Ludeeus][ludeeus].

<!--- Links --->
[ludeeus]: https://github.com/ludeeus
43 changes: 43 additions & 0 deletions docs/manager.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Hassbian manager

Hassbian manager is a web UI tool that can help you manage your suites.

When installed the WEB UI are running on port `9999`

## Installation

```bash
sudo hassbian-config install manager
```

## Upgrade

```bash
sudo hassbian-config upgrade manager
```

## Remove to beta channel

```bash
sudo hassbian-config remoev manager
```

## Additional info

Description | Command/value
:--- | :---
Running as: | homeassistant
Default user: | `pi`
Default password: | `raspberry`
Port: | `9999`
Start service: | `sudo systemctl start hassbian-manager@homeassistant.service`
Stop service: | `sudo systemctl stop hassbian-manager@homeassistant.service`
Restart service: | `sudo systemctl restart hassbian-manager@homeassistant.service`
Service status: | `sudo systemctl status hassbian-manager@homeassistant.service`

***

The script was originally contributed by [@Ludeeus][ludeeus].

<!--- Links --->
[ludeeus]: https://github.com/ludeeus
2 changes: 1 addition & 1 deletion package/DEBIAN/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: hassbian-scripts
Version: 0.11.1
Priority: optional
Architecture: all
Depends: bash, wget, git, python3, python3-venv, python3-pip, python3-dev, bluetooth, libbluetooth-dev, avahi-daemon, build-essential, libssl-dev, libffi-dev, python-dev,libudev-dev, zip, nodejs, apt-transport-https, bluez-hcidump, bc, figlet
Depends: bash, wget, git, python3, python3-venv, python3-pip, python3-dev, bluetooth, libbluetooth-dev, avahi-daemon, build-essential, libssl-dev, libffi-dev, python-dev,libudev-dev, zip, apt-transport-https, bluez-hcidump, bc, figlet
Maintainer: Fredrik Lindqvist <github.com/Landrash>
Homepage: www.home-assistant.io
Description: Hassbian scripts
Expand Down
2 changes: 1 addition & 1 deletion package/etc/bash_completion.d/hassbian-config
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ _hassbian-config()
fi

case "${prev}" in
install|upgrade|show)
install|upgrade|show|remove)
COMPREPLY=( $(compgen -W "${inst}" -- ${cur}) )
return 0
;;
Expand Down
2 changes: 1 addition & 1 deletion package/etc/sudoers.d/020_homeassistant_hassbian-scripts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%homeassistant ALL= NOPASSWD: /usr/local/bin/hassbian-config show *
%homeassistant ALL= NOPASSWD: /usr/local/bin/hassbian-config install *
%homeassistant ALL= NOPASSWD: /usr/local/bin/hassbian-config upgrade *

%homeassistant ALL= NOPASSWD: /usr/local/bin/hassbian-config remove *
1 change: 1 addition & 0 deletions package/etc/systemd/system/install_homeassistant.service
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ After=network.target
[Service]
ExecStartPre=/usr/local/bin/hassbian-config upgrade hassbian-script
ExecStart=/usr/local/bin/hassbian-config install homeassistant --force
TimeOutSec=1800

[Install]
WantedBy=multi-user.target
19 changes: 17 additions & 2 deletions package/opt/hassbian/suites/cloud9.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function cloud9-install-package {
node=$(which node)
if [ -z "${node}" ]; then #Installing NodeJS if not already installed.
printf "Downloading and installing NodeJS...\\n"
curl -sL https://deb.nodesource.com/setup_9.x | bash -
curl -sL https://deb.nodesource.com/setup_10.x | bash -
apt install -y nodejs
fi

Expand Down Expand Up @@ -48,9 +48,23 @@ echo "Starting Cloud9 service..."
systemctl start cloud9@homeassistant.service

echo "Checking the installation..."
ip_address=$(ifconfig | grep "inet.*broadcast" | grep -v 0.0.0.0 | awk '{print $2}')
sleep 15
validation=$(pgrep -f cloud9)
if [ ! -z "${validation}" ]; then
echo "Using fallback installation."
echo "Installing npm"
apt install -y npm

cd /opt/c9sdk || exit 1
npm install

echo "Checking the installation..."
sleep 15
fi

validation=$(pgrep -f cloud9)
if [ -z "${validation}" ]; then
ip_address=$(ifconfig | grep "inet.*broadcast" | grep -v 0.0.0.0 | awk '{print $2}')
echo
echo -e "\\e[32mInstallation done.\\e[0m"
echo "Your Cloud9 IDE is now avaiable at http://$ip_address:8181"
Expand All @@ -77,6 +91,7 @@ printf "Starting Cloud9 service...\\n"
systemctl start cloud9@homeassistant.service

echo "Checking the installation..."
sleep 15
validation=$(pgrep -f cloud9)
if [ ! -z "${validation}" ]; then
echo
Expand Down
112 changes: 112 additions & 0 deletions package/opt/hassbian/suites/custom-component-store.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#!/bin/bash
function custom-component-store-show-short-info {
echo "Custom component store script."
}

function custom-component-store-show-long-info {
echo "Custom component store is a web UI tool that can help you manage your custom components."
}

function custom-component-store-show-copyright-info {
echo "Original concept by Ludeeus <https://github.com/ludeeus>."
}

function custom-component-store-install-package {

if [ "$ACCEPT" == "true" ]; then
username=pi
password=raspberry
else
echo
echo "Please take a moment to setup your the user account"
echo

echo -n "Username: "
read -r username
if [ ! "$username" ]; then
username=pi
fi

echo -n "Password: "
read -s -r password
echo
if [ ! "$password" ]; then
password=raspberry
fi
fi

echo "Installing latest version of Custom component store"
python3 -m pip install componentstore

echo "Enabling Custom component store service"
cp /opt/hassbian/suites/files/custom-component-store@homeassistant.service /etc/systemd/system/custom-component-store@homeassistant.service

sed -i "s,%%USERNAME%%,${username},g" /etc/systemd/system/custom-component-store@homeassistant.service
sed -i "s,%%PASSWORD%%,${password},g" /etc/systemd/system/custom-component-store@homeassistant.service

systemctl enable custom-component-store@homeassistant.service
sync

echo "Starting Custom component storer"
systemctl start custom-component-store@homeassistant.service

echo "Starting cleanup"
cd || exit 1
rm -R /tmp/custom-component-store

ip_address=$(ifconfig | grep "inet.*broadcast" | grep -v 0.0.0.0 | awk '{print $2}')

echo "Checking the installation..."
validation=$(pgrep -x componentstore)
if [ ! -z "${validation}" ]; then
echo
echo -e "\\e[32mInstallation done..\\e[0m"
echo "Custom component store installation is running at $ip_address:8120 or if preferred http://hassbian.local:8120"
echo
echo
else
echo
echo -e "\\e[31mInstallation failed..."
echo
return 1
fi
return 0
}

function custom-component-store-upgrade-package {
echo "Upgrading Custom component store"
python3 -m pip install --upgrade componentstore

echo "Restarting Custom component store"
systemctl start custom-component-store@homeassistant.service

echo "Checking the installation..."
validation=$(pgrep -x componentstore)
if [ ! -z "${validation}" ]; then
echo
echo -e "\\e[32mUpgrade script completed..\\e[0m"
echo
else
echo
echo -e "\\e[31mUpgrade failed..."
echo
return 1
fi
return 0
}

function custom-component-store-remove-package {
printf "Removing Custom component store...\\n"
systemctl stop custom-component-store@homeassistant.service
systemctl disable custom-component-store@homeassistant.service
rm /etc/systemd/system/custom-component-store@homeassistant.service
sync


python3 -m pip uninstall --yes componentstore


printf "\\e[32mRemoval done..\\e[0m\\n"
}

[[ "$_" == "$0" ]] && echo "hassbian-config helper script; do not run directly, use hassbian-config instead"
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# Service file for systems with systemd to run custom-component-store as the homeassistant user.
#

[Unit]
Description=custom-component-store for %i
After=network.target

[Service]
Type=simple
User=%i
ExecStart=/usr/local/bin/componentstore --port 8120 --nocache --username %%USERNAME%% --password %%PASSWORD%% --ha_path /home/homeassistant/.homeassistant
SendSIGKILL=no

[Install]
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# Service file for systems with systemd to run Hassbian manager as the homeassistant user.
#

[Unit]
Description=Hassbian manager for %i
After=network.target

[Service]
Type=simple
User=%i
ExecStart=/usr/local/bin/pyhassbian --username %%USERNAME%% --password %%PASSWORD%%
SendSIGKILL=no

[Install]
WantedBy=multi-user.target
1 change: 1 addition & 0 deletions package/opt/hassbian/suites/homeassistant.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ EOF
config_check_lines=$(echo "$config_check" | wc -l)
if (( config_check_lines > 2 ));then
if [ "$ACCEPT" != "true" ]; then
echo "$config_check"
echo -n "Config check failed for new version, do you want to revert? [Y/n] : "
read -r RESPONSE
if [ ! "$RESPONSE" ]; then
Expand Down
Loading

0 comments on commit 9ac6e49

Please sign in to comment.