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

Preparations for Stickler CI #112

Merged
merged 9 commits into from
Feb 17, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 41 additions & 41 deletions package/opt/hassbian/suites/appdaemon.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash
function appdaemon-show-short-info {
echo "AppDaemon install script for Hassbian"
echo "AppDaemon install script for Hassbian."
}

function appdaemon-show-long-info {
echo "Installs AppDaemon in a separate Venv onto this system."
echo "Installs AppDaemon in a separate Venv onto this system."
}

function appdaemon-show-copyright-info {
echo "Copyright(c) 2017 Fredrik Lindqvist <https://github.com/Landrash>"
echo "Copyright(c) 2017 Fredrik Lindqvist <https://github.com/Landrash>."
}

function appdaemon-install-package {
Expand All @@ -18,7 +18,7 @@ appdaemon-show-copyright-info
if [ "$ACCEPT" != "true" ]; then
if [ -f "/usr/sbin/samba" ]; then
echo -n "Do you want to add Samba share for AppDaemon configuration? [N/y] : "
read SAMBA
read -r SAMBA
fi
fi

Expand Down Expand Up @@ -62,34 +62,34 @@ echo "Starting AppDaemon service"
systemctl start appdaemon@homeassistant.service

if [ "$SAMBA" == "y" ] || [ "$SAMBA" == "Y" ]; then
echo "Adding configuration to Samba..."
echo "[appdaemon]" | tee -a /etc/samba/smb.conf
echo "path = /home/homeassistant/appdaemon" | tee -a /etc/samba/smb.conf
echo "writeable = yes" | tee -a /etc/samba/smb.conf
echo "guest ok = yes" | tee -a /etc/samba/smb.conf
echo "create mask = 0644" | tee -a /etc/samba/smb.conf
echo "directory mask = 0755" | tee -a /etc/samba/smb.conf
echo "force user = homeassistant" | tee -a /etc/samba/smb.conf
echo "" | tee -a /etc/samba/smb.conf
echo "Restarting Samba service"
sudo systemctl restart smbd.service
echo "Adding configuration to Samba..."
echo "[appdaemon]" | tee -a /etc/samba/smb.conf
echo "path = /home/homeassistant/appdaemon" | tee -a /etc/samba/smb.conf
echo "writeable = yes" | tee -a /etc/samba/smb.conf
echo "guest ok = yes" | tee -a /etc/samba/smb.conf
echo "create mask = 0644" | tee -a /etc/samba/smb.conf
echo "directory mask = 0755" | tee -a /etc/samba/smb.conf
echo "force user = homeassistant" | tee -a /etc/samba/smb.conf
echo "" | tee -a /etc/samba/smb.conf
echo "Restarting Samba service"
sudo systemctl restart smbd.service
fi

validation=$(ps -ef | grep -v grep | grep appdaemon | wc -l)
if [ "$validation" != "0" ]; then
echo
echo -e "\e[32mInstallation done..\e[0m"
echo
echo "You will find the AppDaemon configuration files in:"
echo "/home/homeassistant/appdaemon"
echo
echo "To continue have a look at http://appdaemon.readthedocs.io/en/latest/"
echo
validation=$(pgrep -f appdaemon)
if [ "$validation" == NULL ]; then
echo
echo -e "\e[32mInstallation done..\e[0m"
echo
echo "You will find the AppDaemon configuration files in:"
echo "/home/homeassistant/appdaemon"
echo
echo "To continue have a look at http://appdaemon.readthedocs.io/en/latest/"
echo
else
echo -e "\e[31mInstallation failed..."
echo -e "\e[31mAborting..."
echo -e "\e[0mIf you have issues with this script, please say something in the #devs_hassbian channel on Discord."
return 1
echo -e "\e[31mInstallation failed..."
echo -e "\e[31mAborting..."
echo -e "\e[0mIf you have issues with this script, please say something in the #devs_hassbian channel on Discord."
return 1
fi
return 0
}
Expand Down Expand Up @@ -120,19 +120,19 @@ echo "Starting AppDaemon service..."
systemctl start appdaemon@homeassistant.service

