Update of /cvsroot/devil-linux/build
In directory sc8-pr-cvs1:/tmp/cvs-serv30331
Modified Files:
update_src
Log Message:
make code more generic
PS: Friedl said with the current code could it not be done. As always it
needs a little extra to make something work the way you want it to ;-)
Index: update_src
===================================================================
RCS file: /cvsroot/devil-linux/build/update_src,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- update_src 14 Jan 2004 16:33:19 -0000 1.23
+++ update_src 14 Jan 2004 18:05:20 -0000 1.24
@@ -1,3 +1,4 @@
+#!/bin/bash
# $Id$
#
# Note: when starting to pull all sources first try to use a mirror and
@@ -13,10 +14,21 @@
# the array holding the directory on the specific ftp server
declare -a ftpd
+#
+# menu[x]="DESCRIPTIOM"
+# ftps[x]="ftp.domain.invalid" - the hostname of the ftp mirror server
+# ftpd[x]="/...../sources/$VERSION/" - path to the sources
+#
+
+# the main server
+
menu[1]="Devil-Linux FTP-Server Frankfurt (M)/Germany"
ftps[1]="ftp.devil-linux.org"
ftpd[1]="/pub/devel/sources/$VERSION/"
+
+# the official mirrors
+
menu[2]="University of Technology Lille/France - official mirror"
ftps[2]="ftp.univ-lille1.fr"
ftpd[2]="/pub/os/linux/distributions/devil-linux/devel/sources/$VERSION/"
@@ -29,14 +41,12 @@
ftps[4]="xenia.sote.hu"
ftpd[4]="/pub/mirrors/devil-linux/devel/sources/$VERSION/"
-menu[5]="University of Technology Graz/Austria - internal mirror"
-ftps[5]="ftp.vc-graz.ac.at"
-ftpd[5]="/pub/mirror/devil-linux/devel/sources/$VERSION/"
-# Last low number be set to "EOF" to separate the high internal mirrors
-menu[6]="EOF"
-ftps[6]="EOF"
-ftpd[6]="EOF"
+# the internal mirrors (mostly used by specific developers)
+
+menu[97]="University of Technology Graz/Austria - internal mirror"
+ftps[97]="ftp.vc-graz.ac.at"
+ftpd[97]="/pub/mirror/devil-linux/devel/sources/$VERSION/"
menu[98]="Heiko @ home - internal mirror"
ftps[98]="192.168.0.2"
@@ -46,13 +56,16 @@
ftps[99]="172.16.2.1"
ftpd[99]="/"
+maxindex=99
+
function menu () {
local menuitems=${#menu[@]} # number of menuitems
+
+ echo menuitems=${menuitems}
ret=255
while [ $ret -eq 255 ]; do
- j=0
echo
echo "Note: when starting to pull the sources for the first"
echo " time try to use a mirror and then call update_src"
@@ -60,12 +73,10 @@
echo " just get the latest source updates"
echo
echo "The list of devil linux mirrors:"
- for ((i=1; $i - $menuitems - 1; i++)); do
- if [ "${menu[$i]}" = "EOF" ]; then
- let j=99-$menuitems+$i
- continue
+ for ((i=1, j=1; i <= menuitems; i++, j++)); do
+ if [ $i = $j -a "${#menu[$i]}" -eq 0 ]; then
+ let j=$maxindex-$menuitems+$i
fi
- let j++
echo " ($j) ${menu[$j]}"
done
@@ -73,7 +84,7 @@
echo -n "Please select one from the list above or (e)xit [1]: "
read input
- test -n "$input" -a $input -gt 0 -a "${menu[$input]}" != "EOF" -a -n "${menu[$input]}" 2>/dev/null &&
+ test -n "$input" -a $input -gt 0 -a "${#menu[$input]}" -ne 0 2>/dev/null &&
ret=$input
test -n "$input" -a \( "$input" = "e" -o "$input" = "E" \) 2>/dev/null &&
ret=0
|