#!/bin/bash #stage1 Colour codes RED=31 GREEN=32 YELLOW=33 LIGHT_GREEN=92 LIGHT_YELLOW=93 DISTRO_VARIANT=$( lsb_release -si) if [ "$EUID" != 0 ]; then cat >&2 </dev/null 2>&1; then notify "Installing wget" $LIGHT_GREEN $YELLOW 2 sudo apt-get install -y -q wget fi if ! which python3 >/dev/null 2>&1; then notify "Installing python3" $LIGHT_GREEN $YELLOW 2 sudo apt-get install -y -q python3 fi if ! which lsb_release >/dev/null 2>&1; then sudo apt-get install -y -q lsb-release fi if [ "$DISTRO_VARIANT" = "Ubuntu" ] && ! which apt-add-repository >/dev/null 2>&1; then sudo apt-get install -y -q software-properties-common fi } setup-indi-ppa() { case "$DISTRO_VARIANT" in Raspbian) notify "Adding INDI repository" wget -O - https://www.astroberry.io/repo/key | apt-key add - echo 'deb https://www.astroberry.io/repo/ buster main' > /etc/apt/sources.list.d/astroberry.list apt-get update notify "Installing INDI packages" apt-get install -y indi-full gsc ;; Ubuntu) notify "Adding INDI stable PPA" add-apt-repository -y ppa:mutlaqja/ppa apt update notify "Installing INDI full" apt-get install -y -q indi-full ;; *) echo "Your distribution $DISTRO_VARIANT is not yet supported for automatic setup. You can still install AstroPhoto Plus manually" exit 1 ;; esac } setup-phd2() { if ask-yn echo -n "Do you want to setup VNC server and PHD2 Autoguider? [y/n] "; then if [ "$DISTRO_VARIANT" == 'Ubuntu' ]; then notify "Adding PHD2 PPA" add-apt-repository -y ppa:pch/phd2 apt update fi apt-get install -y -q phd2 tigervnc-standalone-server fi } get-astrophotoplus-edge() { if [ -n "$ASTROPHOTOPLUS_RELEASE_DOWNLOAD_OPTS" ]; then wget -nc $ASTROPHOTOPLUS_RELEASE_DOWNLOAD_OPTS else notify "Downloading latest AstroPhoto-Plus release" wget -nc "https://astrophotoplus.gulinux.net/releases" -O info.json python3 </etc/sudoers.d/${target_user}_nopasswd chmod 644 /etc/sudoers.d/${target_user}_nopasswd fi } cleanup() { cd "$prevdir" rm -rf "$workdir" } setup-sudo install-prerequisites setup-indi-ppa setup-phd2 get-astrophotoplus-edge install-astrophotoplus cleanup notify "Automatic setup of AstroPhoto Plus finished. You should now be able to run the app at the address http://localhost (or in your local network, at http://$(hostname).local)"