echo "Checking the installation..."
validation=$(ps -ef | grep -v grep | grep appdaemon | wc -l)
if [ "$validation" != "0" ]; then
echo
echo -e "\e[32mUppgrade done..\e[0m"
echo
echo "To continue have a look at http://appdaemon.readthedocs.io/en/latest/"
echo
validation=$(pgrep -f appdaemon)
if [ "$validation" == NULL ]; then
echo
echo -e "\e[32mUppgrade done..\e[0m"
echo
echo "To continue have a look at http://appdaemon.readthedocs.io/en/latest/"
echo
else
echo -e "\e[31mUpgrade failed..."
echo -e "\e[31mAborting..."
echo -e "\e[0mIf you have issues with this script, please say something in the #devs_hassbian channel on Discord."
return 1
echo -e "\e[31mUpgrade failed..."
echo -e "\e[31mAborting..."
echo -e "\e[0mIf you have issues with this script, please say something in the #devs_hassbian channel on Discord."
return 1
fi
return 0
}
[[ $_ == $0 ]] && echo "hassbian-config helper script; do not run directly, use hassbian-config instead"
[[ "$_" == "$0" ]] && echo "hassbian-config helper script; do not run directly, use hassbian-config instead"
40 changes: 20 additions & 20 deletions package/opt/hassbian/suites/duckdns.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/bin/bash
function duckdns-show-short-info {
echo -e "Setup for Duck DNS auto renewal, and generates SSL certificate."
echo "Setup for Duck DNS auto renewal, and generates SSL certificate."
}

function duckdns-show-long-info {
echo -e "This script adds an cron job to auto uppdate you the WAN IP address for the defined domain."
echo -e "This script could also generate SSL certificate for https with Let’s Encrypt."
echo "This script adds an cron job to auto uppdate you the WAN IP address for the defined domain."
echo "This script can also generate SSL certificate for https with Let’s Encrypt."
}

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

function duckdns-install-package {
Expand All @@ -22,42 +22,42 @@ echo "If no choice is made the installation will exit."
echo
echo "(if your domain is 'example.duckdns.org' type example)"
echo -n "Domain: "
read domain
read -r domain
if [ ! "$domain" ]; then
exit
fi
if [[ $domain = *"duckdns"* ]]; then
domain=$(echo "$domain" | cut -d\. -f1)
fi
if [[ $domain = *"//"* ]]; then
domain=$(echo "$domain" | cut -d\/ -f3)
domain=$(echo "$domain" | cut -d/ -f3)
fi


echo -n "Token: "
read token
read -r token
echo
if [ ! "$token" ]; then
exit
fi
read -p "Do you want to generate certificates to use SSL(https)? [N/y] : " SSL_RESPONSE
read -p -r "Do you want to generate certificates to use SSL(https)? [N/y] : " SSL_RESPONSE

echo "Changing to homeassistant user..."
sudo -u homeassistant -H /bin/bash << EOF
cd

if [ "$SSL_RESPONSE" == "y" ] || [ "$SSL_RESPONSE" == "Y" ]; then
git clone https://github.com/lukas2511/dehydrated.git
cd dehydrated
echo $domain".duckdns.org" | tee domains.txt
echo "CHALLENGETYPE='dns-01'" | tee -a config
echo "HOOK='./hook.sh'" | tee -a config
curl -o ./hook.sh https://raw.githubusercontent.com/home-assistant/hassbian-scripts/dev/package/opt/hassbian/suites/files/ssl_hook.sh
sed -i 's/myhome/'$domain'/g' ./hook.sh
sed -i 's/your-duckdns-token/'$token'/g' ./hook.sh
chmod 755 hook.sh
./dehydrated --register --accept-terms
./dehydrated -c
git clone https://github.com/lukas2511/dehydrated.git
cd dehydrated
echo $domain".duckdns.org" | tee domains.txt
echo "CHALLENGETYPE='dns-01'" | tee -a config
echo "HOOK='./hook.sh'" | tee -a config
curl -o ./hook.sh https://raw.githubusercontent.com/home-assistant/hassbian-scripts/dev/package/opt/hassbian/suites/files/ssl_hook.sh
sed -i 's/myhome/'$domain'/g' ./hook.sh
sed -i 's/your-duckdns-token/'$token'/g' ./hook.sh
chmod 755 hook.sh
./dehydrated --register --accept-terms
./dehydrated -c
fi

echo "Creating duckdns folder..."
Expand Down Expand Up @@ -95,4 +95,4 @@ echo
return 0
}

