source: mainline/contrib/util/DownloadAndPatchSILO.sh@ 86018c1

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 86018c1 was 965dc18, checked in by Jakub Jermar <jakub@…>, 17 years ago

Merge sparc branch to trunk.

  • Property mode set to 100755
File size: 2.1 KB
Line 
1#!/bin/bash
2
3# Download SILO and patch it so that it can be used to create a bootable CD
4# for the Serengeti machine
5# by Pavel Rimsky <rimskyp@seznam.cz>
6# portions by Martin Decky <martin@decky.cz>
7#
8# GPL'ed, copyleft
9#
10
11# stuff to be downloaded
12SILO_DOWNLOAD_FILE='silo-loaders-1.4.11.tar.gz'
13SILO_DOWNLOAD_URL='http://silo.auxio.org/pub/silo/old/'$SILO_DOWNLOAD_FILE
14
15# check whether the last command failed, if so, write an error message and exit
16check_error() {
17 if [ "$1" -ne "0" ]; then
18 echo
19 echo "Script failed: $2"
20 exit
21 fi
22}
23
24# temporary files are to be stored in /tmp
25# the resulting file in the current directory
26WD=`pwd`
27cd /tmp
28
29# download SILO from its official website
30echo ">>> Downloading SILO"
31wget $SILO_DOWNLOAD_URL
32check_error $? "Error downloading SILO."
33
34# unpack the downloaded file
35echo ">>> Unpacking tarball"
36tar xvzf $SILO_DOWNLOAD_FILE
37check_error $? "Error unpacking tarball."
38
39# CD to the unpacked directory
40echo ">>> Changing to the unpacked SILO directory"
41cd boot
42check_error $? "Changing directory failed."
43
44# patch it - remove bytes 512 to 512 + 32 (counted from 0), which belong to
45# the ELF header which is not recognized by the Serengeti firmware
46echo ">>> Patching SILO"
47(((xxd -p -l 512 isofs.b) && (xxd -p -s 544 isofs.b)) | xxd -r -p) \
48 > isofs.b.patched
49check_error $? "Patching SILO failed"
50mv isofs.b.patched isofs.b
51
52# get rid of files which are not needed for creating the bootable CD
53echo ">>> Purging SILO directory"
54for file in `ls`; do
55 if [ \( -f $file \) -a \( $file != "isofs.b" \) -a \( $file != "second.b" \) ];
56 then
57 rm -fr $file;
58 fi
59done
60check_error $? "Purging SILO directory failed"
61
62# create the gzipped tarball with patched SILO
63echo ">>> Creating tarball with patched SILO"
64tar cvzf silo.patched.tar.gz *.b
65check_error $? "Creating tarball with patched SILO failed"
66
67# and move it to the directory where the user expects it to be
68echo ">>> Moving the tarball with patched SILO to the current directory"
69mv silo.patched.tar.gz $WD
70check_error $? "Moving the tarball with patched SILO failed"
71
72# move back to the working directory from /tmp
73cd $WD
74
Note: See TracBrowser for help on using the repository browser.