Magellan Linux

Diff of /branches/mage-next/src/up2date/up2date.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2590 by niro, Tue Feb 4 12:05:43 2014 UTC revision 2591 by niro, Tue Mar 4 08:35:27 2014 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2    
3  source /usr/lib/mage/mage4.functions.sh  die() { echo "Error: $@"; exit 1; }
4  source /usr/lib/mage/smage2.functions.sh  
5    # include all needed files
6    [ -f /etc/mage.rc.global ] && source /etc/mage.rc.global || die "/etc/mage.rc.global missing"
7    [ -f ${MAGERC} ] && source ${MAGERC} || die "Your ${MAGERC} is missing. Aborting."
8    [ -f ${MLIBDIR}/mage4.functions.sh ] && source ${MLIBDIR}/mage4.functions.sh || die "mage functions missing"
9    [ -f ${MLIBDIR}/smage2.functions.sh ] && source ${MLIBDIR}/smage2.functions.sh || die "smage functions missing"
10    [ -f /etc/up2date.conf ] && source /etc/up2date.conf || die "/etc/up2date.conf missing"
11    
12  # timeout in seconds  # respect repos from env or load repos from config file
13  LYNX_CONNECT_TIMEOUT=10  if [[ -z ${REPOS} ]] && [[ -n ${SMAGE_REPOS} ]]
14  LYNX_READ_TIMEOUT=10  then
15     REPOS="${SMAGE_REPOS}"
16    fi
17    # sane default
18    : ${REPOS="${SMAGESCRIPTSDIR}/core ${SMAGESCRIPTSDIR}/extras ${SMAGESCRIPTSDIR}/nonfree ${SMAGESCRIPTSDIR}/todo"}
19    
20  ## only for tests -> normally in /etc/rc.d/init.d/functions  ## only for tests -> normally in /etc/rc.d/init.d/functions
21  COLRED="\033[1;6m\033[31m"  COLRED="\033[1;6m\033[31m"
# Line 31  then Line 41  then
41   COLDEFAULT=""   COLDEFAULT=""
42  fi  fi
43    
44  die() { echo "Error: $@"; exit 1; }  # always be silent
45    SILENT=1
46  sminclude() { true; }  FVERBOSE=off
47  msetfeature() { true; }  
48  mqueryfeature() { true; }  # load all up2date includes
49  haskell_enable_feature() { true; }  for inc in ${MLIBDIR}/up2date/*.sh
50  haskell_disable_feature() { true; }  do
51     source ${inc}
52  urlencode()  done
 {  
  local uri="$@"  
   
  # fix percent (do this first!!)  
  uri=$(echo ${uri} | sed 's:%:%25:g')  
   
  # fix spaces  
  uri=$(echo ${uri} | sed 's:\ :%20:g')  
   
  # fix less than  
  uri=$(echo ${uri} | sed 's:<:%3C:g')  
   
  # fix greater than  
  uri=$(echo ${uri} | sed 's:>:%3E:g')  
   
  # fix pound  
  uri=$(echo ${uri} | sed 's:#:%23:g')  
   
  # fix curly brace left  
  uri=$(echo ${uri} | sed 's:{:%7B:g')  
   
  # fix curly brace right  
  uri=$(echo ${uri} | sed 's:}:%7D:g')  
   
  # fix square bracket left  
  uri=$(echo ${uri} | sed 's:\[:%5B:g')  
   
  # fix square bracket right  
  uri=$(echo ${uri} | sed 's:\]:%5D:g')  
   
   
  # return  
  echo "${uri}"  
 }  
   
 upsort()  
 {  
  local allversions="$1"  
  [[ -n ${allversions} ]] || die "upsort(): no versions given"  
   
  if [ -x /home/tjoke/archlinux_version/highestver ]  
  then  
  /home/tjoke/archlinux_version/highestver ${allversions}  
  else  
  for i in ${allversions}  
  do  
  echo "${i}"  
  done | sort -g | tac | head -n 1  
  fi  
 }  
   
   
 lasttarball()  
 {  
  local suffix=bz2  
  local seperator="-"  
  [[ ! -z $1 ]] && suffix="$1"  
   
  [[ ! -z ${UP2SEPERATOR} ]] && seperator="${UP2SEPERATOR}"  
  [[ ${UP2SEPERATOR} = NULL ]] && seperator=""  
   
  case ${suffix} in  
  tbz2|tgz)  
  if [[ ! -z ${UP2EXCLUDE} ]]  
  then  
  grep "\(\.${suffix}\)\(\$\|\#\)" | grep -v -- "${UP2EXCLUDE}" | sed -n "s/.*${seperator}\(.*\)\(\.${suffix}\).*/\1/;$ p"  
  else  
  grep "\(\.${suffix}\)\(\$\|\#\)" | sed -n "s/.*${seperator}\(.*\)\(\.${suffix}\).*/\1/;$ p"  
  fi  
  ;;  
  *)  
  if [[ ! -z ${UP2EXCLUDE} ]]  
  then  
  grep "\(\.tar\.${suffix}\)\(\$\|\#\)" | grep -v -- "${UP2EXCLUDE}" | sed -n "s/.*${seperator}\(.*\)\(\.tar\.${suffix}\).*/\1/;$ p"  
  else  
  grep "\(\.tar\.${suffix}\)\(\$\|\#\)" | sed -n "s/.*${seperator}\(.*\)\(\.tar\.${suffix}\).*/\1/;$ p"  
  fi  
  ;;  
  esac  
 }  
   
 firsttarball()  
 {  
  local suffix=bz2  
  local seperator="-"  
  [[ ! -z $1 ]] && suffix="$1"  
   
  [[ ! -z ${UP2SEPERATOR} ]] && seperator="${UP2SEPERATOR}"  
  [[ ${UP2SEPERATOR} = NULL ]] && seperator=""  
   
  case ${suffix} in  
  tbz2|tgz)  
  if [[ ! -z ${UP2EXCLUDE} ]]  
  then  
  grep "\(\.${suffix}\)\(\$\|\#\)" | grep -v -- "${UP2EXCLUDE}" | sed "s/.*${seperator}\(.*\)\(\.${suffix}\).*/\1/;q"  
  else  
  grep "\(\.${suffix}\)\(\$\|\#\)" | sed "s/.*${seperator}\(.*\)\(\.${suffix}\).*/\1/;q"  
  fi  
  ;;  
  *)  
  if [[ ! -z ${UP2EXCLUDE} ]]  
  then  
  grep "\(\.tar\.${suffix}\)\(\$\|\#\)" | grep -v -- "${UP2EXCLUDE}" | sed "s/.*${seperator}\(.*\)\(\.tar\.${suffix}\).*/\1/;q"  
  else  
  grep "\(\.tar\.${suffix}\)\(\$\|\#\)" | sed "s/.*${seperator}\(.*\)\(\.tar\.${suffix}\).*/\1/;q"  
  fi  
  ;;  
  esac  
 }  
