Add fetch-package script
This commit is contained in:
		
							
								
								
									
										32
									
								
								fs-add/sbin/fetch-package
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										32
									
								
								fs-add/sbin/fetch-package
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,32 @@
 | 
				
			|||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FILE="$1"
 | 
				
			||||||
 | 
					ODIR="/mnt/data/satip-axe/packages"
 | 
				
			||||||
 | 
					OFILE="$ODIR/$FILE"
 | 
				
			||||||
 | 
					GITHUB1="https://github.com/perexg/satip-axe/tree/master/dist/packages"
 | 
				
			||||||
 | 
					GITHUB2="https://github.com/perexg/satip-axe/blob/master/dist/packages/$FILE?raw=true"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if test "$FILE" = "-h" -o "$FILE" = "--help"; then
 | 
				
			||||||
 | 
					  echo "Usage: $0 PACKAGE"
 | 
				
			||||||
 | 
					  exit 1
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if test -z "$FILE"; then
 | 
				
			||||||
 | 
					  echo "Trying to fetch the list of available package files:"
 | 
				
			||||||
 | 
					  if ! wget -q -O /root/list.txt "$GITHUB1"; then
 | 
				
			||||||
 | 
					    echo "FAILED"
 | 
				
			||||||
 | 
					    exit 1
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					  grep -o -E "tar.gz\">.*.tar.gz<" /root/list.txt | grep -o -E ">.*" | grep -o -E "[a-zA-Z].*.tar.gz"
 | 
				
			||||||
 | 
					  rm /root/list.txt
 | 
				
			||||||
 | 
					  exit 0
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "Downloading $FILE:"
 | 
				
			||||||
 | 
					if ! wget -O "$OFILE" "$GITHUB2/$FILE"; then
 | 
				
			||||||
 | 
					  echo "Unable to fetch package file $PACKAGE"
 | 
				
			||||||
 | 
					  exit 1
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					echo "Download complete! Check for package duplicates in $ODIR!"
 | 
				
			||||||
 | 
					cd $ODIR
 | 
				
			||||||
 | 
					ls -la *.tar.*
 | 
				
			||||||
@@ -7,6 +7,11 @@ CHECKSTR="Linux-2.6.32.42_stm24_0208-idl4k"
 | 
				
			|||||||
GITHUB1="https://github.com/perexg/satip-axe/tree/master/dist"
 | 
					GITHUB1="https://github.com/perexg/satip-axe/tree/master/dist"
 | 
				
			||||||
GITHUB2="https://github.com/perexg/satip-axe/blob/master/dist/$FILE?raw=true"
 | 
					GITHUB2="https://github.com/perexg/satip-axe/blob/master/dist/$FILE?raw=true"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if test "$PWD" != "/root" -a "$PWD" != "/"; then
 | 
				
			||||||
 | 
					  echo "Run this utility from / or /root directory"
 | 
				
			||||||
 | 
					  exit 1
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if test "$FILE" = "-h" -o "$FILE" = "--help"; then
 | 
					if test "$FILE" = "-h" -o "$FILE" = "--help"; then
 | 
				
			||||||
  echo "Usage: $0 FIRMWARE"
 | 
					  echo "Usage: $0 FIRMWARE"
 | 
				
			||||||
  exit 1
 | 
					  exit 1
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user