kopia lustrzana https://github.com/jprochazka/adsb-receiver
				
				
				
			Consolidated repeative function CheckPackage.
							rodzic
							
								
									b64f13d8a7
								
							
						
					
					
						commit
						911555cd67
					
				|  | @ -31,9 +31,10 @@ | |||
| #                                                                                   # | ||||
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # | ||||
| 
 | ||||
| BUILDDIR=${PWD} | ||||
| BUILDDIR=$PWD | ||||
| DUMP1090DIR="$BUILDDIR/dump1090" | ||||
| 
 | ||||
| source ../functions.sh | ||||
| source ../bash/functions.sh | ||||
| 
 | ||||
| clear | ||||
| 
 | ||||
|  | @ -68,12 +69,12 @@ CheckPackage lighttpd | |||
| ## DOWNLOAD OR UPDATE THE DUMP1090-MUTABILITY SOURCE | ||||
| 
 | ||||
| # Check if the git repository already exists locally. | ||||
| if [ -d "$BUILDDIR/dump1090" ] && [ -d $BUILDDIR/dump1090/.git ]; then | ||||
| if [ -d $DUMP1090DIR ] && [ -d $DUMP1090DIR/.git ]; then | ||||
|     # A directory with a git repository containing the source code exists. | ||||
|     echo -e "\033[33m" | ||||
|     echo "Updating the local dump1090-mutability git repository..." | ||||
|     echo -e "\033[37m" | ||||
|     cd $BUILDDIR/dump1090 | ||||
|     cd $DUMP1090DIR | ||||
|     git pull origin master | ||||
| else | ||||
|     # A directory containing the source code does not exist in the build directory. | ||||
|  | @ -88,7 +89,7 @@ fi | |||
| echo -e "\033[33m" | ||||
| echo "Building the dump1090-mutability package..." | ||||
| echo -e "\033[37m" | ||||
| cd $BUILDDIR/dump1090 | ||||
| cd $DUMP1090DIR | ||||
| dpkg-buildpackage -b | ||||
| 
 | ||||