53    
54  updatecmd()  updatecmd()
55  {  {
# Line 172  updatecmd() Line 73  updatecmd()
73   fi   fi
74  }  }
75    
 updatecmd_gnu()  
 {  
  local pname=$1  
  local archive  
  local tarball  
   
  [[ -z ${pname} ]] && die "give me a \$PNAME"  
  [[ ! -z $2 ]] && archive="$2"  
   
  tarball="${pname}"  
  [[ ! -z ${UP2TARBALL} ]] && tarball="${UP2TARBALL}"  
   
  # remove 'latest' tarball too  
  updatecmd "http://ftp.gnu.org/gnu/${pname}/?C=M;O=A" | grep ${tarball}- | sed '/latest/d' | lasttarball "${archive}"  
 }  
   
 updatecmd_sourceforge_old()  
 {  
  local projectname="$1"  
  local pname="$2"  
  local check_deep_release_id="$3"  
  local archive  
  local uri  
  local group_id  
  local package_link_id  
  local package_id  
  local package_name  
  local release_link_id  
  local release_id  
   
  [[ -z ${projectname} ]] && die "give me a \$PROJECTNAME"  
  [[ -z ${pname} ]] && pname="${projectname}"  
  case ${check_deep_release_id} in  
  deep|release_id|releaseid) check_deep_release_id="true" ;;  
  esac  
  [[ ! -z $4 ]] && archive="$4"  
   
  # project home uri  
  uri="http://sourceforge.net/projects/${projectname}"  
  group_id=$(updatecmd ${uri} | grep showfiles | sed 's/.*=\(.*\)/\1/;s/#downloads$//;q')  
   
  # showfiles.php uri with group_id to get the latest files  
  uri="http://sourceforge.net/project/showfiles.php?group_id=${group_id}"  
   
  package_link_id=$(updatecmd ${uri} | grep "\[.*\]${pname} \[.*\].*Release.*" | sed "s/.*\[\(.*\)\]${pname}.*/\1/")  
  package_id=$(updatecmd ${uri} | grep "${package_link_id}\..*showfiles.*" | sed 's/.*package_id=\(.*\)/\1/')  
   
  # debug  
  #echo group_id=${group_id}  
  #echo package_link_id=${package_link_id}  
  #echo package_id=${package_id}  
   
  uri="http://sourceforge.net/project/showfiles.php?group_id=${group_id}&package_id=${package_id}"  
  package_name=$(updatecmd "${uri}" | grep -m1 'Latest \[.*\]' | sed 's/.*]\(.*\) \[.*\].*/\1/')  
   
  if [[ ${check_deep_release_id} = true ]]  
  then  
  # showfiles.php uri with group_id and package to get the latest released files  
  uri="http://sourceforge.net/project/showfiles.php?group_id=${group_id}&package_id=${package_id}"  
  release_link_id=$(updatecmd ${uri} | grep ".*Latest.*\[.*\]${package_name} \[.*\].*" | sed "s/.*\[\(.*\)\]${package_name}.*/\1/")  
  release_id=$(updatecmd "${uri}" | grep "${release_link_id}\..*showfiles.*" | sed 's/.*release_id=\(.*\)/\1/')  
   
  # debug  
  #echo package_name=${package_name}  
  #echo release_link_id=${release_link_id}  
  #echo release_id=${release_id}  
   
  uri="http://sourceforge.net/project/showfiles.php?group_id=${group_id}&package_id=${package_id}&release_id=${release_id}"  
  case ${archive} in  
  tbz2|tgz)  
  updatecmd "${uri}" | grep "\(\.${suffix}\)" | sed -n "s/.*-\(.*\)\(\.${suffix}\).*/\1/;$ p"  
  ;;  
  *)  
  updatecmd "${uri}" | grep "\(\.tar\.${archive}\)" | sed -n "s/.*-\(.*\)\(\.tar\.${archive}\).*/\1/;$ p"  
  ;;  
  esac  
  else  
  echo "${package_name}"  
  fi  
 }  
   
 # new layout  
 updatecmd_sourceforge2()  
 {  
  local projectname="$1"  
  local pname="$2"  
  local suffix  
  local uri  
  local package_link_id  
  local package_seperator="-"  
  local excluded  
   
  [[ -z ${projectname} ]] && die "give me a \$PROJECTNAME"  
  [[ -z ${pname} ]] && pname="${projectname}"  
  [[ ! -z $3 ]] && package_seperator="$3"  
   
  # project home uri  
  uri="http://sourceforge.net/projects/${projectname}/files"  
  # list of file suffixes, which should be excluded  
  excluded='(.asc|.md5)'  
  # package file names has always the date and time at the end <---------|  
  #package_link_id=$(updatecmd ${uri} | egrep -v ${excluded} | grep -v .md5 | grep -m1 "${pname}${package_seperator}[0-9].* [0-9]" | sed "s/.*\[\(.*\)\]${pname}.*/\1/")  
  package_link_id=$(updatecmd ${uri} | egrep -v ${excluded} | grep -m1 "${pname}${package_seperator}[0-9].* [0-9]" | sed "s/.*\[\(.*\)\].*/\1/")  
  echo DEBUG1:${package_link_id}  
   
  # get the suffix  
  suffix=$(updatecmd -listonly ${uri} | grep "\ ${package_link_id}\." | sed "s/.*${pname}.*\(\..*\)/\1/")  
 # echo "DEBUG2:${suffix}"  
   
  case ${suffix} in  
  .tbz2|.tgz|.zip|.rar)  
  #updatecmd ${uri} | grep -m1 "${pname}.*${suffix}" #| sed "s/.*${pname}\(.*\)${suffix}.*/\1/;s/-/_/g;s/_//1"  
  updatecmd -listonly ${uri} | grep "\ ${package_link_id}\." | sed "s/.*${pname}\(.*\)${suffix}.*/\1/;s/-/_/g;s/_//1"  
  ;;  
  *)  
  #updatecmd ${uri} | grep -m1 "${pname}.*.tar${suffix}" | sed "s/.*${pname}\(.*\).tar${suffix}.*/\1/;s/-/_/g;s/_//1"  
  updatecmd -listonly ${uri} | grep "\ ${package_link_id}\." | sed "s/.*${pname}\(.*\).tar${suffix}.*/\1/;s/-/_/g;s/_//1"  
  ;;  
  esac  
 }  
   
 # new layout, only newest  
 updatecmd_sourceforge_latest()  
 {  
  local projectname="$1"  
  local pname="$2"  
  local suffix  
  local uri  
  local package_link_id  
  local package_seperator="-"  
  local excluded  
  local deep="no"  
  local filename  
  local uppver  
   
  [[ -z ${projectname} ]] && die "give me a \$PROJECTNAME"  
  [[ -z ${pname} ]] && pname="${projectname}"  
  [[ ! -z $3 ]] && package_seperator="$3"  
  if [[ ! -z $4 ]]  
  then  
  deep="yes"  
  filename="$4"  
  fi  
   
  # project home uri  
  uri="http://sourceforge.net/projects/${projectname}/files"  
  # list of file suffixes, which should be excluded  
  excluded='(.asc|.md5)'  
  # package file names has always the date and time at the end <---------|  
 # package_link_id=$(updatecmd ${uri} | sed -n '/Newest Files/,/All Files/p' | grep -v ${excluded} | grep -m1 "${pname}${package_seperator}[0-9].* [0-9]" | sed "s/.*\[\(.*\)\].*/\1/")  
  package_link_id=$(updatecmd ${uri} | grep -A1 'Newest Files' | sed -n "s/.*\[\(.*\)\].*${pname}${package_seperator}.*/\1/;$ p")  
 # if [[ ${deep} = yes ]]  
 # then  
 # #package_link_id=$(updatecmd ${uri} | sed -n "/${pname}.*Subscribe.*/,/.*Subscribe.*/p" | sed -n "/${filename}.*Release Notes.*/,/.*Release Notes/p" | grep -v ${excluded} | grep -m1 ".*${package_seperator}[0-9].* [0-9]" | sed "s/.*\[\(.*\)\].*/\1/")  
 # package_link_id=$(updatecmd ${uri} | sed -n "/${pname}.*Subscribe.*/,/.*Subscribe.*/p" | sed -n "/${filename}.*Release Notes.*/,/.*Release Notes/p" | grep -v ${excluded} | grep -m1 "${pname}\ \[.*\]" | sed "s/.*\[\(.*\)\].*/\1/")  
 # else  
 # #package_link_id=$(updatecmd ${uri} | sed -n "/${pname}.*Subscribe.*/,/.*Subscribe.*/p" | grep -v ${excluded} | grep -m1 ".*${package_seperator}[0-9].* [0-9]" | sed "s/.*\[\(.*\)\].*/\1/")  
 # #package_link_id=$(updatecmd ${uri} | sed -n "/${pname}.*Subscribe.*/,/.*Subscribe.*/p" | grep -v ${excluded} | grep -m1 "${pname}\ \[.*\]" | sed "s/.*\[\(.*\)\].*/\1/")  
 # package_link_id=$(updatecmd ${uri} | grep -A1 'Newest Files' | sed -n "s/.*\[\(.*\)\].*${pname}${package_seperator}.*/\1/;$ p")  
 # fi  
 # #echo DEBUG1:${package_link_id}  
   
  # get the suffix  
  #suffix=$(updatecmd -listonly ${uri} | grep "\ ${package_link_id}\." | sed "s/.*${pname}.*\(\..*\)\/download/\1/")  
  suffix=$(updatecmd -listonly ${uri} | grep "\ ${package_link_id}\." | sed "s/.*\(\..*\)\/download/\1/")  
  #echo "DEBUG2:${suffix}"  
   
  case ${suffix} in  
  .tbz2|.tgz|.zip|.rar|.7z)  
  #updatecmd ${uri} | grep -m1 "${pname}.*${suffix}" #| sed "s/.*${pname}\(.*\)${suffix}.*/\1/;s/-/_/g;s/_//1"  
  #updatecmd -listonly ${uri} | grep "\ ${package_link_id}\." | sed "s/.*${pname}\(.*\)${suffix}.*/\1/;s/-/_/g;s/_//1"  
  #updatecmd -listonly ${uri} | grep "\ ${package_link_id}\." | sed "s/.*${package_seperator}\(.*\)${suffix}.*/\1/;s/-/_/g;s/_//1"  
  uppver=$(updatecmd -listonly ${uri} | grep "\ ${package_link_id}\." | sed "s/.*${package_seperator}\([0-9].*\)${suffix}.*/\1/;s/-/_/g;s/_//1")  
  ;;  
  *)  
  #updatecmd ${uri} | grep -m1 "${pname}.*.tar${suffix}" | sed "s/.*${pname}\(.*\).tar${suffix}.*/\1/;s/-/_/g;s/_//1"  
  #updatecmd -listonly ${uri} | grep "\ ${package_link_id}\." | sed "s/.*${package_seperator}\(.*\).tar${suffix}.*/\1/;s/-/_/g;s/_//1"  
  uppver=$(updatecmd -listonly ${uri} | grep "\ ${package_link_id}\." | sed "s/.*${package_seperator}\([0-9].*\).tar${suffix}.*/\1/;s/-/_/g;s/_//1")  
  ;;  
  esac  
   
  if [[ ! -z ${UP2SUBSTITUTE} ]]  
  then  
  echo "${uppver}" | sed "s:${UP2SUBSTITUTE}::g"  
  else  
  echo "${uppver}"  
  fi  
 }  
   
   
 # new layout, only newest  
 updatecmd_sourceforge_lala()  
 {  
  local projectname="$1"  
  local pname="$2"  
  local suffix  
  local uri  
  local opts  
  local package_link_id  
  local package_seperator="-"  
  local excluded  
  local deep="no"  
  local filename="${pname}"  
  local uppver  
   
  [[ -z ${projectname} ]] && die "give me a \$PROJECTNAME"  
  [[ -z ${pname} ]] && pname="${projectname}"  
  if [[ ! -z $3 ]]  
  then  
  case $3 in  
  null|NULL) package_seperator='' ;;  
  *) package_seperator="$3" ;;  
  esac  
  fi  
  if [[ ! -z $4 ]]  
  then  
  deep="yes"  
  filename="$4"  
  else  
  filename="${pname}"  
  fi  
   
  # special opts like sort date asc  
  if [[ ! -z ${UP2OPTS} ]]  
  then  
  opts="${UP2OPTS}"  
  else  
  opts='?sort=date&sortdir=asc'  
  fi  
  # project home uri                                 # urlencode $pname  
  uri="http://sourceforge.net/projects/${projectname}/files/$(urlencode ${pname})${opts}"  
  # list of file suffixes, which should be excluded  
  excluded='(.asc|.md5|.exe|.txt|.sign|.rpm|.html|.7z|.dmg)'  
  package_link_id=$(updatecmd "${uri}" | grep "\[.*\]${filename}${package_seperator}" | egrep -v ${excluded} | sed -n "s/.*\[\(.*\)\].*${filename}${package_seperator}.*/\1/;$ p")  
   
  # get the suffix  
  suffix=$(updatecmd -listonly "${uri}" | grep "\ ${package_link_id}\." | sed "s/.*\(\..*\)\/download/\1/")  
  #echo "DEBUG2:${suffix}"  
   
  case ${suffix} in  
  .tbz2|.tgz|.zip|.rar|.7z)  
  uppver=$(updatecmd -listonly "${uri}" | grep "\ ${package_link_id}\." | sed "s/.*${package_seperator}\([0-9].*\)${suffix}.*/\1/;s/-/_/g;s/_//1")  
  ;;  
  *)  
  uppver=$(updatecmd -listonly "${uri}" | grep "\ ${package_link_id}\." | sed "s/.*${package_seperator}\([0-9].*\).tar${suffix}.*/\1/;s/-/_/g;s/_//1")  
  ;;  
  esac  
   
  if [[ ! -z ${UP2SUBSTITUTE} ]]  
  then  
  echo "${uppver}" | sed "s:${UP2SUBSTITUTE}::g"  
  else  
  echo "${uppver}"  
  fi  
 }  
   
 # new layout, only newest  
 updatecmd_sourceforge_ftp_dir()  
 {  
  local projectname="$1"  
  local pname="$2"  
  local modifier="$3"  
  local uppver  
   
  # mesh works, kent not  
  #local mirror="http://mesh.dl.sourceforge.net"  
  local mirror="http://garr.dl.sourceforge.net"  
   
  [[ -z ${projectname} ]] && die "give me a \$PROJECTNAME"  
  [[ -z ${pname} ]] && pname="${projectname}"  
  case ${modifier} in  
  date-asc) modifier='?C=M;O=A' ;;  
  date-desc) modifier='?C=M;O=D' ;;  
  name) modifier='' ;;  
  *) modifier='' ;;  
  esac  
   
  # urlencode everything  
  projectname=$(urlencode ${projectname})  
  pname=$(urlencode ${pname})  
   
  if [[ ! -z ${UP2EXCLUDE} ]]  
  then  
  uppver=$(updatecmd "${mirror}/project/${projectname}/${pname}/${modifier}" | grep -v -- "${UP2EXCLUDE}" | grep '[DIR].*\[[0-9].*\/' | sed -n 's/.*[0-9]\]\(.*\)\/.*/\1/;$ p')  
  else  
  uppver=$(updatecmd "${mirror}/project/${projectname}/${pname}/${modifier}" | grep '[DIR].*\[[0-9].*\/' | sed -n 's/.*[0-9]\]\(.*\)\/.*/\1/;$ p')  
  fi  
   
  if [[ ! -z ${UP2SUBSTITUTE} ]]  
  then  
  echo "${uppver}" | sed "s:${UP2SUBSTITUTE}::g"  
  else  
  echo "${uppver}"  
  fi  
 }  
   
 # needs app-text/xmlstarlet  
 updatecmd_sourceforge()  
 {  
  local projectname="$1"  
  local subprojectname="$2"  
  local archive="$3"  
  local uri  
  local project_id  
  local tarballname  
  local seperator  
  local rss_limit=30  
  local tarballprefix  
  local uppver  
  local allver  
   
  if [[ -z ${archive} ]] && [[ -n ${subprojectname} ]]  
  then  
  case ${subprojectname} in  
  xz|gz|bz2|tbz|tbz2|txz|tgz|zip|rar|7z|jar)  
  archive="${subprojectname}"  
  unset subprojectname  
  ;;  
  esac  
  fi  
   
  [[ -z ${projectname} ]] && die "give me a \$PROJECTNAME"  
  [[ -z ${subprojectname} ]] && subprojectname="${projectname}"  
  if [[ -z ${tarballname} ]]  
  then  
  if [[ ${subprojectname} != ${projectname} ]]  
  then  
  tarballname="${subprojectname}"  
  else  
  tarballname="${projectname}"  
  fi  
  fi  
  [[ -z ${seperator} ]] && seperator="-"  
  [[ -z ${archive} ]] && archive="bz2"  
   
  # overrides  
  [[ ! -z ${UP2TARBALL} ]] && tarballname="${UP2TARBALL}"  
  [[ ! -z ${UP2SEPERATOR} ]] && seperator="${UP2SEPERATOR}"  
  [[ ${UP2SEPERATOR} = NULL ]] && seperator=""  
   
  uri="http://sourceforge.net/projects/${projectname}"  
  project_id=$(updatecmd ${uri} | grep project-id | sed -e 's:.*project-id/::;s:/.*::')  
  rss_uri="http://sourceforge.net/api/file/index/project-id/${project_id}/mtime/desc/limit/${rss_limit}/rss"  
   
  case ${archive} in  
  bz2|gz|xz) tarballprefix=".tar.${archive}" ;;  
  tbz|tbz2|txz|tgz|zip|rar|7z|jar) tarballprefix=".${archive}" ;;  
  *) tarballprefix="${archive}" ;;  
  esac  
   
  if [[ -x $(type -P xml) ]]  
  then  
  allver=$(updatecmd ${rss_uri} | xml sel -T -t -m //item -v title -n)  
  else  
  allver=$(updatecmd ${rss_uri})  
  fi  
   
  if [[ ! -z ${UP2EXCLUDE} ]]  
  then  
  allver=$(echo "${allver}" | grep -v -- "${UP2EXCLUDE}")  
  fi  
   
  allver=$(echo "${allver}" | grep "/${subprojectname}.*/${tarballname}${seperator}.*${tarballprefix}" | sed -e "s:.*${tarballname}${seperator}::;s:${tarballprefix}.*::")  
  #uppver=$(echo "${allver}" | sort -g | tac | head -n 1)  
  #uppver=$(echo "${allver}" | sort -n | tac | head -n 1)  
  uppver=$(upsort "${allver}")  
   
  if [[ ! -z ${UP2SUBSTITUTE} ]]  
  then  
  echo "${uppver}" | sed "s:${UP2SUBSTITUTE}::g"  
  else  
  echo "${uppver}"  
  fi  
 }  
   
 updatecmd_berlios()  
 {  
  local projectname="$1"  
  local pname="$2"  
  local uri  
  local group_id  
   
  [[ -z ${projectname} ]] && die "give me a \$PROJECTNAME"  
  [[ -z ${pname} ]] && pname="${projectname}"  
   
  uri="http://developer.berlios.de/projects/${projectname}"  
  group_id=$(updatecmd "${uri}" | grep showfiles | sed 's/.*group_id=\(.*\)&.*/\1/;q')  
   
  # debug  
 # echo group_id=${group_id}  
 # echo package_link_id=${package_link_id}  
 # echo package_id=${package_id}  
   
  uri="http://developer.berlios.de/project/showfiles.php?group_id=${group_id}"  
  updatecmd "${uri}" | grep -A3 "^${pname}$" | sed -n 's/.*\[.*]\(.*\) .*[0-9]-.*/\1/;$ p'  
 }  
   
 updatecmd_freedesktop()  
 {  
  local pname=$1  
  local archive  
  local subdir  
  local tarballname  
   
  [[ -z ${pname} ]] && die "give me a \$PNAME"  
  [[ ! -z $2 ]] && archive="$2"  
  [[ ! -z ${UP2SUBDIR} ]] && subdir="/${UP2SUBDIR}"  
  tarballname="${pname}"  
  [[ ! -z ${UP2TARBALL} ]] && tarballname="${UP2TARBALL}"  
   
  # exclude rc versions!  
  updatecmd "http://${pname}.freedesktop.org/releases${subdir}?C=M;O=A" | grep ${tarballname}- | grep -v rc[0-9] | lasttarball "${archive}"  
 }  
   
 updatecmd_xorg()  
 {  
  local pname=$1  
  local subdir  
  local tarballname  
  local pcat  
   
  [[ -z ${pname} ]] && die "give me a \$PNAME"  
  [[ ! -z $2 ]] && archive="$2"  
  tarballname="${pname}-"  
  if [[ ! -z ${PCAT} ]]  
  then  
  pcat="${PCAT}"  
  else  
  pcat="${PCATEGORIE}"  
  fi  
  subdir="$(echo ${pcat} | sed -e 's:x11-::' -e 's:media-::' -e 's/\(.*\)s$/\1/')"  
  [[ ! -z ${UP2SUBDIR} ]] && subdir="${UP2SUBDIR}"  
  [[ ! -z ${UP2TARBALL} ]] && tarballname="${UP2TARBALL}"  
   
  updatecmd "http://xorg.freedesktop.org/archive/individual/${subdir}/?C=M;O=A" | grep "/${tarballname}" | lasttarball "${archive}"  
 }  
   
 updatecmd_perl()  
 {  
  local pname=$1  
  local archive  
  local uppver  
   
  [[ -z ${pname} ]] && die "give me a \$PNAME"  
  [[ ! -z $2 ]] && archive="$2"  
   
  uppver=$(updatecmd "http://search.cpan.org/dist/${pname}/" | lasttarball "${archive}")  
   
         if [[ ! -z ${UP2SUBSTITUTE} ]]  
         then  
                 echo "${uppver}" | sed "s:${UP2SUBSTITUTE}::g"  
         else  
                 echo "${uppver}"  
         fi  
 }  
   
 updatecmd_gnome()  
 {  
  local uri  
  local pname="$1"  
  local mode="$2"  
  local appmajor  
   
   
  [[ -z ${pname} ]] && die "give me a \$PNAME"  
   
  case ${mode} in  
  devel|--devel) mode="devel" ;;  
  *) mode="normal" ;;  
  esac  
   
  uri="http://ftp.gnome.org/pub/GNOME/sources/${pname}"  
  if [[ ${mode} = devel ]]  
  then  
  appmajor=$(updatecmd "${uri}"/?C=N\;O=D | grep '/' | sed -ne 's|.*]\(.*\)/.*|\1|' -e '1 p')  
  else  
  appmajor=$(updatecmd "${uri}"/?C=N\;O=D | grep '[0-9]\.[0-9]*[02468]/' | sed -ne 's|.*]\(.*\)/.*|\1|' -e '1 p')  
  fi  
   
  updatecmd ${uri}/${appmajor}/ | grep ]LA | sed 's/.*S-\([0-9\.]*\).*/\1/'  
 }  
   
 updatecmd_xfce()  
 {  
  local uri  
  local pname="$1"  
  local archive  
  local subdir  
   
  [[ -z ${pname} ]] && die "give me a \$PNAME"  
  [[ ! -z $2 ]] && archive="$2"  
  if [[ -n ${UP2SUBDIR} ]]  
  then  
  subdir="${UP2SUBDIR}"  
  else  
  subdir="xfce"  
  fi  
   
  uri="http://archive.xfce.org/src/${subdir}/${pname}"  
  if [[ ${UP2OPTS} = unstable ]]  
  then  
  updatecmd ${uri}/$(updatecmd "${uri}"/?C=N\;O=D | grep '[0-9]\.[0-9]/' | sed -ne 's|.*]\(.*\)/.*|\1|' -e '1 p')/?C=M\;O=A | lasttarball "${archive}"  
  else  
  updatecmd ${uri}/$(updatecmd "${uri}"/?C=N\;O=D | grep '[0-9]\.[0-9]*[02468]/' | sed -ne 's|.*]\(.*\)/.*|\1|' -e '1 p')/?C=M\;O=A | lasttarball "${archive}"  
  fi  
  #updatecmd ${uri}/$(updatecmd -source ${uri}'?C=M;O=A' | grep ${pname} |tail -n1 | sed -e 's/<\/a>.*//;s/.*>//') | lasttarball ${archive}  
 }  
   
 updatecmd_google()  
 {  
  local uri  
  local pname="$1"  
  local archive  
   
  [[ -z ${pname} ]] && die "give me a \$PNAME"  
  [[ ! -z $2 ]] && archive="$2"  
   
  uri="http://code.google.com/p/${pname}/downloads/list"  
  updatecmd --listonly "${uri}"  | grep ${pname}- | firsttarball "${archive}"  
 }  
   
