wok-current view mirror-tools/stuff/var/www/slitaz/mirror/pxe/mkcfg.sh @ rev 7362
mirror-tools/mkcfg.sh: create direct pxe links
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Nov 23 18:57:25 2010 +0100 (2010-11-23) |
parents | 176a21b0a0b7 |
children |
line source
1 #!/bin/sh
3 #usage:
4 # copy /boot/isolinux/* <version>
5 # remove *.cfg
6 # copy then update /boot/isolinux/isolinux.cfg <version>core.cfg
8 cd $(dirname $0)
10 # Status functions.
11 status()
12 {
13 local CHECK=$?
14 echo -en "\\033[70G[ "
15 if [ $CHECK = 0 ]; then
16 echo -en "\\033[1;33mOK"
17 else
18 echo -en "\\033[1;31mFailed"
19 fi
20 echo -e "\\033[0;39m ]"
21 }
23 directlinks()
24 {
25 mkdir $1/$2
26 ln -s .. $1/$2/$1
27 ln -s ../$2.cfg $1/$2/default
28 ln -s ../../pxelinux.0 $1/$2/pxelinux.0
29 ln -s . $1/$2/pxelinux.cfg
30 [ -e $1/boot ] || ln -s ../../boot $1/boot
31 }
32 for version in cooking $(ls ../boot | grep 0$) ; do
34 [ "$version" = "1.0" ] && continue
35 echo -n "Building $version"
36 for i in splash.lss isolinux.msg core.cfg ; do
37 [ -s $version/$i ] && continue
38 echo -n " $version/$i not found !"
39 false
40 status
41 continue 2
42 done
43 if ! grep -q $version/splash.lss $version/isolinux.msg ; then
44 echo "WARNING: please update $version/isolinux.msg with $version/splash.lss"
45 fi
46 rm -f $version/*-*.cfg
47 ( cd ../boot/$version ; ls rootfs-*.gz 2> /dev/null ) | \
48 sed 's/rootfs-\(.*\).gz/\1/' | while read flavor; do
49 lowcased=$(echo $flavor | tr [A-Z] [a-z])
50 if [ "$lowcased" != "$flavor" ]; then
51 echo ""
52 echo "Warning : renaming ../boot/$version/rootfs-$flavor.gz to ../boot/$version/rootfs-$lowcased.gz"
53 mv ../boot/$version/rootfs-$flavor.gz ../boot/$version/rootfs-$lowcased.gz
54 flavor=$lowcased
55 fi
56 [ -f $version/$flavor.cfg ] && continue
57 cp $version/core.cfg $version/$flavor.cfg
58 sed -i -e "s/core-common/$flavor-common/" \
59 -e "s/^label slitaz$/say Using $flavor flavor.\nlabel slitaz/" \
60 -e "s/rootfs.gz/rootfs-$flavor.gz/" $version/$flavor.cfg
61 directlinks $version $flavor
62 done
63 for flavor in $(cd $version ; ls *.cfg | sed 's/.cfg//') ; do
64 echo -n " $flavor"
65 cat > $version/$flavor-common.cfg <<EOT
66 default slitaz
67 label deCH
68 config $version/$flavor-de_CH.cfg
69 label frCH
70 config $version/$flavor-fr_CH.cfg
71 label reboot
72 com32 reboot.c32
74 implicit 0
75 prompt 1
76 timeout 80
77 F1 $version/help.txt
78 F2 $version/options.txt
79 F3 $version/isolinux.msg
80 F4 $version/display.txt
81 F5 $version/enhelp.txt
82 F6 $version/enopts.txt
84 EOT
85 while read cfg kbd loc ; do
86 if [ ! -f $version/$cfg.kbd ]; then
87 echo ""
88 echo "Not found: $version/$cfg.kbd"
89 fi
90 info="Now using $kbd keyboard and $loc locale."
91 sed -e "s/^display/kbdmap $version\/$cfg.kbd\ndisplay/" \
92 -e "s/^label slitaz$/say $info\nlabel slitaz/" \
93 -e "s/gz/gz lang=$loc kmap=$kbd/" \
94 < $version/$flavor.cfg > $version/$flavor-$cfg.cfg
95 cat >> $version/$flavor-common.cfg <<EOT
96 label $cfg
97 config $version/$flavor-$cfg.cfg
98 EOT
99 done <<EOT
100 be be-latin1 fr_FR
101 br br-abnt2 pt_PT
102 ca cf fr_FR
103 de de-latin1 de_DE
104 de_CH de_CH-latin1 de_DE
105 en uk C
106 es es es_ES
107 fi fi-latin1 fi
108 fr fr-latin1 fr_FR
109 fr_CH fr_CH-latin1 fr_FR
110 hu hu hu
111 it it it_IT
112 jp jp106 jp_JP
113 pt pt-latin1 pt_PT
114 ru ru ru_RU
115 us us C
116 EOT
117 done
118 status
120 done
122 echo -n "Building 1.0"
123 rm -f 1.0/*-*.cfg
124 ( cd ../boot/1.0 ; ls rootfs-*.gz 2> /dev/null ) | \
125 sed 's/rootfs-\(.*\).gz/\1/' | while read flavor; do
126 [ -f 1.0/$flavor.cfg ] && continue
127 cp 1.0/core.cfg 1.0/$flavor.cfg
128 sed -i -e "s/core-common/$flavor-common/" \
129 -e "s/rootfs.gz/rootfs-$flavor.gz/" 1.0/$flavor.cfg
130 directlinks 1.0 $flavor
131 done
132 directlinks 1.0 core
133 for flavor in $(cd 1.0; ls *.cfg | sed 's/.cfg//') ; do
134 echo -n " $flavor"
135 cat > 1.0/$flavor-common.cfg <<EOT
136 default slitaz
138 label def
139 config 1.0/$flavor.cfg
141 label reboot
142 com32 reboot.c32
144 implicit 0
145 prompt 1
146 timeout 80
147 F1 1.0/help.txt
148 F2 1.0/options.txt
149 F3 1.0/isolinux.msg
150 F4 1.0/display.txt
151 EOT
152 while read cfg kbd loc ; do
153 if [ ! -f 1.0/$cfg.kbd ]; then
154 echo ""
155 echo "Not found: 1.0/$cfg.kbd"
156 fi
157 sed -e "s/^display/KBDMAP 1.0\/$cfg.kbd\ndisplay/" \
158 -e "s/gz/gz lang=$loc kmap=$kbd/" \
159 < 1.0/$flavor.cfg > 1.0/$flavor-$cfg.cfg
160 cat >> 1.0/$flavor-common.cfg <<EOT
161 label $cfg
162 config 1.0/$flavor-$cfg.cfg
163 EOT
164 done <<EOT
165 be be fr
166 ca ca fr
167 de_CH fr_CH fr_CH
168 en en en
169 es es en
170 fr fr fr
171 fr_CH fr_CH fr_CH
172 it it en
173 us us en
174 EOT
175 done
176 status