[WBEL-users] apt-get repository?

Ed ekg@tricity.wsu.edu
Fri, 03 Sep 2004 12:58:24 -0700


This is a multi-part message in MIME format.
--------------070803090403070904020404
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Trey Sizemore wrote:
> On Tue, 31 Aug 2004 14:06:58 -0700
> Ed <ekg@tricity.wsu.edu> wrote:
> 
> 
>>We have an apt-rpn repository here, which I use to keep all of our white 
>>box systems up to date.  I am using the scripts from freshrpms, modified 
>>to use whitebox instead of red hat, and to incorporate extra rpm's 
>>easily.  If any are interested I can post the scripts and directory 
>>structure.
>>
> 
> 
> Yes, I'd like to see this.
> 
> Thanks.
> 

Unfortunately, it's a bit of an embarrasing hack, but it *does* work. 
You just need the apt rpm and these scripts.

It took me a bit of trial and error to get it working, so some 
experimenation may be required.  The main point is that you put your 
base whitebox rpms (or a copy of the CD's) under 3.0/, your updates 
under updates/3.0/en, and any extra packages in arbitrary directories 
under extras/whitebox/3.0.  Then change the prefixes in the first part 
of genaptrep-wb.sh to match where you put the files, mine was 
"/usr2/whitebox".

To generate the apt repository:

cd $your_prefix
mkdir -p apt/whitebox
cd apt
/path/to/genlinks-wb.sh
/path/to/genaptrep-wb.sh wb30     #basic rpms
/path/to/genaptrep-wb.sh wb30-ex  #extras
/path/to/genaptrep-wb.sh wb30-up  #updates

The directory structure I'm using is (under /usr2/whitebox):

.
./apt
./apt/whitebox
./apt/whitebox/3.0
./apt/whitebox/3.0/en
./apt/whitebox/3.0/en/i386
./apt/whitebox/3.0/en/i386/base
./apt/whitebox/3.0/en/i386/RPMS.extras
./apt/whitebox/3.0/en/i386/RPMS.updates
./apt/whitebox/3.0/en/i386/SRPMS.extras
./extras
./extras/whitebox
./extras/whitebox/3.0
./extras/whitebox/3.0/{any-extra-rpms-go-under-here}
./extras/whitebox/3.0/apt
./extras/whitebox/3.0/cslab
./extras/whitebox/3.0/java
./extras/whitebox/3.0/opendx
./extras/whitebox/3.0/lesstif
./extras/whitebox/3.0/wxgtk
./extras/whitebox/3.0/geomview
./extras/whitebox/3.0/gsl
./extras/whitebox/3.0/gl
./extras/whitebox/3.0/ical
./extras/whitebox/3.0/nasm
./extras/whitebox/3.0/openoffice
./extras/whitebox/3.0/abiword
./extras/whitebox/3.0/fftw
./extras/whitebox/3.0/koffice
./extras/whitebox/3.0/xv
./extras/whitebox/3.0/ghostview
./extras/whitebox/3.0/bash-completion
./extras/whitebox/3.0/python
./extras/whitebox/3.0/video
./extras/whitebox/3.0/openvpn
./extras/whitebox/3.0/dia
./extras/whitebox/3.0/caml
./extras/whitebox/3.0/unison
./extras/whitebox/3.0/pymol
./extras/whitebox/3.0/xforms
./extras/whitebox/3.0/bochs
./extras/whitebox/3.0/quanta
./extras/whitebox/3.0/wine
./extras/whitebox/3.0/bacula
./extras/whitebox/3.0/acroread
./3.0
./3.0/dosutils
./3.0/dosutils/autoboot
./3.0/fedora
./3.0/images
./3.0/images/pxeboot
./3.0/isolinux
./3.0/lostRPMS
./3.0/lostSRPMS
./3.0/origSRPMS
./3.0/RedHat
./3.0/RedHat/base
./3.0/RedHat/RPMS
./3.0/SRPMS
./updates
./updates/3.0
./updates/3.0/en

I know this explanation might be confusing or incomplete, but it's 
really not too complicated of a process, so if you have more questions 
feel free to post 'em.

Aptly Yours,
   Ed

--------------070803090403070904020404
Content-Type: text/x-sh;
 name="genaptrep-wb.sh"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="genaptrep-wb.sh"

#!/bin/bash

# $Id: genaptrep.sh,v 1.2 2003/03/13 11:31:08 dude Exp $
#
# Quick script to generate apt repositories for Red Hat Linux
# Hacked in a few minutes by Matthias Saou http://freshrpms.net/
# (ugly script? yeah, probably ;-))

# Modified by Ed for use with White Box Linux.

# Local configuration

# The distribution (for a custom one, you could just use a different name)
DISTR=whitebox
# The directory where the apt "tree" is (where apt.tar.gz was extracted)
APTDIR=/usr2/whitebox/apt/
# The directory where your (partial) local Red Hat Linux mirror resides
MIRRORDIR=/usr2/whitebox
# The directory where your (partial) local Freshrpms.net mirror resides
EXTRAS=/usr2/whitebox/extras

# Everything else... normally, no need to change anything, but go ahead ;-)

if [ -z "$1" ]; then
    echo "Usage : $0 <repository module>"
    echo "Example repository modules include 'rh80', 'rh80-up', 'rh80-fr'"
    exit 1
fi

hash() {
    # Usage : hash <lang> <arch> <module1 module2...>
    LG=$1
    ARCH=$2
    shift 2
    genbasedir --hashonly \
        ${APTDIR}/${DISTR}/${VERSION}/${LG}/${ARCH} $* >/dev/null 2>/dev/null
}

configured() {
    # Usage : configured <lang> <arch> <module>
    LG=$1
    ARCH=$2
    MODL=$3
    test -r "${APTDIR}/${DISTR}/${VERSION}/${LG}/${ARCH}/base/release.${MODL}"
    return $?
}

gen() {
    # Usage : gen <lang> <arch> <module>
    LG=$1
    ARCH=$2
    MODL=$3
    if ! `which genbasedir >/dev/null 2>&1`; then
        echo "The \"genbasedir\" command was not found! Please install apt first."
        return 1
    fi
    echo -n "Generating ${DISTR}/${VERSION}/${LG}/${ARCH} ${MODL} : "
    if configured ${LG} ${ARCH} ${MODL}; then
        echo "patience..."
        genbasedir --flat --bloat --progress \
            ${APTDIR}/${DISTR}/${VERSION}/${LG}/${ARCH} ${MODL}
    else
        echo "skipped (no release.${MODL} file)"
        return 1
    fi
}

updates() {
    # Usage : updates <lang> <arch>
    LG=$1
    ARCH=$2
    SEARCHARCH="-name *.${ARCH}.rpm"  # Ugly hack because of ix86 stuff
    [ "${ARCH}" = "i386" ] && SEARCHARCH="-name *86.rpm -o -name *.athlon.rpm"
    shift 2
    rm -f ${APTDIR}/${DISTR}/${VERSION}/${LG}/${ARCH}/RPMS.updates/*
    find ${MIRRORDIR}/updates/${VERSION}/${LG}/ -type f ! -name *.src.rpm \
        \( ${SEARCHARCH} -o -name *.noarch.rpm \) \
        -exec ln {} ${APTDIR}/${DISTR}/${VERSION}/${LG}/${ARCH}/RPMS.updates/ \
        2>/dev/null \;
}

dma() {
    # Usage : dma <lang> <arch>
    LG=$1
    ARCH=$2
    SEARCHARCH="-name *.${ARCH}.rpm"  # Ugly hack because of ix86 stuff
    [ "${ARCH}" = "i386" ] && SEARCHARCH="-name *86.rpm -o -name *.athlon.rpm"
    shift 2
    rm -f ${APTDIR}/${DISTR}/${VERSION}/${LG}/${ARCH}/RPMS.dma/*
    find ${MIRRORDIR}/${VERSION}/${LG}/DMA/ -type f ! -name *.src.rpm \
        \( ${SEARCHARCH} -o -name *.noarch.rpm \) \
        -exec ln {} ${APTDIR}/${DISTR}/${VERSION}/${LG}/${ARCH}/RPMS.dma/ \
        2>/dev/null \;
    rm -f ${APTDIR}/${DISTR}/${VERSION}/${LG}/${ARCH}/SRPMS.dma/*
    find ${MIRRORDIR}/${VERSION}/${LG}/DMA/ -type f -name *.src.rpm \
        -exec ln {} ${APTDIR}/${DISTR}/${VERSION}/${LG}/${ARCH}/SRPMS.dma/ \
        2>/dev/null \;
}

extras() {
    # Usage : extras <lang> <arch>
    LG=$1
    ARCH=$2
    SEARCHARCH="-name *.${ARCH}.rpm"  # Ugly hack because of ix86 stuff
    [ "${ARCH}" = "i386" ] && SEARCHARCH="-name *86.rpm -o -name *.athlon.rpm"
    shift 2
    find ${APTDIR}/${DISTR}/${VERSION}/${LG}/${ARCH}/RPMS.extras/ -type f -exec rm '{}' \;
    #rm -f ${APTDIR}/${DISTR}/${VERSION}/${LG}/${ARCH}/RPMS.extras/*

    rm -f ${APTDIR}/${DISTR}/${VERSION}/${LG}/${ARCH}/SRPMS.extras/*
    find ${EXTRAS}/${DISTR}/${VERSION}/ -type f \
        ! -name *.src.rpm \( ${SEARCHARCH} -o -name *.noarch.rpm \) \
        -exec ln {} ${APTDIR}/${DISTR}/${VERSION}/${LG}/${ARCH}/RPMS.extras/ \
        2>/dev/null \;
    find ${EXTRAS}/${DISTR}/${VERSION}/ -type f -name *.src.rpm \
        -exec ln {} ${APTDIR}/${DISTR}/${VERSION}/${LG}/${ARCH}/SRPMS.extras/ \
        2>/dev/null \;
}



###########################
### White Box Linux 3.0 ###
###########################

VERSION="3.0"

hash30() {
    hash en i386 os updates extras
}

### os
if [ "$1" = "wb30" ]; then
    gen en i386 os && \
    hash30
fi

### updates
if [ "$1" = "wb30-up" ]; then
    updates en i386 && \
    gen en i386 updates && \
    hash30
fi

### extras
if [ "$1" = "wb30-ex" ]; then
    extras en i386 && \
    gen en i386 extras && \
    hash30
fi


--------------070803090403070904020404
Content-Type: text/x-sh;
 name="genlinks-wb.sh"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="genlinks-wb.sh"

#!/bin/sh

# $Id: genlinks.sh,v 1.5 2002/09/25 11:42:55 dude Exp $
#
# Script to automatically generate absolute links to your local Red Hat Linux
# mirror directories in order to later generate apt repositories.
#

if [ -z "$1" ]; then
    echo "Usage :   $0 <path to your Red Hat Linux mirror>"
    echo "Example : $0 /var/ftp/pub/whitebox/linux"
    exit 1
fi

if [ ! -d "./whitebox" ]; then
    echo "ERROR : Could not find \"whitebox\" directory in current working directory"
    echo "Please run this script from within your apt tree..."
fi

MIRDIR=$1

if [ -d "$1/3.0/en" ]; then
echo -n "Creating White Box Linux 3.0 en links..."
rm -f whitebox/3.0/en/i386/* 2>/dev/null
ln -s $1/3.0/RedHat/RPMS whitebox/3.0/en/i386/RPMS.os
ln -s $1/3.0/SRPMS whitebox/3.0/en/i386/SRPMS.os
ln -s $1/updates/3.0/SRPMS whitebox/3.0/en/i386/SRPMS.updates
echo " ...done"
fi

echo "You should now go into the apt tree and remove all unnecessary dirs and links."



--------------070803090403070904020404
Content-Type: text/x-sh;
 name="genall-wb.sh"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="genall-wb.sh"

#!/bin/sh
for i in wb30 wb30-ex wb30-up; do ./genaptrep.sh $i; done

--------------070803090403070904020404--