3 # Simple helper script for upgrade target.
5 # Expects MACHINE to be passed in with the environment, the "pass number"
6 # as the first argument the name of the file to leave its droppings in
7 # as the second. CURDIR is also passed in the environment from ${.CURDIR}
9 # $DragonFly: src/tools/tools/upgrade/Attic/doupgrade.sh,v 1.2 2003/11/07 14:38:37 eirikn Exp $
14 cd ${CURDIR}/sys/${MACHINE}/conf
16 # Create kernel configuration file for pass #1
17 if [ $PASS -eq 1 ]; then
18 echo "The following files are in ${CURDIR}/sys/${MACHINE}/conf:"; echo
20 echo; echo -n "Which config file do you wish to use? [GENERIC] "
22 if [ -z "${answer}" ]; then
27 if [ ! -f ${KERN} ]; then
30 if ! grep -q atkbdc0 ${KERN}; then
31 if [ ! -f ${KERN}.bkup ]; then
32 cp ${KERN} ${KERN}.bkup
34 sed -e 's/^device.*sc0.*$/ \
35 controller atkbdc0 at isa? port IO_KBD tty \
36 device atkbd0 at isa? tty irq 1 \
37 device vga0 at isa? port ? conflicts \
38 device sc0 at isa? tty \
39 pseudo-device splash \
40 /' -e 's/sd\([0-9]\)/da\1/' -e 's/st\([0-9]\)/sa\1/' < ${KERN}.bkup > ${KERN}
43 ROOTDEV=`awk '$2~/\/$/{print substr($1, 6, 3)}' /etc/fstab`
44 echo -n "What is your boot device (e.g. wd0 or sd0)? [${ROOTDEV}] "
46 if [ -n "${answer}" ]; then
49 echo "KERNEL=${KERN}" > ${CONF}
50 echo "ROOTDEV=${ROOTDEV}" >> ${CONF}
51 if ! file /kernel | grep -q ELF; then
52 echo "NEWBOOT=YES" >> ${CONF}
56 # Build and install kernel as pass #2
57 if [ $PASS -eq 2 -a -f ${CONF} ]; then
59 if [ "x${NEWBOOT}" = "xYES" ]; then
60 echo "--------------------------------------------------------------"
61 echo " Installing new boot blocks"
62 echo "--------------------------------------------------------------"
63 if [ ! -f /boot/loader ]; then
64 (cd ${CURDIR}/lib/libstand; make obj; make -B depend all install)
65 (cd ${CURDIR}/sys/boot; make obj; make -B depend all install)
67 if ! disklabel -B ${ROOTDEV}; then
68 echo "Installation of new boot blocks failed! Please correct"
69 echo "this manually BEFORE you reboot your system!"
73 if ! file /kernel | grep -q ELF; then
74 echo "--------------------------------------------------------------"
75 echo " Building an elf kernel for ${KERNEL} using the new tools"
76 echo "--------------------------------------------------------------"
78 cd ${CURDIR}/sys/compile/${KERNEL} && make -B depend -DFORCE all install