Unverified Commit d9fb9a25 authored by Igor Pečovnik's avatar Igor Pečovnik Committed by GitHub
Browse files

AR-50: Optimise Docker installation (#74)

* AR-50: Optimise Docker installation by downloading only selected arhitecture

* AR-50: Optimising Hass.io installer

* Further cleaning
parent 9c4bf842
......@@ -51,6 +51,8 @@
# install_ISPConfig
#
# load functions, local first
#
......@@ -81,14 +83,6 @@ fi
#
# not sure if needed
#
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[[ -z $LC_ALL ]] && export LC_ALL="C"
function check_status
{
#
......@@ -333,26 +327,38 @@ echo ""
}
alive_port ()
{
#
# Displays URL to the service $1 on port $2 or just that is active if $3 = boolean $4 = path
#
if [[ -n $(netstat -lnt | awk '$6 == "LISTEN" && $4 ~ ".'$2'"') ]]; then
if [[ $3 == boolean ]]; then
DESCRIPTION="$1 is \Z1active\Z0";
elif [[ $3 == ssl ]]; then
elif [[ $3 == ssl ]]; then
DESCRIPTION="Active on https://${serverIP}:\Z1$2\Z0$4";
else
DESCRIPTION="Active on http://${serverIP}:\Z1$2\Z0$4";
fi
else
DESCRIPTION="$1";
DESCRIPTION="$1";
fi
}
alive_process ()
{
#
......@@ -364,9 +370,6 @@ if pgrep -x "$2" > /dev/null 2>&1; then DESCRIPTION="$1 is \Z1active\Z0"; else D
install_basic (){
#
# Set hostname, FQDN, add to sources list
......@@ -782,7 +785,8 @@ fi
install_docker ()
{
echo "deb https://download.docker.com/linux/${family,,} $distribution edge" > /etc/apt/sources.list.d/docker.list
echo "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/${family,,} $distribution edge" >\
/etc/apt/sources.list.d/docker.list
curl -fsSL "https://download.docker.com/linux/${family,,}/gpg" | apt-key add -qq - > /dev/null 2>&1
debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get install -y -qq --no-install-recommends docker-ce
......@@ -892,25 +896,36 @@ chmod +x /etc/cron.daily/seed-armbian-torrent
install_hassio ()
{
#
# Install Home assistant smart home suite hass.io
# Install Home assistant smart home suite hass.io / Docker instance by using official installer
#
LIST=("intel-nuc" "Intel NUC" "odroid-c2" "Hardkernel Odroid C2" "odroid-xu" "Hardkernel Odroid XU4" "orangepi-prime" "Allwinner H5 boards" "qemuarm" "Virtualized ARM" "qemuarm-64" "Virtualized ARM64" "qemux86" "Virtualized x86" "qemux86-64" "Virtualied x64" "raspberrypi" "1st generation" "raspberrypi2" "2nd generation" "raspberrypi3" "3rd generation" "raspberrypi3-64" "3rd generation arm64 userland" "tinker" "Tinkerboard")
LIST_LENGTH=$((${#LIST[@]}/2));
exec 3>&1
#TARGET_BOARD=$(dialog --menu "Choose machine type:" 0 0 0 "${LIST[@]}")
TARGET_BOARD=$(dialog --cancel-label "Cancel" --backtitle "$BACKTITLE" --no-collapse --title "Choose machine type:" --clear --menu "" $((6+${LIST_LENGTH})) 52 25 "${LIST[@]}" 2>&1 1>&3)
exitstatus=$?;
exec 3>&-
if [ $exitstatus = 0 ]; then
local arch=$(dpkg --print-architecture)
case $arch in
armhf)
local machine=raspberrypi2
;;
arm64)
local machine=raspberrypi4-64
;;
amd64)
local machine=intel-nuc
;;
*)
exit 1
;;
esac
if [ $? == 0 ]; then
install_docker
debconf-apt-progress -- apt-get install -y apparmor-utils apt-transport-https avahi-daemon ca-certificates curl dbus jq network-manager socat software-properties-common
local arch=$(dpkg --print-architecture)
[[ "$arch" == "arm64" ]] && arch="aarch64"
docker pull homeassistant/${arch}-homeassistant
curl -sL "https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh" > ${TEMP_DIR}/hass.io.bash
bash ${TEMP_DIR}/hass.io.bash -m ${TARGET_BOARD}
dialog --backtitle "$BACKTITLE" --title "Please wait" --msgbox "\nIt can take several minutes before Home Assistant UI becomes available! " 7 75
debconf-apt-progress -- apt-get install -y apparmor-utils apt-transport-https avahi-daemon ca-certificates \
dbus jq network-manager socat software-properties-common
curl -sL "https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh" | \
bash -s -- -m ${machine}
dialog --backtitle "$BACKTITLE" --title "Please wait" \
--msgbox "\nIt can take several minutes before Home Assistant UI becomes available! " 7 75
fi
}
......@@ -922,12 +937,15 @@ install_openhab ()
#
# Install Openhab2 smart home suite openhab.org
#
wget -qO - 'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | apt-key add - >/dev/null 2>&1
echo 'deb https://dl.bintray.com/openhab/apt-repo2 stable main' | tee /etc/apt/sources.list.d/openhab2.list >/dev/null 2>&1
debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get install -y openhab2 openhab2-addons default-jre
service openhab2 start
dialog --backtitle "$BACKTITLE" --title "Please wait" --msgbox "\nIt can take several minutes before OpenHAB UI becomes available! " 7 68
dialog --backtitle "$BACKTITLE" --title "Please wait" --msgbox \
"\nIt can take several minutes before OpenHAB UI becomes available! " 7 68
}
......@@ -982,6 +1000,9 @@ install_plex_media_server ()
debconf-apt-progress -- apt-get -y install plexmediaserver
}
install_emby_server ()
{
#
......@@ -995,6 +1016,8 @@ install_emby_server ()
}
install_radarr ()
{
#
......@@ -1622,9 +1645,9 @@ service fail2ban restart >> /dev/null
install_ISPConfig (){
#------------------------------------------------------------------------------------------------------------------------------------------
#
# Install ISPConfig 3
#------------------------------------------------------------------------------------------------------------------------------------------
#
cd ${TEMP_DIR}
wget -q https://www.ispconfig.org/downloads/ISPConfig-3-stable.tar.gz -O - | tar -xz
cd ${TEMP_DIR}/ispconfig3_install/install/
......@@ -1642,9 +1665,9 @@ fi
#------------------------------------------------------------------------------------------------------------------------------------------
#
# Main choices
#------------------------------------------------------------------------------------------------------------------------------------------
#
# check for root
#
......@@ -1826,10 +1849,10 @@ if ! is_package_manager_running; then
selection=${selection//\"Pi hole\"/}
fi
if [[ "$selection" == *Docker* && "$DOCKER_STATUS" != "on" ]]; then
install_docker
selection=${selection//Docker/}
fi
if [[ "$selection" == *Docker* && "$DOCKER_STATUS" != "on" ]]; then
install_docker
selection=${selection//Docker/}
fi
if [[ "$selection" == *Transmission* && "$TRANSMISSION_STATUS" != "on" ]]; then
install_transmission
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment