-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make packaging to installer file working again
- Loading branch information
Showing
3 changed files
with
183 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/bin/bash | ||
|
||
echo "Starting WLANThermo installation" | ||
echo "----------------------------------------------------------" | ||
|
||
if [ `whoami` != root ]; then | ||
echo "Please run this script as root or using sudo!" | ||
exit | ||
fi | ||
|
||
grep 'VERSION_ID="8"' /etc/os-release &> /dev/null | ||
if [ $? -ne 0 ]; then | ||
echo "This installer need Raspbian Jessie!" | ||
exit | ||
fi | ||
|
||
if [ "$1" == "--image-mode" ]; then | ||
IMAGE_MODE=TRUE | ||
else | ||
IMAGE_MODE=FALSE | ||
fi | ||
|
||
# | ||
# Stop processes to speed up installation | ||
# | ||
if [ "$IMAGE_MODE" == "FALSE" ]; then | ||
echo "Stopping WLANThermo processes" | ||
echo "----------------------------------------------------------" | ||
systemctl stop WLANThermo.service | ||
systemctl stop pigpiod.service | ||
if [ -f /var/run/wlt_2_nextion.pid ]; then | ||
kill $(cat /var/run/wlt_2_nextion.pid) | ||
fi | ||
pkill gnuplot | ||
fi | ||
|
||
lines=`grep --max-count 1 --line-regexp --line-number --text '# ---- END OF SCRIPT - DON´T CHANGE THIS LINE ----' $0 | cut -d: -f 1` | ||
startline=$((lines + 1)) | ||
|
||
|
||
if command -v systemctl > /dev/null && systemctl | grep -q '\-\.mount'; then | ||
SYSTEMD=1 | ||
elif [ -f /etc/init.d/cron ] && [ ! -h /etc/init.d/cron ]; then | ||
SYSTEMD=0 | ||
else | ||
echo "Unrecognised init system" | ||
return 1 | ||
fi | ||
|
||
echo "Adding Repository to apt" | ||
echo "----------------------------------------------------------" | ||
|
||
apt-get update | ||
apt-get -y install apt-transport-https | ||
wget -nc https://packages.wlanthermo.net/wlanthermo-dev.list -O /etc/apt/sources.list.d/wlanthermo.list | ||
|
||
echo "Adding GPG key to apt" | ||
echo "----------------------------------------------------------" | ||
|
||
wget -O - https://packages.wlanthermo.net/wlanthermo.gpg.key | sudo apt-key add - | ||
|
||
echo "Updating system" | ||
echo "----------------------------------------------------------" | ||
|
||
apt-get update | ||
apt-get dist-upgrade -y | ||
|
||
echo "Now installing wlanthermo package" | ||
echo "----------------------------------------------------------" | ||
|
||
apt-get install wlanthermo | ||
|
||
url=$(cat /etc/hostname) | ||
echo " " | ||
echo "====================================================================================================" | ||
echo "========*********************************************************************************===========" | ||
echo "========*********** WLANThermo installed completely! Please reboot now! ***********===========" | ||
echo "========*********** Open http://$url in a browser afterwards! ***********===========" | ||
echo "========*********************************************************************************===========" | ||
echo "====================================================================================================" | ||
echo " " | ||
|
||
exit 0 | ||
# ---- END OF SCRIPT - DON´T CHANGE THIS LINE ---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/bin/bash | ||
|
||
echo "Starting WLANThermo installation" | ||
echo "----------------------------------------------------------" | ||
|
||
if [ `whoami` != root ]; then | ||
echo "Please run this script as root or using sudo!" | ||
exit | ||
fi | ||
|
||
grep 'VERSION_ID="8"' /etc/os-release &> /dev/null | ||
if [ $? -ne 0 ]; then | ||
echo "This installer need Raspbian Jessie!" | ||
exit | ||
fi | ||
|
||
if [ "$1" == "--image-mode" ]; then | ||
IMAGE_MODE=TRUE | ||
else | ||
IMAGE_MODE=FALSE | ||
fi | ||
|
||
# | ||
# Stop processes to speed up installation | ||
# | ||
if [ "$IMAGE_MODE" == "FALSE" ]; then | ||
echo "Stopping WLANThermo processes" | ||
echo "----------------------------------------------------------" | ||
systemctl stop WLANThermo.service | ||
systemctl stop pigpiod.service | ||
if [ -f /var/run/wlt_2_nextion.pid ]; then | ||
kill $(cat /var/run/wlt_2_nextion.pid) | ||
fi | ||
pkill gnuplot | ||
fi | ||
|
||
lines=`grep --max-count 1 --line-regexp --line-number --text '# ---- END OF SCRIPT - DON´T CHANGE THIS LINE ----' $0 | cut -d: -f 1` | ||
startline=$((lines + 1)) | ||
|
||
|
||
if command -v systemctl > /dev/null && systemctl | grep -q '\-\.mount'; then | ||
SYSTEMD=1 | ||
elif [ -f /etc/init.d/cron ] && [ ! -h /etc/init.d/cron ]; then | ||
SYSTEMD=0 | ||
else | ||
echo "Unrecognised init system" | ||
return 1 | ||
fi | ||
|
||
echo "Adding Repository to apt" | ||
echo "----------------------------------------------------------" | ||
|
||
if [ -f /etc/apt/sources.list/wlanthermo.list ]; then | ||
IN_APT=0 | ||
else | ||
wget https://packages.wlanthermo.net/wlanthermo.list -O /etc/apt/sources.list/wlanthermo.list | ||
fi | ||
|
||
echo "Adding GPG key to apt" | ||
echo "----------------------------------------------------------" | ||
|
||
wget -O - https://packages.wlanthermo.net/wlanthermo.gpg.key | sudo apt-key add - | ||
|
||
echo "Updating system" | ||
echo "----------------------------------------------------------" | ||
|
||
apt-get update | ||
apt-get upgrade -y | ||
|
||
echo "Now installing wlanthermo package" | ||
echo "----------------------------------------------------------" | ||
|
||
apt-get install wlanthermo | ||
|
||
url=$(cat /etc/hostname) | ||
echo " " | ||
echo "====================================================================================================" | ||
echo "========*********************************************************************************===========" | ||
echo "========*********** WLANThermo installed completely! Please reboot now! ***********===========" | ||
echo "========*********** Open http://$url in a browser afterwards! ***********===========" | ||
echo "========*********************************************************************************===========" | ||
echo "====================================================================================================" | ||
echo " " | ||
|
||
exit 0 | ||
# ---- END OF SCRIPT - DON´T CHANGE THIS LINE ---- |