Benutzer-Werkzeuge

Webseiten-Werkzeuge


scripting:bash:upcheck

upcheck.sh

Summary

This script can be used to check your repository against AUR for updates.
I'm using it with Archup to periodically check my repository.

Main

Warranty

Warranty

There is no warranty that this setup works for any system which provide the dependencies listed below.
I'm just providing these information because it worked for me.
If you have questions you can leave a message here but I decide whether I'll answer and help or not.

Security - Connection

Security issue

If you use the described setup you'll copy files using an unencrypted connection.
That is why it is possible to sniff data about you, your systems and your infrastructure.
You should only use it within a secure network and only if you trust everybody who is using it.

Dependencies:

  • an Arch Linux ;)
  • core/pacman
  • core/bash
  • andrwe/slurpy (or AUR)

Version History:

0.3:

  • added blacklist functionality
  • skip packages without a version on AUR

0.2.5:

  • fixed alphanumerical versions doesn't cause script errors
  • added support for a list of repositories

0.2:

  • doesn't show packages with newer version in repo than in AUR (only numerical like 0.4-2)
  • fixed returning more than one version number for one package

0.1:

  • checks defined repository against AUR using slurpy for updates
  • skip Version Control System based packages
  • prints a list of out-of-date packages

Script

upcheck.sh
#!/bin/bash
 
######################################################################
#
#                  Author: Andrwe Lord Weber
#                  Mail: lord-weber-andrwe<at>renona-studios<dot>org
#                  Version: 0.3
#
######################################################################
 
######################################################################
#
#                  script variables and functions
#
######################################################################
 
# Set name of the repository
REPONAME="andrwe seiichiro"
# Set packages which should be skipped
# e.g.: foo-.* => skip all starting with foo-
#       foobar => skip package foobar
#       .*bar  => skip packages ending with bar
BLACKLIST="vdr-.* .*zjs"
 
######################################################################
#
#                  No changes needed after this line.
#
######################################################################
 
for repo in ${REPONAME}
do
	pacman -Sl ${repo} > /tmp/upcheck.pac.$$
	pacname=`cat /tmp/upcheck.pac.$$ | awk -F ' ' '{print $2}'`
	slurpy -s ${pacname} | sed '/^aur.*/!d' > /tmp/upcheck.slu.$$
 
	echo Repository: ${repo}
 
	for pn in ${pacname}
	do
		blacked=0
		for black in ${BLACKLIST}
		do
			[ ${blacked} -eq 1 ] && continue
			[ "`echo ${pn} | sed "s#${black}##"`" == "" ] && blacked=1
		done
		[ ${blacked} -eq 1 ] && continue
		vcs=0
		if [[ ${pn} =~ .*-(git|svn|cvs|hg) ]]
		then
			vcs=1
		fi
		if [ ${vcs} -eq 0 ]
		then
			pacver=`grep -F "${repo} ${pn} " /tmp/upcheck.pac.$$ | awk -F ' ' '{print $3}'`
			sluver=`grep -F "aur/${pn} " /tmp/upcheck.slu.$$ | awk -F ' ' '{print $2}'`
			[ "${sluver}" == "" ] && continue
			pacver_num=`echo ${pacver} | sed 's#\.##g;s#-##g'`
			sluver_num=`echo ${sluver} | sed 's#\.##g;s#-##g'`
			[[ ${pacver_num} =~ ^[0-9]+$ ]] && [[ ${sluver_num} =~ ^[0-9]+$ ]] && [ ${pacver_num} -lt ${sluver_num} ] && echo ${pn} ${sluver} cur: ${pacver} && continue
			[[ ${pacver_num} =~ ^[0-9]+$ ]] && [[ ${sluver_num} =~ ^[0-9]+$ ]] && continue
			[ "${pacver}" != "${sluver}" ] && echo ${pn} ${sluver} cur: ${pacver}
		fi
	done
 
	rm /tmp/upcheck.pac.$$
	rm /tmp/upcheck.slu.$$
done

Comments



O H F A A
scripting/bash/upcheck.txt · Zuletzt geändert: 2012/08/30 12:13 von Andrwe Lord Weber