You've already forked freetube-appimage
							
							added push script
This commit is contained in:
		
							
								
								
									
										74
									
								
								push.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										74
									
								
								push.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,74 @@ | ||||
| #!/usr/bin/env bash | ||||
| set -e | ||||
|  | ||||
| # Temp file and PKGBUILD information | ||||
| TMPFILE=$(mktemp) | ||||
| grep -E "pkgname=|pkgver=|pkgrel=|url=|arch=" PKGBUILD > ${TMPFILE} | ||||
| sed -n -e '/source/,/)/ p' PKGBUILD >> ${TMPFILE} | ||||
| source ${TMPFILE} | ||||
| aur_url="ssh://aur@aur.archlinux.org/${pkgname}.git" | ||||
|  | ||||
| # Get new version | ||||
| if [ $# -eq 1 ]; then | ||||
|   newver="${1}" | ||||
| else | ||||
|   echo "Old version: ${pkgver}" | ||||
|   read -p "New version: " newver | ||||
| fi | ||||
| # Check version | ||||
| if [ "${newver}" = "${pkgver}" ]; then | ||||
|   echo >/dev/stderr "Error: same (old) version specified - update aborted" | ||||
|   exit 1 | ||||
| fi | ||||
|  | ||||
| # Perform variable substitution | ||||
| sed -i -E "s/^pkgver=\"[^\"]+\"/pkgver=\"$newver\"/" ${TMPFILE} | ||||
| source ${TMPFILE} | ||||
|  | ||||
| sednewline="n;" | ||||
| # Iterate over architectures | ||||
| for architecture in "${arch[@]}"; do | ||||
|   sednumlines="" | ||||
|   # Iterate over files listed in $source variable | ||||
|   eval "sources=(\${source_$architecture[@]})" | ||||
|   for file_url in "${sources[@]}"; do | ||||
|     # Remove potential file renaming in source file | ||||
|     file_url=$(echo ${file_url} | sed 's/.*:://') | ||||
|     # Perform action only on web links | ||||
|     if [[ $file_url == http* ]]; then | ||||
|       # Extract everything after last "/" | ||||
|       filename="${file_url##*/}" | ||||
|       # Download new file | ||||
|       wget -O ${filename} "${file_url}" | ||||
|  | ||||
|       # Calculate checksums | ||||
|       sha1sum=$(sha1sum ${filename} | awk '{print $1}') | ||||
|       sha256sum=$(sha256sum ${filename} | awk '{print $1}') | ||||
|       md5sum=$(md5sum ${filename} | awk '{print $1}') | ||||
|  | ||||
|       # Update PKGBUILD with new values | ||||
|       sednumlines="${sednumlines}${sednewline}" | ||||
|       sed -i "/sha1sums_${architecture}/{${sednumlines}s/\".*\"/\"${sha1sum}\"/}" PKGBUILD | ||||
|       sed -i "/sha256sums_${architecture}/{${sednumlines}s/\".*\"/\"${sha256sum}\"/}" PKGBUILD | ||||
|       sed -i "/md5sums_${architecture}/{${sednumlines}s/\".*\"/\"${md5sum}\"/}" PKGBUILD | ||||
|       # Yoink source - not necessary anymore | ||||
|       rm -f ${filename} | ||||
|     fi | ||||
|   done # Files loop | ||||
| done # Architectures loop | ||||
|  | ||||
| # Update the last PKGBUILD value, the version | ||||
| sed -i -E "s/^pkgver=\"[^\"]+\"/pkgver=\"$newver\"/" PKGBUILD | ||||
|  | ||||
| # Yoink temp file | ||||
| rm -f ${TMPFILE} | ||||
|  | ||||
| # Update .SRCINFO | ||||
| makepkg --printsrcinfo > .SRCINFO | ||||
|  | ||||
| # In case of fire, git commit, git push, leave building | ||||
| git add PKGBUILD .SRCINFO | ||||
| git commit -m "Updated ${pkgname} to ${pkgver}-${pkgrel}" | ||||
| git remote add aur ${aur_url} | ||||
| git push origin main | ||||
| git push aur main:master | ||||
		Reference in New Issue
	
	Block a user