Re Stephan,

On Mon, Nov 01, 2004, Stephan Buys wrote:
> Is it possible to upgrade OpenPKG-2003-06-06 to OpenPKG 2.[x ...]
> 
yes, it is. But not that simple because versions before openpkg-20030802
behave like OpenPKG 1.x release and care must be taken when upgrading
from 1.x to 2.x, see the Release Notes [1]

I once wrote a little scriptlet for obmtool.conf which automates that
upgrade. It is attached and because it is mostly a shell script it can
be run without obmtool after little editing.

[1] http://cvs.openpkg.org/openpkg-re/releasenotes.txt

--
[EMAIL PROTECTED], Cable & Wireless
%opkg
    echo "---- boot/build ${NODE} %${CMD} ----"
    PREFIX=/usr/${CMD}

    #
    # check for 1.3 to 2.0 upgrade conditions; setup intermediate step
    #
    @rpm
    if [ -x ${MPX:-${RPM:-/etc/passwd}} ]; then
        OPENPKG=`${MPX} ${RPM} -qa | ${EGREP} '^openpkg-[^-]+-[^-]+$'`
        VERSION=`echo "${OPENPKG}" | sed -e 
's;^openpkg-\([^-][^-]*\)-\([^-][^-]*\)$;\1;'`
        RELEASE=`echo "${OPENPKG}" | sed -e 
's;^openpkg-\([^-][^-]*\)-\([^-][^-]*\)$;\2;'`
        if [ ".${OPENPKG}" != ".openpkg-1.9.0-2.0.0" -a ".${VERSION}" != ".${RELEASE}" 
]; then
            echo "${VERSION} different from ${RELEASE}. Cannot handle this unknown 
situation."
            exit 1;
        fi
        VER=`echo "${VERSION}" | sed -e 
's;^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\([sabp.]\)\([0-9][0-9]*\)$;\1;'`
        REV=`echo "${VERSION}" | sed -e 
's;^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\([sabp.]\)\([0-9][0-9]*\)$;\2;'`
        TYP=`echo "${VERSION}" | sed -e 
's;^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\([sabp.]\)\([0-9][0-9]*\)$;\3;'`
        LEV=`echo "${VERSION}" | sed -e 
's;^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\([sabp.]\)\([0-9][0-9]*\)$;\4;'`
        cont="yes"
        if [ ".${VER}" = ".${VERSION}" ]; then
            [ ${VER} -lt 20030802 ] && cont="no"
            [ ${VER} -le 20040130 ] && cont="intermediate"
            [ ${VER} -gt 20040213 ] && cont="unknown"
            if [ ".${cont}" = .no ]; then
                echo "${OPENPKG} must be upgraded to openpkg-20030802-20030802 ... 
openpkg-20040130-20040130 first"
                exit 1;
            fi
        else
            [ ${VER} -lt 1 ] && cont="no"
            [ ${VER} -eq 1 -a ${REV} -lt 3 ] && cont="no"
            [ ${VER} -eq 1 -a ${REV} -eq 3 -a ${LEV} -le 1 ] && cont="intermediate"
            [ ${VER} -eq 1 -a ${REV} -eq 3 -a ${LEV} -gt 1 ] && cont="unknown"
            if [ ".${cont}" = .no ]; then
                echo "${OPENPKG} must be upgraded to openpkg-1.3.0-1.3.0 first"
                exit 1;
            fi
        fi
        [ ".${debug}" = .1 ] && echo "DEBUG: OPENPKG=$OPENPKG VERSION=$VERSION 
RELEASE=$RELEASE VER=$VER REV=$REV TYP=$TYP LEV=$LEV cont=$cont"
        if [ ".${cont}" = .intermediate ]; then
            echo "${OPENPKG} is now upgraded to intermediate step"
            ${MPX} ${RPM} -q >/dev/null openpkg-tool && ${MPX} ${RPM} -e openpkg-tool
            @install openpkg-1.9.0-2.0.0
            echo "intermediate step rebuilding database"
            if [ ".$CHECKONLY" != ".yes" ]; then
                ${MPX} ${RPM} --db-rebuild
            else
                echo "CHECKONLY: ${MPX} ${RPM} --db-rebuild [skipping]"
            fi
            TRACK=""
        fi
        if [ ".${cont}" = .unknown ]; then
            echo "this script does not know how to handle ${OPENPKG} - continue anyway"
        fi
    fi

    # start from scratch, upgrade within 2.1, from 2.0 or upgrade from 1.9 (=1.3 
intermediate step)
    @install openpkg-2.2.0-2.2.0 \
        --tag="${CMD}" \
        --prefix="${PREFIX}" \
        --user="${CMD}" --group="${CMD}" \
        --muid="1006" --ruid="1007" --nuid="1008" \
        --mgid="1006" --rgid="1007" --ngid="1008"

    #
    # check whether tag format works as desired
    #
    TAGFMT=`${MPX} ${RPM} --eval '%{?l_tag_fmt:%{l_tag_fmt}}'`
    if [ ".${TAGFMT}" != ".<compat>" -a ".${TAGFMT}" != ".<loc>" -a ".${TAGFMT}" != 
".opkg" ]; then
        if [ ".$CHECKONLY" != ".yes" ]; then
            echo "TAGFMT not working. Got \"${TAGFMT}\". Expected \"<compat>\" or 
\"<loc>\" or \"opkg\"".
            exit 1
        else
            echo "CHECKONLY: TAGFMT not working. Got \"${TAGFMT}\". Expected 
\"<compat>\" or \"<loc>\" or \"opkg\"".
        fi
    fi

Reply via email to