Hauke
Joined: 02 Mar 2003 Posts: 1072
|
Posted: Tue Mar 01, 2005 10:24 Post subject: |
|
|
Hi,
the following code was tested with the set of Woody CDs. Copy + paste the code to /m23/bin/cds2pool and make the file executable (chmod +x /m23/bin/cds2pool):
Code: | #!/bin/sh
function mkPackages
{
#$1: name of the directory to store the Packages*
#$2: directory of the debs
touch tempmkpackages
mkdir -p $1
rm $1/Packages.bz2 2> /dev/null
dpkg-scanpackages $2 tempmkpackages > $1/Packages
gzip -c $1/Packages > $1/Packages.gz
bzip2 -k $1/Packages
rm tempmkpackages
}
function checkInstalled
{
#$1: file name, that should be used to check, if the package is installed
#$2: package name to install
found=`whereis $1 | sed "s/$1://" | tr -d [:blank:]`
if test -z $found
then
echo "$2 is not installed and will now be installed"
apt-get update
apt-get install $2
echo "Press \"Enter\" to continue, if $2 could be installed or \"Ctrl+C\" to exit"
fi
}
function showSourceslist
{
#$1 poolName
serverIP=`grep address /etc/network/interfaces | cut -d's' -f3 | cut -d' ' -f2`
echo "Add the following TWO lines in a new package source in the m23 GUI"
echo "#mirror: http://$serverIP/$1"
echo "deb http://$serverIP/$1/ stable main contrib"
}
echo "Please enter the name of the pool you want to create"
read poolName
mkdir -p /m23/data+scripts/$poolName
cd /m23/data+scripts/$poolName
#check, if rsync is installed and install it, if not
checkInstalled rsync rsync
checkInstalled dpkg-scanpackages dpkg-dev
echo "Please enter the mount point of the CD/DVD drive you want to use and press \"Enter\". (e.g. /mnt/cdrom1)"
read cdromMnt
key="n"
echo "Please insert the first Debian CD and press \"Enter\""
read
#CD copy loop
while test -n $key && test $key == "n"
do
mount $cdromMnt
rsync -avz $cdromMnt/{indices,dists,pool} .
eject $cdromMnt 2> /dev/null
umount $cdromMnt 2> /dev/null
echo "Insert the next Debian CD and press \"n\" + \"Enter\" or only \"Enter\" if the last CD just has been copied"
read key
done
rm -r /m23/data+scripts/$poolName/pool/main/m23
cp /mdk/m23Debs/debs /m23/data+scripts/$poolName/pool/main/m23 -r
echo "building the Packages*"
echo "This may take a while..."
mkPackages dists/woody/main/binary-i386 pool/main
mkPackages dists/woody/contrib/binary-i386 pool/contrib
/m23/bin/fix-permissions
showSourceslist $poolName |
You are asked after the CDs when you execute the script. The script builds a pool with all packages on the CDs. The packages "dpkg-dev" and "rsync" have to be installed on the server (in the current release they aren't).
At the end the script shows a package sources list that you have to enter in the m23 GUI.
You can now install from the new package pool if all works well. _________________ Hauke Goos-Habermann
- project leader m23 (http://m23.sf.net) -
Jabber: dodgerm23@jabber.org
Schulung, Entwicklung und Support zu m23 und anderen OpenSource-Produkten: www.goos-habermann.de
Auch DU kannst etwas gegen Softwarepatente tun! www.patentfrei.de |
|