ash: default to an editing mode
[minix.git] / releasetools / release.functions
blob7f83c252b09924195832708c78525f1d4f3ffdb9
2 make_hdimage()
4         dd if=$TMPDISKUSR of=usrimage bs=$BS count=$USRBLOCKS
6         rootsize=`stat -f %z rootimage`
7         usrsize=`stat -f %z usrimage`
9         rootsects=`expr $rootsize / 512`
10         usrsects=`expr $usrsize / 512`
12         # installboot -m needs at least 1KB 
13         dd < /dev/zero >tmpimage count=2
14         partition -fm tmpimage 2 81:$rootsects* 0:0 81:$usrsects
15         installboot_nbsd -m tmpimage /usr/mdec/mbr
16         dd < tmpimage > subpart count=1
18         primsects=`expr 1 + $rootsects + $usrsects`
19         cyl=`expr '(' $primsects ')' / $secs + 1`
20         padsects=`expr $cyl \* $secs - 1 - $primsects`
22         { dd < /dev/zero count=1
23                 cat subpart
24                 cat rootimage
25                 cat usrimage
26                 dd < /dev/zero count=$padsects
27         } > hdimage
28         partition -m hdimage 81:`expr $primsects + $padsects`*
29         installboot_nbsd -m hdimage /usr/mdec/mbr
32 retrieve()
34         dir=$1
35         list=`pwd`/$2
36         URLS=""
37         echo "Retrieving packages form $PACKAGEURL"
38         (
39         cd $dir || exit 1
40         SUMMARY=pkg_summary
41         rm -f pkg_summary* || true
42         fetch $PACKAGEURL/$SUMMARY.bz2
43         bzip2 -d $SUMMARY.bz2
44         cat $list | while read name
45         do      pkgname="`fgrep PKGNAME=${name} $SUMMARY | sed 's/PKGNAME=//g'`"
46                 if [ `echo $pkgname | wc -w` -ne 1 ]
47                 then    echo " *** Could not resolve $name (not found or too many matches: $pkgname) ***"
48                 else    echo Getting $pkgname
49                         fetch -r ${PACKAGEURL}/${pkgname}.tgz
50                 fi
51                 echo -n "."
52         done
53         )
54         echo done
57 cd_root_changes()
59 cat >$CDFILES/boot.cfg <<END_BOOT_CFG
60 banner=Welcome to the MINIX 3 installation CD
61 banner================================================================================
62 banner=
63 menu=Regular MINIX 3:multiboot /kernel bootcd=1 cdproberoot=1 rootdevname=ram disable=inet
64 menu=Regular MINIX 3 (with AHCI):multiboot /kernel bootcd=1 cdproberoot=1 rootdevname=ram disable=inet ahci=yes
65 menu=Edit menu option:edit
66 menu=Drop to boot prompt:prompt
67 clear=1
68 timeout=10
69 default=1
70 load=/mod01_ds
71 load=/mod02_rs
72 load=/mod03_pm
73 load=/mod04_sched
74 load=/mod05_vfs
75 load=/mod06_memory
76 load=/mod07_log
77 load=/mod08_tty
78 load=/mod09_mfs
79 load=/mod10_vm
80 load=/mod11_pfs
81 load=/mod12_init
82 # This space intentionally left blank - leave to appease bootloader!
83 # This space intentionally left blank - leave to appease bootloader!
84 # This space intentionally left blank - leave to appease bootloader!
85 # This space intentionally left blank - leave to appease bootloader!
86 # This space intentionally left blank - leave to appease bootloader!
87 # This space intentionally left blank - leave to appease bootloader!
88 # This space intentionally left blank - leave to appease bootloader!
89 # This space intentionally left blank - leave to appease bootloader!
90 # This space intentionally left blank - leave to appease bootloader!
91 # This space intentionally left blank - leave to appease bootloader!
92 # This space intentionally left blank - leave to appease bootloader!
93 # This space intentionally left blank - leave to appease bootloader!
94 # This space intentionally left blank - leave to appease bootloader!
95 # This space intentionally left blank - leave to appease bootloader!
96 # This space intentionally left blank - leave to appease bootloader!
97 # This space intentionally left blank - leave to appease bootloader!
98 # This space intentionally left blank - leave to appease bootloader!
99 # This space intentionally left blank - leave to appease bootloader!
100 END_BOOT_CFG
104 hdemu_root_changes()
106         $RELEASEDIR/usr/sbin/installboot_nbsd $TMPDISKROOT \
107                 $RELEASEDIR/usr/mdec/bootxx_minixfs3
109 cat >$RELEASEMNTDIR/boot.cfg <<END_BOOT_CFG
110 menu=Regular MINIX 3:load_mods /boot/minix_default/mod*;multiboot /boot/minix_default/kernel bootcd=2 disable=inet bios_wini=yes bios_remap_first=1 ramimagedev=c0d7p0s0
111 menu=Edit menu option:edit
112 menu=Drop to boot prompt:prompt
113 clear=1
114 timeout=10
115 default=1
116 END_BOOT_CFG
119 usb_root_changes()
121         $RELEASEDIR/usr/sbin/installboot_nbsd $TMPDISKROOT \
122                 $RELEASEDIR/usr/mdec/bootxx_minixfs3
123         echo \
124 cat >$RELEASEMNTDIR/boot.cfg <<END_BOOT_CFG
125 menu=Regular MINIX 3:load_mods /boot/minix_default/mod*;multiboot /boot/minix_default/kernel bios_wini=yes bios_remap_first=1 rootdevname=c0d7p0s0
126 menu=Edit menu option:edit
127 menu=Drop to boot prompt:prompt
128 clear=1
129 timeout=10
130 default=1
131 END_BOOT_CFG
134 copy_local_packages()
136         if [ -d $PACKAGEDIR -a -f $PACKAGELIST -a $PACKAGES -ne 0 ]
137         then
138                 index=pkg_summary
139                 indexpath=$PACKAGEDIR/.index
140         
141                 if [ ! -d $indexpath ]
142                 then    mkdir $indexpath
143                 fi
144                 if [ ! -d $indexpath ]
145                 then    echo "Couldn't create $indexpath."
146                         exit 1
147                 fi
148         
149                 echo "" >$PACKAGEDIR/All/$index
150         
151                 echo " * Transfering $PACKAGEDIR to $RELEASEPACKAGE"
152                 for pkgprefix in `cat $PACKAGELIST`
153                 do      realfn="`echo $PACKAGEDIR/All/${pkgprefix}*.tgz`"
154                         if [ -f "$realfn" ]
155                        then
156                           # Copy package and create package's index
157                           (
158                               p="`basename $realfn`"
159                               cd $PACKAGEDIR/All
160                               cp $p $RELEASEPACKAGE/
161         
162                               indexname=$indexpath/$p.$index
163                               pkg_info -X $p >$indexname
164         
165                               if [ ! -f $indexname ]
166                               then      echo Missing $indexname.
167                                   exit 1
168                               fi
169         
170                               if [ "`wc -l $indexname`" -lt 3 ]
171                               then      $indexname is too short.
172                                   rm $indexname
173                                   exit 1
174                               fi
175         
176                               cat $indexname >>$PACKAGEDIR/All/$index
177                           )
178                        else
179                           echo "Can't find $pkgprefix Missing."
180                        fi
181                 done
182         
183                 bzip2 -f $PACKAGEDIR/All/$index
184                 cp $PACKAGEDIR/All/$index.bz2 $RELEASEPACKAGE/
185         fi
188 fitfs()
190         path="$1"
191         ramdisk="$2"
192         extra_inodes="$3"
193         extra_zones="$4"
194         mbsdefault="$5"
196         # Determine number of inodes
197         inodes=`find $path | egrep -v ^$path/usr | wc -l`
198         inodes="`expr $inodes + $extra_inodes`"
200         # Determine number of data zones
201         zonekbs=`du -ks $path | cut -d' ' -f1`
202         zonekbsignore=0
203         [ ! -d $path/usr ] || zonekbsignore=`du -ks $path/usr | cut -d" " -f1`
204         zones="`expr \( $zonekbs - $zonekbsignore \) / \( $BS / 1024 \) + $extra_zones`"
206         # Determine file system size
207         BSBITS="`expr $BS \* 8`"
208         imap_blocks="`expr \( $inodes + $BSBITS - 1 \) / $BSBITS`"
209         inode_blocks="`expr \( $inodes \* 64 + $BS - 1 \) / $BS`"
210         zmap_blocks="`expr \( $zones + $BSBITS - 1 \) / $BSBITS`"
211         blocks="`expr 1 + 1 + $imap_blocks + $zmap_blocks + $inode_blocks + $zones`"
212         kbs="`expr $blocks \* \( $BS / 1024 \)`"
214         # Apply default if higher
215         if [ -n "$mbsdefault" ]
216         then
217                 kbsdefault="`expr $mbsdefault \* 1024`"
218                 if [ "$kbs" -lt "$kbsdefault" ]
219                 then kbs=$kbsdefault
220                 else echo "warning: ${mbsdefault}mb is too small, using ${kbs}kb"
221                 fi
222         fi
224         # Create a filesystem on the target ramdisk
225         ramdisk $kbs $ramdisk
226         mkfs.mfs -B $BS -i $inodes $ramdisk