-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakeSUSE
More file actions
executable file
·440 lines (410 loc) · 12.3 KB
/
makeSUSE
File metadata and controls
executable file
·440 lines (410 loc) · 12.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
#!/bin/bash
#set -x
#This script written for create ISO SUSE LINUX modded with autoyast and isolinux.cfg
################################################### VARIABLES ##############################################
diri=/mnt/linux
out=/home/
loa=/var/tmp/linux/boot/x86_64/loader
raiz=/var/tmp/linux
pkg=/home/$USER/SIPA/
############################################################################################################
#### Check root user ####
if [[ $EUID -ne 0 ]]; then
clear
echo
echo
echo
echo
echo
echo "I'm sorry you are not magical user, call me god and have your power" 2>&1
echo
echo
echo
echo
echo
exit 1
elif [ "$1" == "usbsimple" ]; then
mkdir -p $diri
echo "Escribe la ruta y nombre de la iso ej: /home/SLE-12-SP2.iso (case sensitive)"
read iso
clear
echo "Escribe la ruta donde se encuentra el autoyast"
read yast
clear
mount -o loop $iso $diri
cd /mnt/
tar -cf - linux | (cd /var/tmp/ && tar -xf - )
cd $loa
chmod 777 /var/tmp/linux
chmod +w isolinux.cfg
cp $yast $raiz/usb.xml
cat > /tmp/isolinux.cfg << "EOF"
default Install SIPA Linux
# hard disk
label harddisk
localboot 0x80
# install
label Install SIPA Linux
kernel linux
append initrd=initrd showopts splash=silent autoyast=usb:///usb.xml language=es_ES keytable=es
# repair
label repair
kernel linux
append initrd=initrd splash=silent repair=1 showopts
# rescue
label rescue
kernel linux
append initrd=initrd splash=silent rescue=1 showopts
# mediacheck
label mediachk
kernel linux
append initrd=initrd splash=silent mediacheck=1 showopts
# memory test
label memtest
kernel memtest
ui gfxboot bootlogo message
implicit 1
prompt 1
timeout 600
EOF
cp /tmp/isolinux.cfg $loa/
clear
echo "Creando la ISO ... Wait a minit"
mkisofs -J -allow-lowercase -allow-multidot -o $HOME/usbsimple-`date +%d.%m.%Y`.iso -b boot/x86_64/loader/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table /var/tmp/linux 2>/dev/null
sleep 5
cd $HOME
isohybrid usbsimple-`date +%d.%m.%Y`.iso
clear
ls -h --full-time $HOME/usbsimple-`date +%d.%m.%Y`.iso | awk $'{print $5, $9}'
umount /mnt/linux
rm -rf /var/tmp/linux
clear
echo "Ya he terminado, pero ... ¿Quieres grabar la iso en un USB?"
echo "Escribe yes para grabar o NO para finalizar"
read quehago
if [ $quehago = yes ]
then
clear
echo
echo "Estos son los dispositivos de almacenamiento conectados"
lsblk | awk '{print $1, $4}'
echo
echo
echo "Elige un dispositivo para grabar la iso en el"
read dispositivo
clear
echo "Grabando la iso en el USB seleccionado: $dispositivo"
dd if=$HOME/usbsimple-`date +%d.%m.%Y`.iso of=/dev/$dispositivo bs=4M status=progress
elif [ $quehago = no ]
then
exit
fi
#This option create a bootable USB with only boot files and route to server with contain autoyast.xml and packets repo
elif [ "$1" == "fullusb" ]; then
mkdir -p $diri
echo "Escribe la ruta y nombre de la iso ej: /home/SLE-12-SP2.iso (case sensitive)"
read iso
clear
mount -o loop $iso $diri
cd /mnt/
tar -cf - linux | (cd /var/tmp/ && tar -xf - )
cd $loa
chmod 777 /var/tmp/linux
chmod +w isolinux.cfg
cat > /tmp/isolinux.cfg << "EOF"
default Install SIPA Linux
# hard disk
label harddisk
localboot 0x80
# install
label Install SIPA Linux
kernel linux
append initrd=initrd showopts splash=silent autoyast=usb:///usb.xml language=es_ES keytable=es
# repair
label repair
kernel linux
append initrd=initrd splash=silent repair=1 showopts
# rescue
label rescue
kernel linux
append initrd=initrd splash=silent rescue=1 showopts
# mediacheck
label mediachk
kernel linux
append initrd=initrd splash=silent mediacheck=1 showopts
# memory test
label memtest
kernel memtest
ui gfxboot bootlogo message
implicit 1
prompt 1
timeout 600
EOF
echo
echo
clear
clear
cp /tmp/isolinux.cfg $loa/
echo $HOME
cp $HOME/usb.xml $raiz/usb.xml
cd /var/tmp/linux
mkdir SIPA
cp $HOME/SIPA/*.rpm /var/tmp/linux/SIPA
cp $HOME/SIPA/*.sh /var/tmp/linux/SIPA
echo "Estos son los paquetes SIPA"
echo
echo
cd /var/tmp/linux/SIPA
du -sch *
echo
echo
echo "Se instalaran DESPUES del sistema"
sleep 5
mkisofs -J -allow-lowercase -allow-multidot -max-iso9660-filenames -l -o $HOME/Fullusb-`date +%d.%m.%Y`.iso -b boot/x86_64/loader/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table /var/tmp/linux 2>/dev/null
sleep 5
cd $HOME
isohybrid Fullusb-`date +%d.%m.%Y`.iso
clear
ls -h --full-time $HOME/Fullusb-`date +%d.%m.%Y`.iso | awk $'{print $5, $9}'
umount /mnt/linux
rm -rf /var/tmp/linux
clear
echo "Ya he terminado, pero ... ¿Quieres grabar la iso en un USB?"
echo "Escribe yes para grabar o NO para finalizar"
read quehago
if [ $quehago = yes ]
then
clear
echo
echo "Estos son los dispositivos de almacenamiento conectados"
lsblk | awk '{print $1, $4}'
echo
echo
echo "Elige un dispositivo para grabar la iso en el"
read dispositivo
clear
echo "Grabando la iso en el USB seleccionado: $dispositivo"
dd if=$HOME/Fullusb-`date +%d.%m.%Y`.iso of=/dev/$dispositivo bs=4M status=progress
elif [ $quehago = no ]
then
exit
fi
#Function PXE generate iso with size is 73MB only contain boot for foce PXE install. This method download system from repo and obtain IP with DHCP.
elif [ "$1" == "autopxe" ]; then
mkdir -p $diri
clear
echo "Escribe la ruta y nombre de la iso ej: /home/SLE-12-SP2.iso (case sensitive)"
read iso
clear
mount -o loop $iso $diri
cd /mnt/
tar -cf - linux | (cd /var/tmp/ && tar -xf - )
cd $loa
chmod +w isolinux.cfg
cat > /tmp/isolinux.cfg << "EOF"
default harddisk
# hard disk
label harddisk
localboot 0x80
# install
label Install SIPA Linux
kernel linux
append initrd=initrd showopts splash=silent ifcfg=eth*=dhcp install=cambiame1 autoyast=cambiame2 language=es_ES keytable=es
# repair
label repair
kernel linux
append initrd=initrd splash=silent repair=1 showopts
# rescue
label rescue
kernel linux
append initrd=initrd splash=silent rescue=1 showopts
# mediacheck
label mediachk
kernel linux
append initrd=initrd splash=silent mediacheck=1 showopts
# memory test
label memtest
kernel memtest
ui gfxboot bootlogo message
implicit 1
prompt 1
timeout 600
EOF
echo "Dime la ruta del repositorio donde esta la paqueteria, ej; http://192.168.1.1/iso (La ruta completa por favor)"
read repo
clear
echo "Ahora dime la ruta del autoyast en el repositorio ej: http://192.168.1.1/autoyast.xml (La ruta completa por favor)"
read auto
clear
echo $repo
echo $auto
sed "s|cambiame1|${repo}|g" /tmp/isolinux.cfg > /tmp/isolinuxvar1
sed "s|cambiame2|${auto}|g" /tmp/isolinuxvar1 > /tmp/isolinux.cfg
cp /tmp/isolinux.cfg $loa/isolinux.cfg
rm -rf /tmp/isolinux*
clear
echo "Eliminando contenido no necesario para el preboot usb"
cd /var/tmp/linux
rm -rf ChangeLog COPYRIGHT COPYRIGHT.de docu NEWS README suse
clear
echo "Lo que viene ahora dara un error, pero es normal"
cd /var/tmp/linux/boot/x86_64
sudo rm *
echo "No te preocupes, en serio, no es necesario"
clear
cp /mnt/linux/boot/x86_64/yast2-trans-en* .
cp /mnt/linux/boot/x86_64/yast2-trans-es* .
cd $loa
rm -rf *.tr
rm -rf *.hlp
cp /mnt/linux/boot/x86_64/loader/en.hlp .
cp /mnt/linux/boot/x86_64/loader/en.* .
cp /mnt/linux/boot/x86_64/loader/es.* .
cd /var/tmp/linux
mkisofs -J -allow-lowercase -allow-multidot -o $HOME/autopxe-`date +%d.%m.%Y`.iso -b boot/x86_64/loader/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table /var/tmp/linux 2>/dev/null
sleep 5
cd $HOME
isohybrid autopxe-`date +%d.%m.%Y`.iso
ls -h --full-time $HOME/autopxe-`date +%d.%m.%Y`.iso | awk $'{print $5, $9}'
umount /mnt/linux
rm -rf /var/tmp/linux
clear
echo "Ya he terminado, pero ... ¿Quieres grabar la iso en un USB?"
echo "Escribe yes para grabar o NO para finalizar"
read quehago
if [ $quehago = yes ]
then
clear
echo
echo "Estos son los dispositivos de almacenamiento conectados"
lsblk | awk '{print $1, $4}'
echo
echo
echo "Elige un dispositivo para grabar la iso en el"
read dispositivo
clear
echo "Grabando la iso en el USB seleccionado: $dispositivo"
dd if=$HOME/autopxe-`date +%d.%m.%Y`.iso of=/dev/$dispositivo bs=4M status=progress
elif [ $quehago = no ]
then
exit
fi
#Function PXE generate iso with size is 73MB only contain boot for foce PXE install. This method download system from repo and obtain IP with DHCP.
elif [ "$1" == "statpxe" ]; then
mkdir -p $diri
clear
echo "Escribe la ruta y nombre de la iso ej: /home/SLE-12-SP2.iso (case sensitive)"
read iso
clear
mount -o loop $iso $diri
cd /mnt/
tar -cf - linux | (cd /var/tmp/ && tar -xf - )
cd $loa
chmod +w isolinux.cfg
cat > /tmp/isolinux.cfg << "EOF"
default harddisk
# hard disk
label harddisk
localboot 0x80
# install
label Install SIPA Linux
kernel linux
append initrd=initrd showopts splash=silent ifcfg=eth0=cambiame1 install=cambiame2 autoyast=cambiame3 language=es_ES keytable=es
# repair
label repair
kernel linux
append initrd=initrd splash=silent repair=1 showopts
# rescue
label rescue
kernel linux
append initrd=initrd splash=silent rescue=1 showopts
# mediacheck
label mediachk
kernel linux
append initrd=initrd splash=silent mediacheck=1 showopts
# memory test
label memtest
kernel memtest
ui gfxboot bootlogo message
implicit 1
prompt 1
timeout 600
EOF
echo "Dime la ruta del repositorio donde esta la paqueteria, ej; http://192.168.1.1/iso (La ruta completa por favor)"
read repo
clear
echo "Ahora dime la ruta del autoyast en el repositorio ej: http://192.168.1.1/autoyast.xml (La ruta completa por favor)"
read auto
clear
echo "Dime la IP de la CTS"
read ip
clear
echo $ip
echo $repo
echo $auto
sed "s|cambiame1|${ip}|g" /tmp/isolinux.cfg > /tmp/isolinuxvar
sed "s|cambiame2|${repo}|g" /tmp/isolinuxvar > /tmp/isolinuxvar1
sed "s|cambiame3|${auto}|g" /tmp/isolinuxvar1 > /tmp/isolinux.cfg
cp /tmp/isolinux.cfg $loa/isolinux.cfg
rm -rf /tmp/isolinux*
clear
echo "Eliminando contenido no necesario para el preboot usb"
cd /var/tmp/linux
rm -rf ChangeLog COPYRIGHT COPYRIGHT.de docu NEWS README suse
clear
echo "Lo que viene ahora dara un error, pero es normal"
cd /var/tmp/linux/boot/x86_64
sudo rm *
echo "No te preocupes, en serio, no es necesario"
clear
cp /mnt/linux/boot/x86_64/yast2-trans-en* .
cp /mnt/linux/boot/x86_64/yast2-trans-es* .
cd $loa
rm -rf *.tr
rm -rf *.hlp
cp /mnt/linux/boot/x86_64/loader/en.hlp .
cp /mnt/linux/boot/x86_64/loader/en.* .
cp /mnt/linux/boot/x86_64/loader/es.* .
cd /var/tmp/linux
mkisofs -J -allow-lowercase -allow-multidot -o $HOME/statpxe-`date +%d.%m.%Y`.iso -b boot/x86_64/loader/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table /var/tmp/linux 2>/dev/null
sleep 5
cd $HOME
isohybrid statpxe-`date +%d.%m.%Y`.iso
ls -h --full-time $HOME/statpxe-`date +%d.%m.%Y`.iso | awk $'{print $5, $9}'
umount /mnt/linux
rm -rf /var/tmp/linux
clear
echo "Ya he terminado, pero ... ¿Quieres grabar la iso en un USB?"
echo "Escribe yes para grabar o NO para finalizar"
read quehago
if [ $quehago = yes ]
then
clear
echo
echo "Estos son los dispositivos de almacenamiento conectados"
lsblk | awk '{print $1, $4}'
echo
echo
echo "Elige un dispositivo para grabar la iso en el"
read dispositivo
clear
echo "Grabando la iso en el USB seleccionado: $dispositivo"
dd if=$HOME/statpxe-`date +%d.%m.%Y`.iso of=/dev/$dispositivo bs=4M status=progress
elif [ $quehago = no ]
then
exit
fi
#If you need help.... type help :D
elif [ "$1" == "$1" ]; then
clear
echo ""
echo ""
echo "Bienvenido a la ayuda ... no hay mucho que decir"
echo "Este script a sido creado por Juanito, por que es bastante vago"
echo "Solo tiene 2 opciones + la ayuda ..."
echo "Escribe "./makeSIPA usbsimple" para realizar una ISO de SUSE con un isolinux.cfg modificado para instalar desde un USB SIN paqueteria de SIPA"
echo "Escribe "./makeSIPA fullusb" para realizar una ISO de SUSE con un isolinux.cfg modificado para instalar desde un USB con los paquetes de SIPA instalados"
echo "Escribe "./makeSIPA autopxe" para realizar una ISO con la configuracion base de PXE y realizar la instalacion del sistema a traves de un repositorio http mediante DHCP"
echo "Escribe "./makeSIPA statpxe" para realizar una ISO con la configuracion base de PXE para realizar la instalacion del sistema a traves de un repositorio http, la CTS tendra IP statica"
echo "Para crear la ISO se necesita ejecutar este script en un S.O Linux, con permisos de root"
fi