Revision | 9e166de2aebdecc84b8bbf1754c61e278508dc46 (tree) |
---|---|
Time | 2023-01-12 20:19:47 |
Author | phabrics <phabrics@phab...> |
Commiter | phabrics |
More consistent, fine-grained control over downloading of individual files rather than entire directory trees.
@@ -30,40 +30,55 @@ | ||
30 | 30 | # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
31 | 31 | # POSSIBILITY OF SUCH DAMAGE. |
32 | 32 | |
33 | +# Default values of various locations to download from/to. | |
34 | + | |
33 | 35 | # Firmware downloads for various machines |
36 | +firmware_root=./sun-fw | |
34 | 37 | firmware_site=https://people.csail.mit.edu/~fredette/tme |
35 | 38 | firmwares="sun2-multi-rev-R sun3-carrera-rev-3.0 sun4-75-rev-2.9 SUNW,501-1415 SUNW,501-1561 SUNW,501-2325 SUNW,501-3082-update7" |
36 | 39 | |
37 | 40 | # NetBSD location/release to download |
38 | -netbsd_site=https://cdn.netbsd.org | |
41 | +netbsd_root=./NetBSD | |
42 | +netbsd_site=https://cdn.netbsd.org/pub/NetBSD | |
39 | 43 | netbsd_rel=9.3 |
40 | 44 | |
45 | +# NetBSD binary sets to install via tape | |
46 | +# Remember, skip "etc" for an upgrade. | |
47 | +netbsd_sets="etc base comp games man misc rescue text kern-GENERIC" | |
48 | + | |
49 | +# The command to use for downloading files | |
50 | +download_cmd() { | |
51 | + [ -f $2 ] || wget -np -r -nH --cut-dirs=2 $1/$2 | |
52 | +} | |
53 | + | |
41 | 54 | # Download the firmware for each machine type, if needed |
42 | -if [ ! -d "sun-fw" ]; then | |
43 | - mkdir sun-fw | |
44 | - cd sun-fw | |
45 | - for fw in $firmwares; do | |
46 | - wget $firmware_site/$fw.bin | |
47 | - done | |
48 | - cd .. | |
49 | -fi | |
55 | +mkdir -p $firmware_root | |
56 | +cd $firmware_root | |
57 | +for fw in $firmwares; do | |
58 | + download_cmd $firmware_site $fw.bin | |
59 | +done | |
60 | +cd - | |
50 | 61 | |
51 | -# Mirror arch-specific NetBSD install files | |
62 | +mkdir -p $netbsd_root | |
63 | +cd $netbsd_root | |
64 | +# Download arch-specific NetBSD install files | |
52 | 65 | for arch in {sun2,sun3}; do |
53 | - netbsd_path=NetBSD/NetBSD-$netbsd_rel/$arch | |
66 | + netbsd_path=NetBSD-$netbsd_rel/$arch | |
54 | 67 | # Only download if necessary |
55 | - if [ ! -d "$netbsd_path" ]; then | |
56 | - wget -R "*.html" -np -r -nH --cut-dirs=1 $netbsd_site/pub/$netbsd_path | |
57 | - fi | |
68 | + download_cmd $netbsd_site $netbsd_path/installation/tapeimage/tapeboot | |
69 | + download_cmd $netbsd_site $netbsd_path/installation/miniroot/miniroot.fs.gz | |
70 | + download_cmd $netbsd_site $netbsd_path/binary/kernel/netbsd-RAMDISK.gz | |
71 | + for f in $netbsd_sets; do | |
72 | + download_cmd $netbsd_site $netbsd_path/binary/sets/${f}.tgz | |
73 | + done | |
74 | + [ $arch = "sun2" ] && download_cmd $netbsd_site $netbsd_path/binary/sets/kern-FOURMEG.tgz | |
58 | 75 | done |
59 | 76 | |
60 | 77 | for arch in {sparc,sparc64}; do |
61 | - netbsd_path=NetBSD/images/$netbsd_rel/NetBSD-$netbsd_rel-$arch.iso | |
62 | 78 | # Only download if necessary |
63 | - if [ ! -f "$netbsd_path" ]; then | |
64 | - wget -np -r -nH --cut-dirs=1 $netbsd_site/pub/$netbsd_path | |
65 | - fi | |
79 | + download_cmd $netbsd_site images/$netbsd_rel/NetBSD-$netbsd_rel-$arch.iso | |
66 | 80 | done |
81 | +cd - | |
67 | 82 | |
68 | 83 | # First, try to find installed location of tme |
69 | 84 | if [ -z ${MINGW_PREFIX+set} ]; then |
@@ -89,59 +104,61 @@ for mach in `ls $loc/SUN*`; do | ||
89 | 104 | fi |
90 | 105 | done |
91 | 106 | |
92 | -# Remember, skip "etc" for an upgrade. | |
93 | -sets="etc base comp games man misc rescue text" | |
107 | +# Replace with absolute pathnames to avoid symlink issues | |
108 | +firmware_root=$(realpath $firmware_root) | |
109 | +netbsd_root=$(realpath $netbsd_root) | |
94 | 110 | |
95 | 111 | # Finally, set up the links to the NetBSD installation files and device configuration |
96 | 112 | for arch in {sun2,sun3,sun4,sun-ultra}; do |
97 | - netbsd_path=NetBSD/NetBSD-$netbsd_rel/$arch | |
98 | - netbsd_iso=NetBSD/images/$netbsd_rel/NetBSD-$netbsd_rel-sparc | |
113 | + netbsd_path=$netbsd_root/NetBSD-$netbsd_rel/$arch | |
114 | + netbsd_iso=$netbsd_root/images/$netbsd_rel/NetBSD-$netbsd_rel-sparc | |
99 | 115 | netbsd=netbsd-$arch |
100 | 116 | prom=my-$arch-eeprom.bin |
101 | 117 | for machd in `ls -d $arch-*/`; do |
102 | 118 | cd $machd |
103 | 119 | echo "Making $machd" |
104 | 120 | if [ $arch = "sun4" ]; then |
105 | - [ -d ../sun-fw ] && ln -sf ../sun-fw/$arch* . | |
106 | - [ -d ../sun-fw ] && ln -sf ../sun-fw/SUNW,501-1* . | |
107 | - [ -f "../${netbsd_iso}.iso" ] && ln -sf "../${netbsd_iso}.iso" $netbsd.iso | |
121 | + [ -d $firmware_root ] && ln -sf $firmware_root/$arch* . | |
122 | + [ -d $firmware_root ] && ln -sf $firmware_root/SUNW,501-1* . | |
123 | + [ -f "${netbsd_iso}.iso" ] && ln -sf "${netbsd_iso}.iso" $netbsd.iso | |
108 | 124 | macht="SS2" |
109 | 125 | cnt=2008 |
110 | 126 | arch+=c |
111 | 127 | prom=my-$arch-nvram.bin |
112 | 128 | sz=10G |
113 | 129 | elif [ $arch = "sun-ultra" ]; then |
114 | - [ -d ../sun-fw ] && ln -sf ../sun-fw/SUNW* . | |
115 | - [ -f "../${netbsd_iso}64.iso" ] && ln -sf "../${netbsd_iso}64.iso" $netbsd.iso | |
130 | + [ -d $firmware_root ] && ln -sf $firmware_root/SUNW* . | |
131 | + [ -f "${netbsd_iso}64.iso" ] && ln -sf "${netbsd_iso}64.iso" $netbsd.iso | |
116 | 132 | cnt=8176 |
117 | 133 | arch=sun4u |
118 | 134 | prom=my-$arch-nvram.bin |
119 | 135 | sz=10G |
120 | 136 | else |
121 | - if [ -d "../$netbsd_path" ] && [ ! -d "$netbsd.tape" ]; then | |
122 | - [ -d ../sun-fw ] && ln -sf ../sun-fw/$arch* . | |
137 | + if [ -d "$netbsd_path" ] && [ ! -d "$netbsd.tape" ]; then | |
138 | + [ -d $firmware_root ] && ln -sf $firmware_root/$arch* . | |
123 | 139 | mkdir $netbsd.tape |
124 | 140 | cd $netbsd.tape |
125 | - ln -s ../../$netbsd_path/installation/tapeimage/tapeboot 01 | |
141 | + ln -s $netbsd_path/installation/tapeimage/tapeboot 01 | |
126 | 142 | touch 02 03 |
127 | - gzip -c -d ../../$netbsd_path/installation/miniroot/miniroot.fs.gz > 04 | |
128 | - gzip -c -d ../../$netbsd_path/binary/kernel/netbsd-RAMDISK.gz > 05 | |
143 | + gzip -c -d $netbsd_path/installation/miniroot/miniroot.fs.gz > 04 | |
144 | + gzip -c -d $netbsd_path/binary/kernel/netbsd-RAMDISK.gz > 05 | |
129 | 145 | if [ $arch = "sun3" ]; then |
130 | 146 | mv 05 02 |
131 | 147 | i=5 |
132 | 148 | else |
133 | 149 | i=6 |
134 | 150 | fi |
135 | - for f in $sets; do | |
151 | + for f in $netbsd_sets; do | |
136 | 152 | j=`printf %02d $i` |
137 | - gzip -c -d ../../$netbsd_path/binary/sets/${f}.tgz > $j | |
153 | + gzip -c -d $netbsd_path/binary/sets/${f}.tgz > $j | |
138 | 154 | ((i+=1)) |
139 | 155 | done |
156 | + [ $arch = "sun2" ] && gzip -c -d $netbsd_path/binary/sets/kern-FOURMEG.tgz > $j | |
140 | 157 | cd .. |
141 | 158 | fi |
142 | 159 | if [ $arch = "sun3" ]; then |
143 | 160 | macht="3/150" |
144 | - [ -f $prom ] || tme-sun-eeprom < $(basename $machd)-eeprom.txt > $prom | |
161 | + [ -f $prom ] || ${MINGW_CHOST}${MINGW_CHOST+-}tme-sun-eeprom < $(basename $machd)-eeprom.txt > $prom | |
145 | 162 | else |
146 | 163 | macht="2/120" |
147 | 164 | fi |
@@ -154,7 +171,7 @@ for arch in {sun2,sun3,sun4,sun-ultra}; do | ||
154 | 171 | if [ $arch != "sun4u" ]; then |
155 | 172 | macaddr=`printf 8:0:20:%02X:%02X:%02X $[RANDOM%256] $[RANDOM%256] $[RANDOM%256]` |
156 | 173 | echo "$macht $macaddr" |
157 | - tme-sun-idprom $macht $macaddr >> $prom | |
174 | + ${MINGW_CHOST}${MINGW_CHOST+-}tme-sun-idprom $macht $macaddr >> $prom | |
158 | 175 | fi |
159 | 176 | fi |
160 | 177 | [ -f my-$arch-disk.img ] || dd if=/dev/zero of=my-$arch-disk.img bs=1 count=1 seek=$sz |