version 1.43, 2012/12/09 04:06:57 |
version 1.47, 2012/12/16 06:56:15 |
|
|
#!/bin/sh |
#!/bin/sh |
# $AFresh1: update_openbsd,v 1.42 2012/12/09 03:41:41 andrew Exp $ |
# $AFresh1: update_openbsd,v 1.46 2012/12/16 03:29:02 andrew Exp $ |
# |
# |
# Copyright (c) 2012 Andrew Fresh <andrew@afresh1.com> |
# Copyright (c) 2012 Andrew Fresh <andrew@afresh1.com> |
# |
# |
|
|
local _v=$FILE_VER |
local _v=$FILE_VER |
|
|
for _b in $INSTALL_KERNELS; do |
for _b in $INSTALL_KERNELS; do |
if [ -e /${_b} -a ! -e ./${_b} ]; then |
if [ ! -e ./${_b} ]; then |
echo $FTP_CMD ${FTP}/${_b} |
echo $FTP_CMD ${FTP}/${_b} |
$FTP_CMD ${FTP}/${_b} |
$FTP_CMD ${FTP}/${_b} |
fi |
fi |
|
|
exit 1 |
exit 1 |
fi |
fi |
|
|
echo "Backing up $BOOT_KERNEL to /obsd" |
if [ X"$BOOT_KERNEL_VERSION" != X"$NEW_KERNEL_VERSION" ]; then |
$SUDO ln -f $BOOT_KERNEL /obsd |
echo "Backing up $BOOT_KERNEL to /obsd" |
if [ $? -ne 0 ]; then |
$SUDO ln -f $BOOT_KERNEL /obsd |
echo "Error copying old kernel!" >&2 |
if [ $? -ne 0 ]; then |
exit 1 |
echo "Error copying old kernel!" >&2 |
|
exit 1 |
|
fi |
fi |
fi |
|
|
cd $RELEASEDIR |
cd $RELEASEDIR |
|
|
update_etc() { |
update_etc() { |
echo '### UPDATING ETC ###' |
echo '### UPDATING ETC ###' |
if [ ! -e $SYSMERGE ]; then |
if [ ! -e $SYSMERGE ]; then |
SYSMERGE= |
echo "ERROR: Can't find sysmerge!" >&2 |
|
exit 1; |
fi |
fi |
|
|
if [ X"" == X"$SYSMERGE" ]; then |
if [ X"" == X"$RELEASEDIR" ]; then |
if [ -e /var/tmp/temproot ]; then |
echo "ERROR: no source for etc!" >&2 |
MERGEMASTER=`which mergemaster` |
exit 1 |
|
fi |
|
|
if [ $? != 0 ]; then |
cd $RELEASEDIR |
$SUDO pkg_add -i mergemaster |
|
|
|
MERGEMASTER=`which mergemaster` |
local _v=$FILE_VER |
if [ $? != 0 ]; then |
local _args="" |
echo ERROR: mergemaster not installed! >&2 |
if [ -e etc${_v}.tgz ]; then |
exit 1 |
_args="$_args -s etc${_v}.tgz" |
fi |
fi |
fi |
if [ -e xetc${_v}.tgz ]; then |
|
_args="$_args -x xetc${_v}.tgz" |
echo '### RUNNING MERGEMASTER ###' |
fi |
$SUDO $MERGEMASTER -irv |
if [ X"" == X"$_args" ]; then |
else |
echo ERROR: No upgrade sets found! >&2 |
echo "ERROR: no source for etc!" >&2 |
|
exit 1 |
|
fi |
|
else |
else |
if [ X"" == X"$RELEASEDIR" ]; then |
echo '### RUNNING SYSMERGE ###' |
echo "ERROR: no source for etc!" >&2 |
$SUDO $SYSMERGE $_args |
exit 1 |
|
else |
|
cd $RELEASEDIR |
|
fi |
|
|
|
local _v=$FILE_VER |
|
local _args="" |
|
if [ -e etc${_v}.tgz ]; then |
|
_args="$_args -s etc${_v}.tgz" |
|
fi |
|
if [ -e xetc${_v}.tgz ]; then |
|
_args="$_args -x xetc${_v}.tgz" |
|
fi |
|
if [ X"" == X"$_args" ]; then |
|
echo ERROR: No upgrade sets found! >&2 |
|
else |
|
echo '### RUNNING SYSMERGE ###' |
|
if sysmerge 2>&1 | grep -- -a >/dev/null; then |
|
_args="-a $_args" |
|
fi |
|
$SUDO $SYSMERGE $_args |
|
fi |
|
fi |
fi |
|
|
|
cd $OLDPWD |
} |
} |
|
|
|
|
|
|
else |
else |
echo "\n!!! WARNING: Will not replace boot kernel $BOOT_KERNEL! !!!\n" >&2 |
echo "\n!!! WARNING: Will not replace boot kernel $BOOT_KERNEL! !!!\n" >&2 |
echo "ctrl+C to cancel, enter to continue anyway" >&2 |
echo "ctrl+C to cancel, enter to continue anyway" >&2 |
|
local _temp |
|
read _temp |
|
fi |
|
|
|
if [ -n "$SUDO" -a $CUR_VER != $NEW_VER ]; then |
|
echo >&2 |
|
echo "!!! You are upgrading between OpenBSD versions. !!!" >&2 |
|
echo "!!! You should make sure you have a root shell open !!!" >&2 |
|
echo "!!! It is needed in order to run /sbin/oreboot. !!!" >&2 |
|
echo "!!! sudo MAY NOT WORK after sets are extracted. !!!" >&2 |
|
echo >&2 |
|
echo "ctrl+C to cancel, enter to continue" >&2 |
local _temp |
local _temp |
read _temp |
read _temp |
fi |
fi |