Magellan Linux

Diff of /trunk/pkgtools/up2date.sh

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

revision 2110 by niro, Mon May 13 11:35:14 2013 UTC revision 2111 by niro, Mon May 13 11:40:55 2013 UTC
# Line 5  source /usr/lib/mage/smage2.functions.sh Line 5  source /usr/lib/mage/smage2.functions.sh
5    
6  # timeout in seconds  # timeout in seconds
7  LYNX_CONNECT_TIMEOUT=10  LYNX_CONNECT_TIMEOUT=10
8    LYNX_READ_TIMEOUT=10
9    
10  ## only for tests -> normally in /etc/rc.d/init.d/functions  ## only for tests -> normally in /etc/rc.d/init.d/functions
11  COLRED="\033[1;6m\033[31m"  COLRED="\033[1;6m\033[31m"
# Line 77  urlencode() Line 78  urlencode()
78  lasttarball()  lasttarball()
79  {  {
80   local suffix=bz2   local suffix=bz2
81     local seperator="-"
82   [[ ! -z $1 ]] && suffix="$1"   [[ ! -z $1 ]] && suffix="$1"
83    
84     [[ ! -z ${UP2SEPERATOR} ]] && seperator="${UP2SEPERATOR}"
85     [[ ${UP2SEPERATOR} = NULL ]] && seperator=""
86    
87   case ${suffix} in   case ${suffix} in
88   tbz2|tgz)   tbz2|tgz)
89   if [[ ! -z ${UP2EXCLUDE} ]]   if [[ ! -z ${UP2EXCLUDE} ]]
90   then   then
91   grep "\(\.${suffix}\)\(\$\|\#\)" | grep -v -- "${UP2EXCLUDE}" | sed -n "s/.*-\(.*\)\(\.${suffix}\).*/\1/;$ p"   grep "\(\.${suffix}\)\(\$\|\#\)" | grep -v -- "${UP2EXCLUDE}" | sed -n "s/.*${seperator}\(.*\)\(\.${suffix}\).*/\1/;$ p"
92   else   else
93   grep "\(\.${suffix}\)\(\$\|\#\)" | sed -n "s/.*-\(.*\)\(\.${suffix}\).*/\1/;$ p"   grep "\(\.${suffix}\)\(\$\|\#\)" | sed -n "s/.*${seperator}\(.*\)\(\.${suffix}\).*/\1/;$ p"
94   fi   fi
95   ;;   ;;
96   *)   *)
97   if [[ ! -z ${UP2EXCLUDE} ]]   if [[ ! -z ${UP2EXCLUDE} ]]
98   then   then
99   grep "\(\.tar\.${suffix}\)\(\$\|\#\)" | grep -v -- "${UP2EXCLUDE}" | sed -n "s/.*-\(.*\)\(\.tar\.${suffix}\).*/\1/;$ p"   grep "\(\.tar\.${suffix}\)\(\$\|\#\)" | grep -v -- "${UP2EXCLUDE}" | sed -n "s/.*${seperator}\(.*\)\(\.tar\.${suffix}\).*/\1/;$ p"
100   else   else
101   grep "\(\.tar\.${suffix}\)\(\$\|\#\)" | sed -n "s/.*-\(.*\)\(\.tar\.${suffix}\).*/\1/;$ p"   grep "\(\.tar\.${suffix}\)\(\$\|\#\)" | sed -n "s/.*${seperator}\(.*\)\(\.tar\.${suffix}\).*/\1/;$ p"
102   fi   fi
103   ;;   ;;
104   esac   esac
# Line 102  lasttarball() Line 107  lasttarball()
107  firsttarball()  firsttarball()
108  {  {
109   local suffix=bz2   local suffix=bz2
110     local seperator="-"
111   [[ ! -z $1 ]] && suffix="$1"   [[ ! -z $1 ]] && suffix="$1"
112    
113     [[ ! -z ${UP2SEPERATOR} ]] && seperator="${UP2SEPERATOR}"
114     [[ ${UP2SEPERATOR} = NULL ]] && seperator=""
115    
116   case ${suffix} in   case ${suffix} in
117   tbz2|tgz)   tbz2|tgz)
118   if [[ ! -z ${UP2EXCLUDE} ]]   if [[ ! -z ${UP2EXCLUDE} ]]
119   then   then
120   grep "\(\.${suffix}\)\(\$\|\#\)" | grep -v -- "${UP2EXCLUDE}" | sed "s/.*-\(.*\)\(\.${suffix}\).*/\1/;q"   grep "\(\.${suffix}\)\(\$\|\#\)" | grep -v -- "${UP2EXCLUDE}" | sed "s/.*${seperator}\(.*\)\(\.${suffix}\).*/\1/;q"
121   else   else
122   grep "\(\.${suffix}\)\(\$\|\#\)" | sed "s/.*-\(.*\)\(\.${suffix}\).*/\1/;q"   grep "\(\.${suffix}\)\(\$\|\#\)" | sed "s/.*${seperator}\(.*\)\(\.${suffix}\).*/\1/;q"
123   fi   fi
124   ;;   ;;
125   *)   *)
126   if [[ ! -z ${UP2EXCLUDE} ]]   if [[ ! -z ${UP2EXCLUDE} ]]
127   then   then
128   grep "\(\.tar\.${suffix}\)\(\$\|\#\)" | grep -v -- "${UP2EXCLUDE}" | sed "s/.*-\(.*\)\(\.tar\.${suffix}\).*/\1/;q"   grep "\(\.tar\.${suffix}\)\(\$\|\#\)" | grep -v -- "${UP2EXCLUDE}" | sed "s/.*${seperator}\(.*\)\(\.tar\.${suffix}\).*/\1/;q"
129   else   else
130   grep "\(\.tar\.${suffix}\)\(\$\|\#\)" | sed "s/.*-\(.*\)\(\.tar\.${suffix}\).*/\1/;q"   grep "\(\.tar\.${suffix}\)\(\$\|\#\)" | sed "s/.*${seperator}\(.*\)\(\.tar\.${suffix}\).*/\1/;q"
131   fi   fi
132   ;;   ;;
133   esac   esac
# Line 130  updatecmd() Line 139  updatecmd()
139   local useragent   local useragent
140   [[ ! -z ${UP2USERAGENT} ]] && useragent="-useragent '${UP2USERAGENT}'"   [[ ! -z ${UP2USERAGENT} ]] && useragent="-useragent '${UP2USERAGENT}'"
141    
142   uppver=$(lynx -connect_timeout=${LYNX_CONNECT_TIMEOUT} -dump "${useragent}" $@)   uppver=$(lynx -connect_timeout=${LYNX_CONNECT_TIMEOUT} -read_timeout=${LYNX_READ_TIMEOUT} -dump "${useragent}" $@)
143   if [[ $? -ne 0 ]]   if [[ $? -ne 0 ]]
144   then   then
145   echo "Error connecting '$@'"   echo "Error connecting '$@'"
# Line 556  updatecmd_freedesktop() Line 565  updatecmd_freedesktop()
565   [[ ! -z ${UP2TARBALL} ]] && tarballname="${UP2TARBALL}"   [[ ! -z ${UP2TARBALL} ]] && tarballname="${UP2TARBALL}"
566    
567   # exclude rc versions!   # exclude rc versions!
568   updatecmd "http://${pname}.freedesktop.org/releases${subdir}" | grep ${tarballname}- | grep -v rc[0-9] | lasttarball "${archive}"   updatecmd "http://${pname}.freedesktop.org/releases${subdir}?C=M;O=A" | grep ${tarballname}- | grep -v rc[0-9] | lasttarball "${archive}"
569  }  }
570    
571  updatecmd_xorg()  updatecmd_xorg()

Legend:
Removed from v.2110  
changed lines
  Added in v.2111