[[ $_ == $0 ]] && echo "hassbian-config helper script; do not run directly, use hassbian-config instead"
[[ "$_" == "$0" ]] && echo "hassbian-config helper script; do not run directly, use hassbian-config instead"
16 changes: 8 additions & 8 deletions package/opt/hassbian/suites/hassbian-script-dev.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash
function hassbian-script-dev-show-short-info {
echo "Uppdates scripts from the dev branch."
echo "Uppdates scripts from the dev branch."
}

function hassbian-script-dev-show-long-info {
echo "This scripts downloads new scripts directly from the dev branch on github."
echo "you can use this to be on the 'bleeding edge of the development of Hassbian.'"
echo "This is not recomended for daily use."
echo "This scripts downloads new scripts directly from the dev branch on github."
echo "you can use this to be on the 'bleeding edge of the development of Hassbian.'"
echo "This is not recomended for daily use."
}

function hassbian-script-dev-show-copyright-info {
Expand All @@ -18,9 +18,9 @@ hassbian-script-dev-show-short-info
hassbian-script-dev-show-copyright-info

echo "Creation and changing in to temporary folder."
cd
cd || exit
sudo mkdir /tmp/hassbian_config_update
cd /tmp/hassbian_config_update
cd /tmp/hassbian_config_update || exit

echo "Downloading new scripts from github."
curl -L https://api.github.com/repos/home-assistant/hassbian-scripts/tarball| sudo tar xz --strip=1
Expand All @@ -30,7 +30,7 @@ yes | sudo cp -rf /tmp/hassbian_config_update/package/usr/local/bin/hassbian-con
yes | sudo cp -rf /tmp/hassbian_config_update/package/opt/hassbian/suites/* /opt/hassbian/suites/

echo "Removing the temporary folder."
cd
cd || exit
sudo rm -r /tmp/hassbian_config_update

echo
Expand All @@ -41,4 +41,4 @@ echo
return 0
}

[[ $_ == $0 ]] && echo "hassbian-config helper script; do not run directly, use hassbian-config instead"
[[ "$_" == "$0" ]] && echo "hassbian-config helper script; do not run directly, use hassbian-config instead"
10 changes: 5 additions & 5 deletions package/opt/hassbian/suites/hassbian-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ hassbian-script-show-short-info
hassbian-script-show-copyright-info

echo "Changing to temporary folder"
cd /tmp
cd /tmp || exit

echo "Downloading newest release"
curl https://api.github.com/repos/home-assistant/hassbian-scripts/releases/latest | grep "browser_download_url.*deb" | cut -d : -f 2,3 | tr -d \" | wget -qi -

# Setting package name
HASSBIAN_PACKAGE=$(ls | grep 'hassbian*')
HASSBIAN_PACKAGE=$(echo hassbian*.deb)

echo "Installing newest release"
sudo apt install -y /tmp/$HASSBIAN_PACKAGE
sudo apt install -y /tmp/"$HASSBIAN_PACKAGE"

echo "Cleanup"
rm $HASSBIAN_PACKAGE
rm "$HASSBIAN_PACKAGE"

echo
echo "Uppgrade is now done."
Expand All @@ -39,4 +39,4 @@ echo
return 0
}

[[ $_ == $0 ]] && echo "hassbian-config helper script; do not run directly, use hassbian-config instead"
[[ "$_" == "$0" ]] && echo "hassbian-config helper script; do not run directly, use hassbian-config instead"
10 changes: 5 additions & 5 deletions package/opt/hassbian/suites/hassbian.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/bin/bash
function hassbian-show-short-info {
echo "Upgrade the base OS installation on this system"
echo "Upgrade the base OS installation on this system."
}

function hassbian-show-long-info {
echo "Upgrade the base OS installation on this system"
echo "Upgrade the base OS installation on this system."
}

function hassbian-show-copyright-info {
echo "Original concept by Ludeeus <https://github.com/Ludeeus>"
echo "Modyfied by Landrash <https://github.com/Landrash>"
echo "Original concept by Ludeeus <https://github.com/Ludeeus>."
echo "Modyfied by Landrash <https://github.com/Landrash>."
}

function hassbian-upgrade-package {
Expand All @@ -32,4 +32,4 @@ echo
return 0
}

[[ $_ == $0 ]] && echo "hassbian-config helper script; do not run directly, use hassbian-config instead"
[[ "$_" == "$0" ]] && echo "hassbian-config helper script; do not run directly, use hassbian-config instead"
8 changes: 4 additions & 4 deletions package/opt/hassbian/suites/homeassistant-dev.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash
function homeassistant-dev-show-short-info {
echo "Home Assistant developement branch install script for Hassbian"
echo "Home Assistant developement branch install script for Hassbian."
}

function homeassistant-dev-show-long-info {
echo "Installs Home Assistant from the developement branch from github onto this system."
echo "Installs Home Assistant from the developement branch from github onto this system."
}

function homeassistant-dev-show-copyright-info {
echo "Copyright(c) 2017 Fredrik Lindqvist <https://github.com/Landrash>"
echo "Copyright(c) 2017 Fredrik Lindqvist <https://github.com/Landrash>."
}

function homeassistant-dev-install-package {
Expand Down Expand Up @@ -52,4 +52,4 @@ echo
return 0
}

[[ $_ == $0 ]] && echo "hassbian-config helper script; do not run directly, use hassbian-config instead"
[[ "$_" == "$0" ]] && echo "hassbian-config helper script; do not run directly, use hassbian-config instead"
14 changes: 7 additions & 7 deletions package/opt/hassbian/suites/homeassistant.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash
function homeassistant-show-short-info {
echo "Home Assistant install script for Hassbian"
echo "Home Assistant install script for Hassbian."
}

function homeassistant-show-long-info {
echo "Installs the base homeassistant package onto this system."
echo "Installs the base homeassistant package onto this system."
}

function homeassistant-show-copyright-info {
echo "Copyright(c) 2017 Fredrik Lindqvist <https://github.com/Landrash>"
echo "Copyright(c) 2017 Fredrik Lindqvist <https://github.com/Landrash>."
}

function homeassistant-install-package {
Expand Down Expand Up @@ -65,14 +65,14 @@ homeassistant-show-copyright-info
echo "Checking current version"
pypiversion=$(curl -s https://pypi.python.org/pypi/homeassistant/json | grep '"version":' | awk -F'"' '{print $4}')

sudo -u homeassistant -H /bin/bash << EOF | grep Version|awk '{print $2'}|while read version; do if [[ ${pypiversion} == ${version} ]]; then echo "You already have the latest version: $version";exit 1;fi;done
sudo -u homeassistant -H /bin/bash << EOF | grep Version | awk '{print $2}'|while read -r version; do if [[ "${pypiversion}" == "${version}" ]]; then echo "You already have the latest version: $version";exit 1;fi;done
source /srv/homeassistant/bin/activate
pip3 show homeassistant
EOF

if [[ $? == 1 ]]; then
echo "Stopping upgrade"
exit 1
echo "Stopping upgrade"
exit 1
fi

echo "Stopping Home Assistant"
Expand Down Expand Up @@ -105,4 +105,4 @@ echo
return 0
}

[[ $_ == $0 ]] && echo "hassbian-config helper script; do not run directly, use hassbian-config instead"
[[ "$_" == "$0" ]] && echo "hassbian-config helper script; do not run directly, use hassbian-config instead"
Loading