Annotation of openbsd/update_openbsd/update_openbsd, Revision 1.47
1.1 andrew 1: #!/bin/sh
1.47 ! andrew 2: # $AFresh1: update_openbsd,v 1.46 2012/12/16 03:29:02 andrew Exp $
1.41 andrew 3: #
4: # Copyright (c) 2012 Andrew Fresh <andrew@afresh1.com>
5: #
6: # Permission to use, copy, modify, and distribute this software for any
7: # purpose with or without fee is hereby granted, provided that the above
8: # copyright notice and this permission notice appear in all copies.
9: #
10: # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11: # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12: # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13: # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14: # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15: # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16: # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17: #
1.7 andrew 18:
1.2 andrew 19: installed_sets() {
1.5 andrew 20: local misc=/usr/share/doc/README
21: local man=/usr/share/man/cat1/intro.0
22: local comp=/usr/bin/cc
23: local game=/usr/games/
24: local xbase=/usr/X11R6/
25: local xetc=/etc/X11/xinit/xinitrc
26: local xfont=/usr/X11R6/lib/X11/fonts
27: local xserv=/usr/X11R6/bin/X
28: local xshare=/usr/X11R6/bin/startx
29:
30: local _c _d _e
31: echo -n base
32: echo -n ' etc'
1.3 andrew 33: for _d in misc man comp game xbase xetc xfont xserv xshare; do
34: eval _e=\$${_d}
35: _c=`ls $_e 2> /dev/null | wc -l`
36: #echo $_c $_d $_e
37: if [ $_c -ne 0 ]; then
1.5 andrew 38: echo -n " $_d"
1.2 andrew 39: fi
40: done
1.19 andrew 41:
1.34 andrew 42: sendmail -d0.1 --badoption </dev/null 2>/dev/null | grep -q SASL
1.19 andrew 43: if [ $? == 0 ]; then
44: echo -n ' sendmail-smtp_auth'
45: fi
1.2 andrew 46: }
1.7 andrew 47:
1.39 andrew 48: kernel_file_version() {
49: echo exit | config -e $1 | grep -A1 ^OpenBSD
50: #what $1 | sed -ne 's/[[:blank:]]\{1,\}//p'
51: }
52:
1.16 andrew 53: version_in() {
1.10 andrew 54: local _proto=${FTP%%://*}
1.16 andrew 55: local _file
1.10 andrew 56:
57: if [ X"ftp" == X"${_proto}" ]; then
1.16 andrew 58: local _list=`echo "ls base*.tgz" | ${FTP_CMD} ${FTP}/`
59: _file=`echo ${_list} | awk '/base[0-9][0-9].tgz/ { print $9 }'`
1.15 andrew 60:
1.10 andrew 61: elif [ X"http" == X"${_proto}" ]; then
1.16 andrew 62: local _list=`${FTP_CMD} -V -o - ${FTP}/`
63: _file=`echo ${_list} | awk '/[^x]base[0-9][0-9]*\.tgz/ {
1.15 andrew 64: sub("^.*base","base");
65: sub("\.tgz.*",".tgz");
66: print $0;
1.16 andrew 67: }'`
1.15 andrew 68:
69: elif [ X"scp" == X"${_proto}" ]; then
70: echo SCP is not yet supported >&2
71: return 2
72:
1.10 andrew 73: else
74: echo Unsupported FTP ${FTP} >&2
1.12 andrew 75: return 2
1.15 andrew 76:
1.10 andrew 77: fi
1.16 andrew 78:
79: local _v=${_file##*base}
80: _v=${_v%.tgz*}
81: echo $_v
1.10 andrew 82: }
1.2 andrew 83:
84: set_version() {
85: CUR_VER=`uname -r`
1.3 andrew 86: NEW_VER=`dc -e "$CUR_VER 0.1 + p"`
1.5 andrew 87: FILE_VER=""
88: FTP=""
1.2 andrew 89:
1.5 andrew 90: local _cv=`echo $CUR_VER | sed -e 's/\.//'`
91: local _nv=`echo $NEW_VER | sed -e 's/\.//'`
1.9 andrew 92: local _v
1.5 andrew 93:
1.10 andrew 94: if [ X"No" != X"$FORCE_DIR" -a -d $FORCE_DIR ]; then
1.5 andrew 95: _dir=$FORCE_DIR
96: if [ -e ${_dir}/base${_nv}.tgz ]; then
97: _v=$_nv
98: elif [ -e ${_dir}/base${_cv}.tgz ]; then
99: NEW_VER=$CUR_VER
100: _v=$_cv
101: fi
1.2 andrew 102:
1.5 andrew 103: elif [ -d $CUR_VER ]; then
104: _dir=$CUR_VER
1.2 andrew 105: NEW_VER=$CUR_VER
1.5 andrew 106: if [ -e ${_dir}/base${_cv}.tgz ]; then
107: _v=$_cv
108: fi
1.2 andrew 109:
1.5 andrew 110: elif [ -d $NEW_VER ]; then
111: _dir=$NEW_VER
112: if [ -e ${_dir}/base${_nv}.tgz ]; then
113: _v=$_nv
114: fi
1.2 andrew 115:
116: fi
117:
1.17 andrew 118: if [ X"" != X"${MIRROR}" -a X"" == X"${_v}" ]; then
1.10 andrew 119: if [ X"No" == X"${FORCE_DIR}" ]; then
1.5 andrew 120: _dir=${NEW_VER}
121: else
122: _dir=${FORCE_DIR}
123: fi
124: FTP=${MIRROR}/${_dir}/`machine`
1.2 andrew 125:
1.16 andrew 126: _v=`version_in`
1.10 andrew 127:
1.16 andrew 128: if [ X"" == X"${_v}" ]; then
1.10 andrew 129: if [ X"No" != X"$FORCE_DIR" ]; then
130: echo No sets in forced [${FTP}] >&2
1.12 andrew 131: return 2
1.10 andrew 132: fi
133:
134: NEW_VER=$CUR_VER
135: _dir=${NEW_VER}
136: FTP=${MIRROR}/${_dir}/`machine`
137:
1.16 andrew 138: _v=`version_in`
1.9 andrew 139: fi
140:
1.10 andrew 141: if [ X"" == X"${_v}" ]; then
1.16 andrew 142: echo No sets in [${FTP}] >&2
1.12 andrew 143: return 2
1.10 andrew 144: elif [ X"${_cv}" == X"${_v}" ]; then
1.5 andrew 145: NEW_VER=$CUR_VER
1.9 andrew 146: elif [ X"${_nv}" == X"${_v}" ]; then
147: NEW_VER=$NEW_VER
1.2 andrew 148: else
1.10 andrew 149: echo Invalid version [$_v] >&2
1.12 andrew 150: return 2
1.2 andrew 151: fi
152:
1.10 andrew 153: if [ X"No" == X"$FORCE_DIR" ]; then
1.5 andrew 154: _dir=$NEW_VER
1.2 andrew 155: fi
156:
157: fi
158:
1.5 andrew 159: if [ X"" == X"${_v}" ]; then
160: echo ERROR: Unable to determine file version! >&2
1.12 andrew 161: return 1
1.2 andrew 162: fi
163:
1.5 andrew 164: if [ X"" == X"$RELEASEDIR" ]; then
165: RELEASEDIR=`pwd`/$_dir
1.2 andrew 166: fi
1.9 andrew 167:
1.5 andrew 168: FILE_VER=$_v
1.17 andrew 169: if [ X"" != X"${MIRROR}" ]; then
170: FTP=${MIRROR}/${_dir}/`machine`
171: fi
1.39 andrew 172:
173: BOOT_KERNEL=`( \
174: echo bsd; \
175: [ -e /boot.conf ] && sed -E '/^ *(set +image|boot) +/!d ; \
176: s///; s/^.*://; s/ .*$//' /boot.conf \
177: ) | tail -1`
1.42 andrew 178: BOOT_KERNEL=`follow_symlink /$BOOT_KERNEL`
1.39 andrew 179: BOOT_KERNEL="/${BOOT_KERNEL#/}"
180:
181: BOOT_KERNEL_VERSION=`kernel_file_version $BOOT_KERNEL`
182:
183: BOOTED_KERNEL_VERSION=`sysctl -n kern.version`
184: NEW_KERNEL_VERSION=""
185:
186: # We want to default to what we had
187: INSTALL_KERNELS="${BOOT_KERNEL#/}"
188: # with a second option of an mp kernel if is is a likely candidate
189: if [ X"$INSTALL_KERNELS" != X"bsd.mp" ]; then
190: local _ncpu=$(sysctl -n hw.ncpufound)
191: [ $_ncpu -gt 1 ] && INSTALL_KERNELS="$INSTALL_KERNELS bsd.mp"
192: fi
193: # or just bsd otherwise
194: if [ X"${INSTALL_KERNELS% *}" != X"bsd" ]; then
195: INSTALL_KERNELS="$INSTALL_KERNELS bsd"
196: fi
197: BOOT_KERNELS=$INSTALL_KERNELS
198: INSTALL_KERNELS="$INSTALL_KERNELS bsd.rd"
1.2 andrew 199: }
200:
201: get_sets() {
1.5 andrew 202: echo '### GETTING SETS ###'
1.2 andrew 203: if [ X"" == X"$FTP" ]; then
1.5 andrew 204: echo ERROR: No FTP site set! >&2
1.12 andrew 205: return 1
1.2 andrew 206: fi
207:
1.5 andrew 208: mkdir -p ${RELEASEDIR}
209: cd $RELEASEDIR
1.2 andrew 210:
1.5 andrew 211: local _v=$FILE_VER
1.2 andrew 212:
1.39 andrew 213: for _b in $INSTALL_KERNELS; do
1.45 andrew 214: if [ ! -e ./${_b} ]; then
1.3 andrew 215: echo $FTP_CMD ${FTP}/${_b}
216: $FTP_CMD ${FTP}/${_b}
1.2 andrew 217: fi
218: done
219:
1.5 andrew 220: for _s in $INSTALLED_SETS; do
1.19 andrew 221: local _file=${_s}${_v}.tgz
222: if [ ${_s} == sendmail-smtp_auth ]; then
223: _file=${_s}.gz
224: fi
225:
226: if [ ! -e ./${_file} ]; then
227: echo $FTP_CMD ${FTP}/${_file}
228: $FTP_CMD ${FTP}/${_file}
1.5 andrew 229: fi
1.2 andrew 230: done
231:
1.20 andrew 232: local _type
233: for _type in $CHECKSUM_TYPES; do
1.40 andrew 234: [ -e $_type ] && break
235: echo $FTP_CMD ${FTP}/$_type
236: $FTP_CMD ${FTP}/$_type
1.20 andrew 237: done
1.17 andrew 238: }
239:
1.23 andrew 240: follow_symlink () {
241: local _file=$1
1.33 andrew 242: # This could go circular, but I dunno how to fix that.
243: if [ -h $_file ]; then
244: follow_symlink $( file $_file |
245: grep 'symbolic link' |
246: sed -e s/^.*\\\`// -e s/\\\'\$// )
1.23 andrew 247: else
1.33 andrew 248: echo $_file
1.23 andrew 249: fi
250: }
251:
1.20 andrew 252: check_sum () {
253: local _type=$1
254: echo "### CHECKING $_type SUMS ###"
1.17 andrew 255: cd $RELEASEDIR
256:
1.20 andrew 257: if [ ! -e $_type ]; then
258: echo $_type File does not exist!
1.17 andrew 259: return 1
260: fi
1.6 andrew 261:
1.19 andrew 262: ls bsd* *gz | sed -e 's/\(.*\)/(\1)/' > index
1.20 andrew 263: grep -f index $_type | sum -c
1.2 andrew 264:
265: if [ $? -ne 0 ]; then
1.20 andrew 266: echo ERROR: $_type does not match! >&2
1.12 andrew 267: return 1
1.2 andrew 268: fi
269: }
270:
1.17 andrew 271: check_sets() {
272: echo '### CHECKING SETS ###'
273: cd $RELEASEDIR
274:
1.18 andrew 275: local _missing_sets
1.17 andrew 276: local _v=$FILE_VER
277:
1.39 andrew 278: for _n in $INSTALL_KERNELS; do
279: local _o=$_n
280: [ X"bsd" == X"${_o}" -a -e /bsd.sp ] && _o=bsd.sp
281: if [ -e /${_o} -a ! -e ./${_n} ]; then
282: echo ${_o} does not exist
283: _missing_sets=1
1.17 andrew 284: fi
1.39 andrew 285:
286: if [ X"${BOOT_KERNEL}" == X"/${_o}" -a -e ./${_n} ]; then
287: NEW_KERNEL_VERSION=`kernel_file_version ./${_n}`
1.17 andrew 288: fi
289: done
290:
1.39 andrew 291: if [ X"$NEW_KERNEL_VERSION" == X"" ]; then
292: echo Missing replacement for boot kernel $BOOT_KERNEL >&2
293: _missing_sets=1
294: fi
295:
1.17 andrew 296: for _s in $INSTALLED_SETS; do
1.19 andrew 297: local _file=${_s}${_v}.tgz
298: if [ ${_s} == sendmail-smtp_auth ]; then
299: _file=${_s}.gz
300: fi
301: if [ ! -e ./${_file} ]; then
302: echo ${_file} does not exist
1.18 andrew 303: _missing_sets=1
1.17 andrew 304: fi
305: done
1.18 andrew 306:
307: if [ X"" == X"${_missing_sets}" ]; then
308: echo All OK
309: fi
1.17 andrew 310:
1.20 andrew 311: local _type
312: for _type in $CHECKSUM_TYPES; do
313: if [ -e $_type ]; then
314: check_sum $_type
315: fi
316: done
1.17 andrew 317: }
318:
319:
1.30 andrew 320: install_kernels() {
1.5 andrew 321: echo '### INSTALLING KERNEL ###'
1.3 andrew 322: if [ X"$USER" != X"root" -a X"$SUDO" == X"" ]; then
1.2 andrew 323: echo ${0##*/} must be run as root or SUDO must be set! >&2
324: exit 1
325: fi
326:
327: if [ X"" == X"$RELEASEDIR" ]; then
1.5 andrew 328: echo ERROR: no source for new kernels! >&2
1.2 andrew 329: exit 1
330: fi
331:
1.46 andrew 332: if [ X"$BOOT_KERNEL_VERSION" != X"$NEW_KERNEL_VERSION" ]; then
333: echo "Backing up $BOOT_KERNEL to /obsd"
334: $SUDO ln -f $BOOT_KERNEL /obsd
335: if [ $? -ne 0 ]; then
336: echo "Error copying old kernel!" >&2
337: exit 1
338: fi
1.2 andrew 339: fi
340:
1.39 andrew 341: cd $RELEASEDIR
1.23 andrew 342:
1.39 andrew 343: for _b in $INSTALL_KERNELS; do
1.3 andrew 344: $SUDO rm -f /nbsd
1.39 andrew 345: local _bd=$_b
346: [ X"${_b}" == X"bsd" ] && _bd="bsd.sp"
1.2 andrew 347:
1.39 andrew 348: local _is_boot=""
349: [ X"$BOOT_KERNEL" == X"/${_bd}" ] && _is_boot="# boot kernel"
350:
351: echo "Copying $_b to /$_bd $_is_boot"
352: $SUDO cp ${_b} /nbsd && $SUDO mv /nbsd /${_bd}
1.2 andrew 353: if [ $? -ne 0 ]; then
1.39 andrew 354: echo ERROR: Could not copy new $_bd kernel! >&2
1.2 andrew 355: exit 1
356: fi
1.39 andrew 357: done
358:
359: cd $OLDPWD
1.23 andrew 360:
1.39 andrew 361: if [ ! -h /bsd ]; then
362: cd /
363: for _b in $BOOT_KERNELS; do
364: [ X"$_b" == X"bsd" ] && _b="bsd.sp"
365: if [ -e $_b ]; then
366: echo symlinking $_b to /bsd
367: $SUDO ln -sf $_b bsd
368: if [ $? -ne 0 ]; then
369: echo ERROR: Could not symlink new kernel! >&2
370: exit 1
371: fi
372: break
373: fi
374: done
375: cd $OLDPWD
1.2 andrew 376: fi
377: }
378:
379: install_sets() {
1.5 andrew 380: echo '### INSTALLING SETS ###'
1.3 andrew 381: if [ X"$USER" != X"root" -a X"$SUDO" == X"" ]; then
1.2 andrew 382: echo ${0##*/} must be run as root or SUDO must be set! >&2
383: exit 1
384: fi
385:
386: if [ X"" == X"$RELEASEDIR" ]; then
1.5 andrew 387: echo ERROR: no source for sets! >&2
1.2 andrew 388: exit 1
389: else
390: cd $RELEASEDIR
391: fi
392:
1.5 andrew 393: local _v=$FILE_VER
394:
1.21 andrew 395: if [ $CUR_VER != $NEW_VER -a ! -e /sbin/oreboot ]; then
396: $SUDO cp /sbin/reboot /sbin/oreboot
397: if [ $? -ne 0 ]; then
398: echo "Error copying old reboot command!" >&2
399: exit 1
400: fi
401: echo "/sbin/reboot copied to /sbin/oreboot"
402: fi
403:
404: local _sets=`ls *${_v}.tgz | grep -v ^base `
405: for _f in ${_sets} base${_v}.tgz; do
1.3 andrew 406: _path=$DESTDIR
407: if [ X"etc${_v}.tgz" == X"$_f" \
408: -o X"xetc${_v}.tgz" == X"$_f" ]; then
1.21 andrew 409: [ X"" != X"$SYSMERGE" ] && continue
1.2 andrew 410: _path=/var/tmp/temproot
411: fi
412:
1.3 andrew 413: echo Extracting $_f to $_path
414: $SUDO mkdir -p $_path
415: $SUDO tar -C $_path -xzphf ${RELEASEDIR}/${_f}
1.2 andrew 416: if [ $? -ne 0 ]; then
1.5 andrew 417: echo ERROR: Could not extract ${_f}! >&2
1.2 andrew 418: exit 1
419: fi
420: done
421:
422: echo Extracted all sets.
1.19 andrew 423:
424: if [ -e ${RELEASEDIR}/sendmail-smtp_auth.gz ]; then
425: gzcat ${RELEASEDIR}/sendmail-smtp_auth.gz > \
426: ${RELEASEDIR}/sendmail-smtp_auth
427: fi
428: if [ -e ${RELEASEDIR}/sendmail-smtp_auth ]; then
1.21 andrew 429: if ! pkg_info -qe 'cyrus-sasl-*'; then
430: $SUDO pkg_add -i cyrus-sasl
431: fi
432:
433: $SUDO install -o root -g smmsp -m 2555 \
1.19 andrew 434: ${RELEASEDIR}/sendmail-smtp_auth \
1.21 andrew 435: /usr/libexec/sendmail/sendmail
1.19 andrew 436:
437: echo Installed sendmail with smtp_auth
438: fi
1.2 andrew 439: }
440:
441: update_etc() {
1.5 andrew 442: echo '### UPDATING ETC ###'
1.10 andrew 443: if [ ! -e $SYSMERGE ]; then
1.47 ! andrew 444: echo "ERROR: Can't find sysmerge!" >&2
! 445: exit 1;
1.10 andrew 446: fi
447:
1.47 ! andrew 448: if [ X"" == X"$RELEASEDIR" ]; then
! 449: echo "ERROR: no source for etc!" >&2
! 450: exit 1
! 451: fi
1.2 andrew 452:
1.47 ! andrew 453: cd $RELEASEDIR
1.5 andrew 454:
1.47 ! andrew 455: local _v=$FILE_VER
! 456: local _args=""
! 457: if [ -e etc${_v}.tgz ]; then
! 458: _args="$_args -s etc${_v}.tgz"
! 459: fi
! 460: if [ -e xetc${_v}.tgz ]; then
! 461: _args="$_args -x xetc${_v}.tgz"
! 462: fi
! 463: if [ X"" == X"$_args" ]; then
! 464: echo ERROR: No upgrade sets found! >&2
1.2 andrew 465: else
1.47 ! andrew 466: echo '### RUNNING SYSMERGE ###'
! 467: $SUDO $SYSMERGE $_args
! 468: fi
1.2 andrew 469:
1.47 ! andrew 470: cd $OLDPWD
1.2 andrew 471: }
1.14 andrew 472:
1.20 andrew 473:
1.14 andrew 474: if [ -e /etc/update_openbsd.conf ]; then
475: . /etc/update_openbsd.conf
476: fi
477:
478: if [ -e ${HOME}/.update_openbsdrc ]; then
479: . ${HOME}/.update_openbsdrc
480: fi
481:
1.17 andrew 482: #MIRROR=${MIRROR:=ftp://ftp.openbsd.org/pub/OpenBSD}
1.14 andrew 483: FTP_CMD=${FTP_CMD:=ftp -V}
484: PKG_PATH=${PKG_PATH:=/usr/ports/packages/`machine`/all/:${MIRROR}/`uname -r`/packages/`machine`/}
485:
486: DESTDIR=${DESTDIR:=/}
487: SYSMERGE=${SYSMERGE:=/usr/sbin/sysmerge}
488: FORCE_DIR=${FORCE_DIR:=No}
489:
490: INSTALLED_SETS=${INSTALLED_SETS:=`installed_sets`}
1.2 andrew 491:
1.21 andrew 492: CHECKSUM_TYPES=${CHECKSUM_TYPES:=SHA256 MD5}
1.20 andrew 493:
1.2 andrew 494: set_version
1.12 andrew 495: local _error=$?
1.2 andrew 496:
497: echo
498: echo "-= update_openbsd - helper script to update OpenBSD =-"
499: echo "------------------------------------------------------"
500: echo
1.39 andrew 501: echo " SUDO: $SUDO"
502: echo " SYSMERGE: $SYSMERGE"
503: echo " MIRROR: $MIRROR"
504: echo " RELEASEDIR: $RELEASEDIR"
505: echo " DESTDIR: $DESTDIR"
506: echo " BOOT_KERNEL: $BOOT_KERNEL"
507: echo "INSTALL_KERNELS: $INSTALL_KERNELS"
508: echo " INSTALLED_SETS: $INSTALLED_SETS"
1.8 andrew 509: echo
1.39 andrew 510: echo " CUR_VER: $CUR_VER"
511: echo " NEW_VER: $NEW_VER"
512: #echo " FILE_VER: $FILE_VER"
1.2 andrew 513: echo
1.12 andrew 514:
515: if [ ${_error} -ne 0 ]; then
516: exit ${_error}
517: fi
1.2 andrew 518:
1.17 andrew 519: if [ X"" != X"${FTP}" ]; then
1.20 andrew 520: get_sets
1.17 andrew 521: fi
522:
523: check_sets || exit
1.39 andrew 524:
525: echo "Last booted:\n$BOOTED_KERNEL_VERSION"
526: if [ X"$BOOT_KERNEL_VERSION" != X"$BOOTED_KERNEL_VERSION" \
527: -a X"$BOOT_KERNEL_VERSION" != X"$NEW_KERNEL_VERSION" ]; then
528: echo "Next boot (unless replaced):\n$BOOT_KERNEL_VERSION"
529: fi
530: if [ -n "$NEW_KERNEL_VERSION" ]; then
531: echo "New $BOOT_KERNEL:\n$NEW_KERNEL_VERSION";
532: else
533: echo "\n!!! WARNING: Will not replace boot kernel $BOOT_KERNEL! !!!\n" >&2
534: echo "ctrl+C to cancel, enter to continue anyway" >&2
1.44 andrew 535: local _temp
536: read _temp
537: fi
538:
539: if [ -n "$SUDO" -a $CUR_VER != $NEW_VER ]; then
540: echo >&2
541: echo "!!! You are upgrading between OpenBSD versions. !!!" >&2
542: echo "!!! You should make sure you have a root shell open !!!" >&2
543: echo "!!! It is needed in order to run /sbin/oreboot. !!!" >&2
544: echo "!!! sudo MAY NOT WORK after sets are extracted. !!!" >&2
545: echo >&2
546: echo "ctrl+C to cancel, enter to continue" >&2
1.39 andrew 547: local _temp
548: read _temp
549: fi
1.2 andrew 550:
1.43 andrew 551: if [ -n "$SUDO" ]; then
552: echo
553: echo You may be asked for your sudo password multiple times.
554: $SUDO -v -p "sudo Password: "
1.2 andrew 555: fi
556:
1.30 andrew 557: install_kernels
1.21 andrew 558: install_sets
1.2 andrew 559:
1.5 andrew 560: if [ $CUR_VER == $NEW_VER ]; then
1.21 andrew 561: if [ -e /sbin/oreboot ]; then
562: echo Removing /sbin/oreboot
563: $SUDO rm -f /sbin/oreboot
564: fi
1.2 andrew 565: update_etc
566:
567: echo '### UPDATING PACKAGES ###'
568: $SUDO pkg_add -ui -F update -F updatedepends
569:
570: else
571: echo Instructions for updating to the new version available from
1.36 andrew 572: if [ X"snapshots" == X"$FORCE_DIR" ]; then
1.30 andrew 573: echo " http://www.openbsd.org/faq/current.html"
574: else
575: echo " http://www.openbsd.org/faq/upgrade${FILE_VER}.html"
576: fi
1.2 andrew 577: fi
578:
579: echo New kernel installed. Please reboot!
1.22 andrew 580: if [ -e /sbin/oreboot ]; then
581: echo Possibly using /sbin/oreboot
1.31 andrew 582: fi
583:
584: local _send_dmesg=`dirname $0`/send_dmesg
585: if [ -e "$_send_dmesg" ]; then
1.32 andrew 586: if [ -e $RELEASEDIR/.send_dmesg ]; then
1.31 andrew 587: $_send_dmesg
588: rm -f $RELEASEDIR/.send_dmesg
1.32 andrew 589: elif [ X"$CUR_VER" != X"$NEW_VER" ]; then
1.31 andrew 590: touch $RELEASEDIR/.send_dmesg
591: fi
1.22 andrew 592: fi
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>