summaryrefslogtreecommitdiff
path: root/pkgtools/cdpack
diff options
context:
space:
mode:
authordmcmahill <dmcmahill>2001-06-02 02:03:51 +0000
committerdmcmahill <dmcmahill>2001-06-02 02:03:51 +0000
commit0436008c0a12fef5717970158412d7c5422b9aa3 (patch)
treeadf4d5cc4629bffc548eadf0d08b303147f17cca /pkgtools/cdpack
parent6b07e80795e9387f734d93d51d8ec9d38a250cea (diff)
downloadpkgsrc-0436008c0a12fef5717970158412d7c5422b9aa3.tar.gz
update to cdpack-1.1.
Changes are: add a '-X directory' option which allows you to specify a directory whose contents should be included on the last CD of the set. This is useful for including, for example, a pkgsrc.tar.gz tarball which doesn't need to be duplicated on each CD. make the usage output be a little better. in particular, list the options and mention the existance of a manpage.
Diffstat (limited to 'pkgtools/cdpack')
-rw-r--r--pkgtools/cdpack/Makefile4
-rwxr-xr-xpkgtools/cdpack/files/cdgen.awk40
-rw-r--r--pkgtools/cdpack/files/cdpack.111
-rwxr-xr-xpkgtools/cdpack/files/cdpack.sh85
4 files changed, 116 insertions, 24 deletions
diff --git a/pkgtools/cdpack/Makefile b/pkgtools/cdpack/Makefile
index a70e6fde1d5..1a977561b44 100644
--- a/pkgtools/cdpack/Makefile
+++ b/pkgtools/cdpack/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.2 2001/05/09 03:30:25 dmcmahill Exp $
+# $NetBSD: Makefile,v 1.3 2001/06/02 02:03:51 dmcmahill Exp $
#
-DISTNAME= cdpack-1.0
+DISTNAME= cdpack-1.1
CATEGORIES= pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
diff --git a/pkgtools/cdpack/files/cdgen.awk b/pkgtools/cdpack/files/cdgen.awk
index 9c460e80b10..a3009bd85e0 100755
--- a/pkgtools/cdpack/files/cdgen.awk
+++ b/pkgtools/cdpack/files/cdgen.awk
@@ -1,5 +1,5 @@
#!/usr/bin/awk -f
-# $NetBSD: cdgen.awk,v 1.1.1.1 2001/04/27 18:16:42 dmcmahill Exp $
+# $NetBSD: cdgen.awk,v 1.2 2001/06/02 02:03:52 dmcmahill Exp $
#
# Copyright (c) 2001 Dan McMahill, All rights reserved.
#
@@ -43,7 +43,7 @@ BEGIN {
# ARGV[7] = verbose flag. "verbose=yes" for verbose output
# ARGV[8] = xtra_size. How many kB are needed per CD for common files
- if (ARGC != 9){
+ if (ARGC != 10){
printf("%s: wrong number of arguments\n",ARGV[0]);
usage();
exit(1);
@@ -56,6 +56,7 @@ BEGIN {
order = ARGV[4];
cdlist = ARGV[5];
xtra_size= ARGV[8];
+ other_size= ARGV[9];
if (ARGV[6] ~ "dup=yes"){
dup=1;
@@ -205,8 +206,22 @@ BEGIN {
}
}
cdpkgs[cdn] = pkgn;
- printf("cd number %d is partially full (%g Mb)\n",cdn,
- cdtot[cdn]/1024);
+
+# see if the extra files will fit on the last CD
+ if ( (cdtot[cdn] + other_size) < maxcd ){
+ printf("cd number %d is partially full (%g Mb)\n",cdn,
+ cdtot[cdn]/1024);
+ }
+ else{
+ printf("cd number %d is full (%g Mb)\n",cdn,
+ cdtot[cdn]/1024);
+ cdn = cdn + 1;
+ cdtot[cdn] = other_size;
+ cdpkgs[cdn] = 0;
+ printf("cd number %d is partially full (%g Mb)\n",cdn,
+ cdtot[cdn]/1024);
+ }
+
}
#
@@ -257,8 +272,21 @@ BEGIN {
}
cdpkgs[cdn] = pkgn;
- printf("cd number %d is partially full (%g Mb)\n",cdn,
- cdtot[cdn]/1024);
+
+# see if the extra files will fit on the last CD
+ if ( (cdtot[cdn] + other_size) < maxcd ){
+ printf("cd number %d is partially full (%g Mb)\n",cdn,
+ cdtot[cdn]/1024);
+ }
+ else{
+ printf("cd number %d is full (%g Mb)\n",cdn,
+ cdtot[cdn]/1024);
+ cdn = cdn + 1;
+ cdtot[cdn] = other_size;
+ cdpkgs[cdn] = 0;
+ printf("cd number %d is partially full (%g Mb)\n",cdn,
+ cdtot[cdn]/1024);
+ }
}
# remember how many cd's there are
diff --git a/pkgtools/cdpack/files/cdpack.1 b/pkgtools/cdpack/files/cdpack.1
index 8f9814166ca..83ba6b01392 100644
--- a/pkgtools/cdpack/files/cdpack.1
+++ b/pkgtools/cdpack/files/cdpack.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: cdpack.1,v 1.2 2001/05/03 00:29:06 dmcmahill Exp $
+.\" $NetBSD: cdpack.1,v 1.3 2001/06/02 02:03:52 dmcmahill Exp $
.\"
.\" Copyright (c) 2001 Dan McMahill, All rights reserved.
.\"
@@ -87,7 +87,14 @@ Print the program version number and exit.
.It Fl x Ar directory
Includes the contents of
.Ar directory
-on each CD.
+on each CD. This is useful for README files, etc., which you want
+to be present on each CD in the set.
+.It Fl X Ar directory
+Includes the contents of
+.Ar directory
+on the last CD in the set. This is useful for adding
+a pkgsrc.tar.gz tarball, i.e. a file which does not
+need to be on each CD.
.El
.Pp
The
diff --git a/pkgtools/cdpack/files/cdpack.sh b/pkgtools/cdpack/files/cdpack.sh
index 1ff5c7abf66..928b66d7dab 100755
--- a/pkgtools/cdpack/files/cdpack.sh
+++ b/pkgtools/cdpack/files/cdpack.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# $NetBSD: cdpack.sh,v 1.1.1.1 2001/04/27 18:16:42 dmcmahill Exp $
+# $NetBSD: cdpack.sh,v 1.2 2001/06/02 02:03:52 dmcmahill Exp $
#
# Copyright (c) 2001 Dan McMahill, All rights reserved.
#
@@ -55,8 +55,9 @@ mkdir $TMP
usage(){
echo "$prog - generates ISO9660 images for a multi-cd binary package collection"
- echo "Usage: $prog packages_directory cdimage_directory"
+ echo "Usage: $prog [-n] [-v] [-V] [-x dir] [-X dir] packages_directory cdimage_directory"
echo "Example: $prog /usr/pkgsrc/packages/netbsd-1.5/alpha/All /images/netbsd-1.5/alpha"
+ echo "Please refer to the manual page for complete documentation."
}
clean_and_exit(){
@@ -64,10 +65,25 @@ clean_and_exit(){
exit 1
}
+# return the full path name from a path which may
+# be a full path name or a relative path name
+fullpath(){
+ local x
+ x=$1
+ case $x in
+ /*) # do nothing, its an absolute path
+ ;;
+ *) x=`pwd`/$x
+ ;;
+ esac
+ echo $x
+}
+
DUP=yes
VERBOSE=no
VERSION=no
USE_XTRA=no
+USE_OTHERS=no
while
test -n "$1"
@@ -95,6 +111,12 @@ do
shift 2
;;
+ # extra directory to go on only 1 CD (pkgsrc.tar.gz for example)
+ -X) others=$2
+ USE_OTHERS=yes
+ shift 2
+ ;;
+
-*) echo "$prog: ERROR: $s is not a valid option"
usage
clean_and_exit
@@ -135,12 +157,16 @@ if [ ! -d $packages ]; then
echo "$prog: packages directory \"$packages\" does not exist"
usage
clean_and_exit
+else
+ packages=`fullpath $packages`
fi
if [ ! -d $cddir ]; then
echo "$prog: cd image directory \"$cddir\" does not exist"
usage
clean_and_exit
+else
+ cddir=`fullpath $cddir`
fi
if [ "$USE_XTRA" = "yes" -a ! -d $extra ]; then
@@ -150,20 +176,31 @@ if [ "$USE_XTRA" = "yes" -a ! -d $extra ]; then
fi
if [ "$USE_XTRA" = "yes" ]; then
- case $extra in
- /*) # do nothing, its an absolute path
- ;;
- *) extra=`pwd`/$extra
- ;;
- esac
- XTRA_SIZE=`du -sk $extra | awk '{print $1}'`
- if [ "$VERBOSE" = "yes" ]; then
- echo "Extra directory full path name is \"$extra\". It contains $XTRA_SIZE kB."
- fi
+ extra=`fullpath $extra`
+ XTRA_SIZE=`du -sk $extra | awk '{print $1}'`
+ if [ "$VERBOSE" = "yes" ]; then
+ echo "Extra directory full path name is \"$extra\". It contains $XTRA_SIZE kB."
+ fi
else
XTRA_SIZE=0
fi
+if [ "$USE_OTHERS" = "yes" -a ! -d $others ]; then
+ echo "$prog: other files directory \"$others\" specified with -X does not exist"
+ usage
+ clean_and_exit
+fi
+
+if [ "$USE_OTHERS" = "yes" ]; then
+ others=`fullpath $others`
+ OTHER_SIZE=`du -sk $others | awk '{print $1}'`
+ if [ "$VERBOSE" = "yes" ]; then
+ echo "Other files directory full path name is \"$others\". It contains $OTHER_SIZE kB."
+ fi
+else
+ OTHER_SIZE=0
+fi
+
echo " "
echo "$prog starting: `date`"
echo " "
@@ -255,9 +292,9 @@ tsort $deptree > $order
# cdlist = ARGV[5];
#
if [ "$VERBOSE" = "yes" ]; then
- echo "awk -f cdgen.awk $packages $cddir $deptree $order $cdlist dup=$DUP"
+ echo "awk -f @prefix@/libexec/cdgen.awk $packages $cddir $deptree $order $cdlist dup=$DUP verbose=$VERBOSE $XTRA_SIZE $OTHER_SIZE"
fi
-awk -f @prefix@/libexec/cdgen.awk $packages $cddir $deptree $order $cdlist dup=$DUP verbose=$VERBOSE $XTRA_SIZE
+awk -f @prefix@/libexec/cdgen.awk $packages $cddir $deptree $order $cdlist dup=$DUP verbose=$VERBOSE $XTRA_SIZE $OTHER_SIZE
if [ $? -ne 0 ]; then
echo "$prog: ERROR: cdgen.awk has failed"
@@ -328,6 +365,14 @@ sort ${indexf}.tmp > $indexf
# actually copy these over since the originals will
# be deleted from their temporary directories
#
+# Also make symlinks to the stuff in the extra directory
+# specified with the -x flag.
+#
+
+if [ $VERBOSE = "yes" ]; then
+ echo "Copying .index file to the image directories."
+fi
+
ncds=0
for cdname in `cat $cdlist`
do
@@ -344,6 +389,18 @@ do
ncds=$(($ncds + 1))
done
+
+if [ $USE_OTHERS = "yes" ]; then
+ if [ $VERBOSE = "yes" ]; then
+ echo "Creating symlinks from $others (specified with -X) to ${cddir}/${cdname}"
+ fi
+ cdname=`tail -1 $cdlist`
+ for f in $others/*
+ do
+ (cd ${cddir}/${cdname} && ln -sf $f)
+ done
+fi
+
#
# Create the ISO Images
#