76  updateme()  updateme()
77  {  {
78   local smage="$1"   local smage="$1"
# Line 743  updateme() Line 123  updateme()
123    
124   if [[ -z ${UP2DATE} ]]   if [[ -z ${UP2DATE} ]]
125   then   then
  #echo "\$UP2DATE is empty, skipping ..."  
126   continue   continue
127   fi   fi
128    
  #echo "UP2DATE=${UP2DATE}"  
  #read  
129   UPSTREAM_PVER=$(eval "${UP2DATE}")   UPSTREAM_PVER=$(eval "${UP2DATE}")
130   if [[ ${ONLY_PRINT_UPSTREAM} = 1 ]]   if [[ ${ONLY_PRINT_UPSTREAM} = 1 ]]
131   then   then
132   echo "${UPSTREAM_PVER}"   echo "${UPSTREAM_PVER}"
133   else   else
 # [[ ${UP2PVER} = ${UPSTREAM_PVER} ]] && echo -e "${PNAME}: ${COLGREEN}'${UP2PVER}' = '${UPSTREAM_PVER}'${COLDEFAULT}"  
 # #[[ ${UP2PVER} != ${UPSTREAM_PVER} ]] && echo "${PNAME}: '${UP2PVER}' != '${UPSTREAM_PVER}'"  
 # [[ ${UP2PVER} < ${UPSTREAM_PVER} ]] && echo -e "${PNAME}: ${COLRED}'${UP2PVER}' < '${UPSTREAM_PVER}'${COLDEFAULT}"  
 # [[ ${UP2PVER} > ${UPSTREAM_PVER} ]] && echo -e "${PNAME}: ${COLYELLOW}'${UP2PVER}' > '${UPSTREAM_PVER}'${COLDEFAULT}"  
134   local retval   local retval
135   retval=$(/home/tjoke/archlinux_version/vercomp "${UP2PVER}" "${UPSTREAM_PVER}")   retval=$(${MLIBDIR}/vercomp "${UP2PVER}" "${UPSTREAM_PVER}")
136   [ ${retval} -eq 0 ] && echo -e "${PNAME}: ${COLGREEN}'${UP2PVER}' = '${UPSTREAM_PVER}'${COLDEFAULT}"   [ ${retval} -eq 0 ] && echo -e "${PNAME}: ${COLGREEN}'${UP2PVER}' = '${UPSTREAM_PVER}'${COLDEFAULT}"
137   [ ${retval} -lt 0 ] && echo -e "${PNAME}: ${COLRED}'${UP2PVER}' < '${UPSTREAM_PVER}'${COLDEFAULT}"   [ ${retval} -lt 0 ] && echo -e "${PNAME}: ${COLRED}'${UP2PVER}' < '${UPSTREAM_PVER}'${COLDEFAULT}"
138   [ ${retval} -gt 0 ] && echo -e "${PNAME}: ${COLYELLOW}'${UP2PVER}' > '${UPSTREAM_PVER}'${COLDEFAULT}"   [ ${retval} -gt 0 ] && echo -e "${PNAME}: ${COLYELLOW}'${UP2PVER}' > '${UPSTREAM_PVER}'${COLDEFAULT}"
# Line 775  updateall() Line 148  updateall()
148   local UP2DATE_SLEEP_COUNT=15   local UP2DATE_SLEEP_COUNT=15
149   local UP2DATE_SLEEP_TIMEOUT=3   local UP2DATE_SLEEP_TIMEOUT=3
150   local ONLY_PRINT_UPSTREAM=0   local ONLY_PRINT_UPSTREAM=0
151     local c
152    
  : ${REPOS="/home/tjoke/svn/smage/trunk/core /home/tjoke/svn/smage/trunk/extras /home/tjoke/svn/smage/trunk/nonfree /home/tjoke/svn/smage/trunk/todo"}  
 # REPOS="/home/tjoke/svn/smage/trunk/core /home/tjoke/svn/smage/trunk/extras"  
 # REPOS="/home/tjoke/svn/smage/trunk/core"  
 # PACKAGE="glibc-nptl"  
 # PACKAGE="autoconf21"  
153   PACKAGE="*"   PACKAGE="*"
154   [[ ! -z $1 ]] && PACKAGE="$1"   [[ ! -z $1 ]] && PACKAGE="$1"
155    

Legend:
Removed from v.2590  
changed lines
  Added in v.2591