| version 1.65, 2014/02/01 19:13:53 |
version 1.71, 2015/01/18 03:01:08 |
|
|
| #!/bin/sh |
#!/bin/sh |
| # $AFresh1: update_openbsd,v 1.64 2014/02/01 16:31:51 andrew Exp $ |
# $AFresh1: update_openbsd,v 1.70 2015/01/18 02:59:23 andrew Exp $ |
| # |
# |
| # Copyright (c) 2012 Andrew Fresh <andrew@afresh1.com> |
# Copyright (c) 2012 Andrew Fresh <andrew@afresh1.com> |
| # |
# |
|
|
| if [ ! -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} |
| |
else |
| |
echo "===> Have ${_b}" |
| fi |
fi |
| |
kernel_file_version "${_b}" |
| done |
done |
| |
|
| for _s in $INSTALLED_SETS; do |
for _s in $INSTALLED_SETS; do |
| |
[ "$_v" -ge "57" -a "$_s" != "${_s%etc}" ] && continue |
| local _file=${_s}${_v}.tgz |
local _file=${_s}${_v}.tgz |
| if [ ${_s} == sendmail-smtp_auth ]; then |
if [ ${_s} == sendmail-smtp_auth ]; then |
| _file=${_s}.gz |
_file=${_s}.gz |
|
|
| |
|
| local _nv=`echo $NEW_VER | sed -e 's/\.//'` |
local _nv=`echo $NEW_VER | sed -e 's/\.//'` |
| local _signify=`which signify 2>/dev/null` |
local _signify=`which signify 2>/dev/null` |
| local _keyfile=/etc/signify/${_nv}base.pub |
local _keyfile=/etc/signify/openbsd-${_nv}-base.pub |
| local _b _s |
local _b _s |
| |
|
| ( |
( |
|
|
| echo "key [$_keyfile] does not exist, cannot check $_type" >&2 |
echo "key [$_keyfile] does not exist, cannot check $_type" >&2 |
| return 2 |
return 2 |
| fi |
fi |
| signify -V -e -p $_keyfile -x $_type -m - | grep -f index | sum -c - |
signify -V -e -p $_keyfile -x $_type -m - | grep -f index | sha256 -c - |
| else |
else |
| grep -f index $_type | sum -c |
grep -f index $_type | sum -c |
| fi |
fi |
|
|
| fi |
fi |
| |
|
| for _s in $INSTALLED_SETS; do |
for _s in $INSTALLED_SETS; do |
| |
[ "$_v" -ge "57" -a "$_s" != "${_s%etc}" ] && continue |
| local _file=${_s}${_v}.tgz |
local _file=${_s}${_v}.tgz |
| if [ ${_s} == sendmail-smtp_auth ]; then |
if [ ${_s} == sendmail-smtp_auth ]; then |
| _file=${_s}.gz |
_file=${_s}.gz |
|
|
| exit 1; |
exit 1; |
| fi |
fi |
| |
|
| if [ X"" == X"$RELEASEDIR" ]; then |
|
| echo "ERROR: no source for etc!" >&2 |
|
| exit 1 |
|
| fi |
|
| |
|
| cd $RELEASEDIR |
|
| |
|
| local _v=$FILE_VER |
local _v=$FILE_VER |
| local _args="" |
local _args="" |
| if [ -e etc${_v}.tgz ]; then |
|
| _args="$_args -s ${RELEASEDIR}/etc${_v}.tgz" |
if [ ! -e /usr/share/sysmerge/etc.tgz ]; then |
| |
if [ X"" == X"$RELEASEDIR" ]; then |
| |
echo "ERROR: no source for etc!" >&2 |
| |
exit 1 |
| |
fi |
| |
|
| |
cd $RELEASEDIR |
| |
|
| |
if [ -e etc${_v}.tgz ]; then |
| |
_args="$_args -s ${RELEASEDIR}/etc${_v}.tgz" |
| |
fi |
| |
if [ -e xetc${_v}.tgz ]; then |
| |
_args="$_args -x ${RELEASEDIR}/xetc${_v}.tgz" |
| |
fi |
| |
if [ X"" == X"$_args" ]; then |
| |
echo ERROR: No upgrade sets found! >&2 |
| |
exit 1 |
| |
fi |
| fi |
fi |
| if [ -e xetc${_v}.tgz ]; then |
|
| _args="$_args -x ${RELEASEDIR}/xetc${_v}.tgz" |
|
| fi |
|
| if [ X"" == X"$_args" ]; then |
|
| echo ERROR: No upgrade sets found! >&2 |
|
| else |
|
| echo '==> RUNNING SYSMERGE' |
|
| $SYSMERGE $_args |
|
| fi |
|
| |
|
| |
echo '==> RUNNING SYSMERGE' |
| |
$SYSMERGE $_args |
| |
|
| cd $OLDPWD |
cd $OLDPWD |
| } |
} |
| |
|
|
|
| #echo " FILE_VER: $FILE_VER" |
#echo " FILE_VER: $FILE_VER" |
| echo |
echo |
| |
|
| |
for k in $INSTALL_KERNELS; do |
| |
if [ -e "/$k" ]; then |
| |
echo "Existing $k" |
| |
kernel_file_version "/$k" |
| |
fi |
| |
done |
| |
|
| if [ ${_error} -ne 0 ]; then |
if [ ${_error} -ne 0 ]; then |
| exit ${_error} |
exit ${_error} |
| fi |
fi |
|
|
| NEW_KERNEL_VERSION=$BOOT_KERNEL_VERSION |
NEW_KERNEL_VERSION=$BOOT_KERNEL_VERSION |
| fi |
fi |
| |
|
| if [ $CUR_VER != $NEW_VER ]; then |
if [ X"$NEW_KERNEL_VERSION" != X"$BOOTED_KERNEL_VERSION" ]; then |
| echo >&2 |
echo >&2 |
| echo "!!! You are upgrading between OpenBSD versions. !!!" >&2 |
echo "!!! You are upgrading the OpenBSD kernel. !!!" >&2 |
| echo "!!! You should make sure you have a root shell open !!!" >&2 |
echo "!!! You will be given the opportunity to reboot !!!" >&2 |
| echo "!!! It is needed in order to run /sbin/oreboot. !!!" >&2 |
echo "!!! at the end of the proces but it is safer to !!!" >&2 |
| echo "!!! sudo MAY NOT WORK after sets are extracted. !!!" >&2 |
echo "!!! have a separate 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 >&2 |
| echo "ctrl+C to cancel, enter to continue" >&2 |
echo "enter to continue, ctrl+C to cancel" >&2 |
| local _temp |
local _temp |
| read _temp |
read _temp |
| fi |
|
| |
|
| if [ X"$NEW_KERNEL_VERSION" != X"$BOOTED_KERNEL_VERSION" \ |
if [ ! -e /sbin/oreboot ]; then |
| -a ! -e /sbin/oreboot ]; then |
cp /sbin/reboot /sbin/oreboot |
| cp /sbin/reboot /sbin/oreboot |
if [ $? -ne 0 ]; then |
| if [ $? -ne 0 ]; then |
echo "Error copying old reboot command!" >&2 |
| echo "Error copying old reboot command!" >&2 |
exit 1 |
| exit 1 |
fi |
| |
echo "/sbin/reboot copied to /sbin/oreboot" |
| fi |
fi |
| echo "/sbin/reboot copied to /sbin/oreboot" |
|
| fi |
fi |
| |
|
| install_kernels |
install_kernels |
|
|
| |
|
| if [ -e /sbin/oreboot ]; then |
if [ -e /sbin/oreboot ]; then |
| echo Removing /sbin/oreboot |
echo Removing /sbin/oreboot |
| $rm -f /sbin/oreboot |
rm -f /sbin/oreboot |
| fi |
fi |
| update_etc |
update_etc |
| |
|
|
|
| fi |
fi |
| fi |
fi |
| |
|
| echo Update complete press any key to reboot, ctrl+C to cancel |
echo Update complete. enter to reboot, ctrl+C to cancel |
| read _temp |
read _temp |
| if [ -e /sbin/oreboot ]; then |
if [ -e /sbin/oreboot ]; then |
| |
echo using /sbin/oreboot |
| /sbin/oreboot |
/sbin/oreboot |
| else |
else |
| /sbin/reboot |
/sbin/reboot |