On Sun, May 17, 2015 at 03:08:43PM BST, Peter Leber wrote:

Hi Peter,

> Is there someone aware of a procedure which could help me solving my
> problem?

Like Atanas, I use a procedure suggested by Sébastien Marie[0].

There are several things which this script does not check for - some of
those are on my TODO list:

1. If you're upgrading from -stable to -current, then you'll need to
adjust '/etc/pkg.conf' file accordingly beforehand.
2. Your '/usr/src' directory needs to exist and contain the source code.
3. Sometimes a new snapshot might get published mid-download - you'll
simply need to re-run the script or you may simply wrap it in a loop.
4. You'll need to adjust the 'sets' manually.
5. Since it is aimed at frequent snapshot upgrades, it assumes you are
running GENERIC{.MP} kernel.
6. If you are already using '/etc/boot.conf' then you'll need to adjust
the script.
7. /dev/vnd0 is hard-coded and there's no logic there to check whether
it is in use - the same goes for '/tmp'.
8. You can add 'sysmerge', 'pkg_add -u', etc. to 'rc.firsttime' if you
like.

-----
#!/bin/sh

arch=$(machine)
kernel="$(uname -v | cut -d '#' -f 1)"
release="$(uname -r)"
version="$(uname -r | tr -d '.')"
sets="base${version}.tgz comp${version}.tgz game${version}.tgz \
        man${version}.tgz xbase${version}.tgz xfont${version}.tgz \
        xserv${version}.tgz xshare${version}.tgz"

_snapshot() {
    dir=/${release}/${arch}
    test -d $dir || mkdir -p $dir
    get="ftp -V -o"
    site="$(awk '/^installpath/ { print $3 }' /etc/pkg.conf | rev | cut -d '/' 
-f 1-2,4- | rev)"
    case $kernel in
    GENERIC)
        bsd=bsd
        ;;
    GENERIC.MP)
        bsd="bsd bsd.mp"
        ;;
    esac
    cd $dir && for i in SHA256 SHA256.sig ; do \
    $get ${dir}/${i} ${site}${i} > /dev/null 2>&1 ; done
    for i in INSTALL.${arch} bsd.rd $bsd $sets ; do
        test -f $i || $get ${dir}/${i} ${site}${i} > /dev/null 2>&1 ; \
    first=$(awk '/\('"$i"'\)/ { print $NF ; }' SHA256) ; second=$(sha256 -q $i) 
; test "$first" = "$second" || \
    $get ${dir}/${i} ${site}${i} > /dev/null 2>&1 ; done
    diff -q ${dir}/bsd.rd /bsd.rd > /dev/null 2>&1 || \
        ( mv -f /bsd.rd /obsd.rd && cp -f ${dir}/bsd.rd /bsd.rd && \
        cd /usr/src/distrib/common && \
        cc -o /tmp/rdsetroot elf32.c elf64.c elfrdsetroot.c && \
        cd /tmp && /tmp/rdsetroot -x /bsd.rd ramdisk.img && \
        vnconfig vnd0 ramdisk.img && mount /dev/vnd0a /mnt && \
        echo 'Location of sets = disk
Is the disk partition already mounted = yes' > /mnt/auto_upgrade.conf && \
        umount /dev/vnd0a && vnconfig -u vnd0 && \
        /tmp/rdsetroot /bsd.rd ramdisk.img && rm ramdisk.img && \
        echo 'boot bsd.rd' > /etc/boot.conf && \
        echo '#!/bin/sh

rm -f /etc/boot.conf' > /upgrade.site && chmod 0755 /upgrade.site" && \
        echo "There's a new snapshot." )
}
_snapshot
-----

It's a bit crufty but it works for me :^)

Regards,

Raf

Reply via email to