| ## INSTALL THE DUMP1090-MUTABILITY PACKAGE | ||||
|  | @ -138,7 +139,7 @@ sudo /etc/init.d/dump1090-mutability start | |||
| # Check if the heywhatsthis.com range position file has already been downloaded. | ||||
| if [ ! -f /usr/share/dump1090-mutability/html/upintheair.json ]; then | ||||
|     echo -e "\033[33m" | ||||
|     echo "Dump1090-mutability is able to display terrain limit rings using data obtained." | ||||
|     echo "Dump1090-mutability is able to display terrain limit rings using data obtained" | ||||
|     echo "from the website http://www.heywhatsthat.com. Some work will be required on your" | ||||
|     echo "part including visiting http://www.heywhatsthat.com and generating a new" | ||||
|     echo "panorama set to your location." | ||||
|  | @ -148,7 +149,6 @@ if [ ! -f /usr/share/dump1090-mutability/html/upintheair.json ]; then | |||
|     if [[ ! $ADDTERRAINRINGS =~ ^[Nn]$ ]]; then  | ||||
|         echo -e "\033[31m" | ||||
|         echo "READ THE FOLLOWING INSTRUCTION CAREFULLY!" | ||||
|         echo "" | ||||
|         echo -e "\033[33m" | ||||
|         echo "To set up terrain limit rings you will need to first generate a panorama on the website" | ||||
|         echo "heywhatsthat.com. To do so visit the following URL:" | ||||
|  |  | |||
|  | @ -43,28 +43,29 @@ function CheckPackage { | |||
| 
 | ||||
|         # If the maximum attempts has been reached... | ||||
|         if [ $ATTEMPT -gt $MAXATTEMPTS ]; then | ||||
|             echo -e "\033[31m" | ||||
|             echo "#########################################" | ||||
|             echo "# INSTALLATION HALTED!                  #" | ||||
|             echo "# UNABLE TO INSTALL A REQUIRED PACKAGE. #" | ||||
|             echo "#########################################" | ||||
|             echo "" | ||||
|             echo -e "\033[33m" | ||||
|             echo "The package \"$1\" could not be installed in $MAXATTEMPTS attempts." | ||||
|             echo "" | ||||
|             echo -e "\033[37m" | ||||
|             exit 1 | ||||
|         fi | ||||
| 
 | ||||
|         # Check if the package is already installed. | ||||
|         printf "Checking if the package $1 is installed..." | ||||
|         printf "\033[33mChecking if the package $1 is installed..." | ||||
|         if [ $(dpkg-query -W -f='${STATUS}' $1 2>/dev/null | grep -c "ok installed") -eq 0 ]; then | ||||
| 
 | ||||
|             # If this is not the first attempt at installing this package... | ||||
|             if [ $ATTEMPT -gt 1 ]; then | ||||
|                 echo -e " [PREVIOUS INSTALLATION FAILED]" | ||||
|                 echo -e "Attempting to Install the package $1 again in $WAITTIME seconds (ATTEMPT $ATTEMPT OF $MAXATTEMPTS)..." | ||||
|                 echo -e "\033[31m [PREVIOUS INSTALLATION FAILED]" | ||||
|                 echo -e "\033[33mAttempting to Install the package $1 again in $WAITTIME seconds (ATTEMPT $ATTEMPT OF $MAXATTEMPTS)..." | ||||
|                 sleep $WAITTIME | ||||
|             else | ||||
|                 echo -e " [NOT INSTALLED]" | ||||
|                 echo -e "Installing the package $1..." | ||||
|                 echo -e "\033[31m [NOT INSTALLED]" | ||||
|                 echo -e "\033[33mInstalling the package $1..." | ||||
|             fi | ||||
| 
 | ||||
|             # Attempt to install the required package. | ||||
|  | @ -74,7 +75,7 @@ function CheckPackage { | |||
|             echo "" | ||||
|         else | ||||
|             # The package appears to be installed. | ||||
|             echo -e " [OK]" | ||||
|             echo -e "\033[32m [OK]\033[37m" | ||||
|             break | ||||
|         fi | ||||
|     done | ||||
|  |  | |||
							
								
								
									
										33
									
								
								install.sh
								
								
								
								
							
							
						
						
									
										33
									
								
								install.sh
								
								
								
								
							|  | @ -41,10 +41,11 @@ PIAWAREVERSION="2.1-5-jessie" | |||
| PFCLIENTI386VERSION="3.1.201" | ||||
| PFCLIENTARMVERSION="3.0.2080" | ||||
| 
 | ||||
| SCRIPTDIR=${PWD} | ||||
| BUILDDIR="$SCRIPTDIR/build" | ||||
| BASEDIR=${PWD} | ||||
| BASHDIR="$BASEDIR/bash" | ||||
| BUILDDIR="$BASEDIR/build" | ||||
| 
 | ||||
| source ./bash/functions.sh | ||||
| source $BASHDIR/functions.sh | ||||
| 
 | ||||
| # Download the latest package lists for enabled repositories and PPAs. | ||||
| function AptUpdate() { | ||||
|  | @ -93,9 +94,9 @@ function InstallDump1090() { | |||
|     cd $BUILDDIR | ||||
|     echo -e "\033[33mExecuting the dump1090-mutability installation script..." | ||||
|     echo -e "\033[37m" | ||||
|     chmod +x $SCRIPTDIR/bash/decoders/dump1090-mutability.sh | ||||
|     $SCRIPTDIR/bash/decoders/dump1090-mutability.sh | ||||
|     cd $SCRIPTDIR | ||||
|     chmod +x $BASHDIR/decoders/dump1090-mutability.sh | ||||
|     $BASHDIR/decoders/dump1090-mutability.sh | ||||
|     cd $BASEDIR | ||||
| } | ||||
| 
 | ||||
| # Download, build and then install the PiAware package. | ||||
|  | @ -104,9 +105,9 @@ function InstallPiAware() { | |||
|     cd $BUILDDIR | ||||
|     echo -e "\033[33mExecuting the PiAware installation script..." | ||||
|     echo -e "\033[37m" | ||||
|     chmod +x $SCRIPTDIR/bash/feeders/piaware.sh | ||||
|     $SCRIPTDIR/bash/feeders/piaware.sh | ||||
|     cd $SCRIPTDIR | ||||
|     chmod +x $BASHDIR/feeders/piaware.sh | ||||
|     $BASHDIR/feeders/piaware.sh | ||||
|     cd $BASEDIR | ||||
| } | ||||
| 
 | ||||
| # Download and install the Plane Finder ADS-B Client package. | ||||
|  | @ -115,9 +116,9 @@ function InstallPlaneFinder() { | |||
|     cd $BUILDDIR | ||||
|     echo -e "\033[33mExecuting the Plane Finder ADS-B Client installation script..." | ||||
|     echo -e "\033[37m" | ||||
|     chmod +x $SCRIPTDIR/bash/feeders/planefinder.sh | ||||
|     $SCRIPTDIR/bash/feeders/planefinder.sh | ||||
|     cd $SCRIPTDIR | ||||
|     chmod +x $BASHDIR/feeders/planefinder.sh | ||||
|     $BASHDIR/feeders/planefinder.sh | ||||
|     cd $BASEDIR | ||||
| } | ||||
| 
 | ||||
| # Setup the ADS-B Exchange feed. | ||||
|  | @ -134,12 +135,12 @@ function InstallAdsbExchange() { | |||
| # Setup and execute the web portal installation scripts. | ||||
| function InstallWebPortal() { | ||||
|     clear | ||||
|     cd $SCRIPTDIR | ||||
|     cd $BUILDDIR | ||||
|     echo -e "\033[33mExecuting the web portal installation scripts..." | ||||
|     echo -e "\033[37m" | ||||
|     chmod +x $SCRIPTDIR/bash/portal/install.sh | ||||
|     $SCRIPTDIR/bash/portal/install.sh | ||||
|     cd $SCRIPTDIR | ||||
|     chmod +x $BASHDIR/portal/install.sh | ||||
|     $BASHDIR/portal/install.sh | ||||
|     cd $BASEDIR | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 Joe Prochazka
						Joe Prochazka