Skip to content

Commit

Permalink
Make packaging to installer file working again
Browse files Browse the repository at this point in the history
  • Loading branch information
BjoernSch committed Aug 17, 2017
1 parent d84becd commit ed79098
Show file tree
Hide file tree
Showing 3 changed files with 183 additions and 17 deletions.
30 changes: 13 additions & 17 deletions build/installer/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ 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
Expand All @@ -47,31 +46,28 @@ else
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
program=wlanthermo

echo "Adding GPG key to apt"
echo "Updating System:"
echo "----------------------------------------------------------"
apt-get update
apt-get -y dist-upgrade
apt-get -y install raspberrypi-sys-mods

wget -O - https://packages.wlanthermo.net/wlanthermo.gpg.key | sudo apt-key add -
echo "Extract the package"
echo "----------------------------------------------------------"
tail -n +$startline $0 > /tmp/${program}.deb
ls -l /tmp/${program}.deb

echo "Updating system"
echo "Install depencies:"
echo "----------------------------------------------------------"
aptitude --safe-resolver -y install $(dpkg -I /tmp/${program}.deb | grep 'Depends:' | sed -e 's/,//g' -e 's/ *Depends: *//')

apt-get update
apt-get upgrade -y
echo "Install /tmp/${program}.deb"

echo "Now installing wlanthermo package"
dpkg -i /tmp/${program}.deb
echo "----------------------------------------------------------"

apt-get install wlanthermo

url=$(cat /etc/hostname)
echo " "
echo "===================================================================================================="
Expand Down
84 changes: 84 additions & 0 deletions ressources/dev_installer.sh
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 ----
86 changes: 86 additions & 0 deletions ressources/installer.sh
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 ----

0 comments on commit ed79098

Please sign in to comment.