Can't you use /upgrade.site[1]?

[1] http://www.openbsd.org/faq/faq4.html#site


On 4 December 2012 21:59, Frank Brodbeck <f...@guug.de> wrote:

> On Tue, Dec 04, 2012 at 09:44:59PM +0000, Heptas Torres wrote:
> > Thanks. What I meant was more things like the script
> > http://gouloum.fr/code/script/install_snapshot.sh - this seems a bit
> > outdated and was wondering whether people use something similar for
> > system upgrades plus some package upgrades automatically. I was just
> > curious about what the best practices for automatic upgrades and syncs
> > are.
>
> This is something that I use. Though that script only fetches the
> neccessary files and copies bsd.rd to /
>
> The script saves everything in your CWD. After running the script I just
> boot bsd.rd, run the upgrade and do sysmerge and pkg_add -u afterwards,
> so the main benefit is keeping the downtime small and the script can
> detect if the mirror you're fetching your sets from is out of sync.
>
> Frank.
>
> #!/bin/ksh
> # $Id: snapshotset.sh,v 1.4 2012/12/04 21:49:22 fab Exp $
>
> ARCH=$(uname -m)
> MIRROR=http://openbsd.cs.fau.de/
> LOCATION=pub/OpenBSD/snapshots/${ARCH}/
> export showchanges=0
> force=0
>
> [[ "X$1" = 'X-f' ]] && force=1
>
> echo "fetching SHA256 from ${MIRROR}"
> ftp ${MIRROR}${LOCATION}SHA256
> echo "\nfetching SHA256 from ftp.openbsd.org"
> ftp -o SHA256.master http://ftp.openbsd.org/${LOCATION}SHA256
>
> printf 'comaparing SHA256 files '
> if [[ $(diff -u SHA256 SHA256.master) >/dev/null ]];
> then
>         print 'failed. mirror out of sync or compromised\n'
>         diff -u SHA256.master SHA256
>         [[ $force -eq 1 ]] || exit 2
> else
>         print 'ok.\n'
> fi
>
> echo "\nfetching index.txt: "
> ftp ${MIRROR}${LOCATION}/index.txt
> echo "\nfetching INSTALL.${ARCH}"
> ftp ${MIRROR}${LOCATION}/INSTALL.${ARCH}
>
> for i in bsd bsd.rd bsd.mp;
> do
>         printf "checking %s:" "$i"
>         [[ -f $i && $(grep "^$(sha256 $i)$" SHA256) >/dev/null ]] && \
>             echo " uptodate." || \
>         {
>                 echo " missing or cksum mismatch, fetching."
>                 ftp ${MIRROR}${LOCATION}$i
>                 showchanges=1
>         }
> done
>
> { grep "tgz$" index.txt | awk '{ print $10 }'; }|&
> while read -p basepkg
> do
>         printf "checking %s:" "$basepkg"
>         [[ -f $basepkg && $(grep "^$(sha256 $basepkg)" SHA256) >/dev/null
> ]] && \
>             echo " uptodate." || \
>         {
>                 echo " missing or cksum mismatch, fetching."
>                 ftp ${MIRROR}${LOCATION}${basepkg}
>                 showchanges=1
>         }
> done 3>&-
>
> printf "checking /bsd.rd:"
> if [[ "$(sha256 -q bsd.rd)" = "$(sha256 -q /bsd.rd)" ]];
> then
>         printf " uptodate.\n"
> else
>         printf "Copying bsd.rd to /\n"
>         su root -c "cp bsd.rd /bsd.rd"
> fi
>
> if [[ $showchanges -eq 1 ]];
> then
>         echo "Fetching changes from current.html"
>         ftp -o - -V http://www.openbsd.org/faq/current.html | \
>             egrep '<li><a href="#.*">[0-9]{4}/[0-9]{2}/[0-9]{2} - .*</a>'
> | \
>             egrep -o '[0-9]{4}/[0-9]{2}/[0-9]{2} - [^<]+'
> fi
>
> unset showchanges
>
> --
> Frank Brodbeck <f...@guug.de>
>
>


-- 
Oldak Quill (oldakqu...@gmail.com)

Reply via email to