* Added two new variables, COPYLINK and APTTMP. I had to do this with my

setup which consists of an NFS mounted archive, the NFS mount was also
  used for the tmp space since it had room, and the iso images were
  created on the local drive, where it also had room. DOing symlink was
  crazy and didn't work too well, and the apt stuff could not be on the
  NFS tmp since apt's locking doesn't work on NFS. Problem solved, this
  should work exactly like it did before with these defaults though.
  COPYLINK basically makes a full copy of the files instead of hardlinking
  or symlinking.
This commit is contained in:
Ben Collins 2000-03-14 04:02:29 +00:00
parent e1acb251bf
commit a2ccae3471
6 changed files with 63 additions and 38 deletions

34
CONF.sh
View File

@ -12,35 +12,47 @@ export CODENAME=potato
# ... for arch
export ARCH=i386
# IMPORTANT : The 3 following paths must be on the same partition/device
# or you won't be able to use debian-cd in the standard way.
# If really you can't then, you can try with the symlink farm,
# read the README for more information about this.
# IMPORTANT : The 4 following paths must be on the same partition/device.
# If they aren't then you must set COPYLINK below to 1. This
# takes a lot of extra room to create the sandbox for the ISO
# images, however. Also, if you are using an NFS partition for
# some part of this, you must use this option.
# Paths to the mirrors
export MIRROR=/ftp/debian
# Comment the following line if you don't have/want non-US
export NONUS=/ftp/debian-non-US
#export NONUS=/ftp/debian-non-US
# Path of the temporary directory
export TDIR=/ftp/tmp
# Path where the images will be written
export OUT=/rack/debian-cd
# Where we keep the temporary apt stuff.
# This cannot reside on an NFS mount.
export APTTMP=/ftp/tmp/apt
# Do I want to have NONFREE
# export NONFREE=1
# If you have a $MIRROR/dists/$CODENAME/local/binary-$ARCH dir with
# local packages that you want to put on the CD set then
# uncomment the following line
#export LOCAL=1
# export LOCAL=1
# Sparc only : bootdir (location of cd.b and second.b)
#export BOOTDIR=
# export BOOTDIR=/boot
# Symlink farmers should uncomment this line :
#export SYMLINK=1
# export SYMLINK=1
# Use this to force copying the files instead of symlinking or hardlinking
# them. This is useful if your destination directories are on a different
# partition than your source files.
# export COPYLINK=1
# Options
#export MKISOFS=/usr/bin/mkhybrid
#export MKISOFS_OPTS="-a -r -T" #For normal users
#export MKISOFS_OPTS="-a -r -F -T" #For symlink farmers
# export MKISOFS=/usr/bin/mkhybrid
export MKISOFS_OPTS="-a -r -T" #For normal users
# export MKISOFS_OPTS="-a -r -F -T" #For symlink farmers

View File

@ -60,6 +60,7 @@ addfiles=$(BASEDIR)/tools/add_files
set_mkisofs_opts=$(BASEDIR)/tools/set_mkisofs_opts
BDIR=$(TDIR)/$(CODENAME)-$(ARCH)
ADIR=$(APTTMP)/$(CODENAME)-$(ARCH)
SDIR=$(TDIR)/$(CODENAME)-src
## CHECKS ##
@ -97,13 +98,15 @@ ok:
## INITIALIZATION ##
# Creation of the directories needed
init: ok $(TDIR) $(BDIR) $(SDIR)
init: ok $(TDIR) $(BDIR) $(SDIR) $(ADIR)
$(TDIR):
@mkdir -p $(TDIR)
$(BDIR):
@mkdir -p $(BDIR)
$(SDIR):
@mkdir -p $(SDIR)
$(ADIR):
@mkdir -p $(ADIR)
## CLEANINGS ##
@ -130,14 +133,14 @@ src-distclean:
# Regenerate the status file with only packages that
# are of priority standard or higher
status: init $(BDIR)/status
$(BDIR)/status:
status: init $(ADIR)/status
$(ADIR)/status:
@echo "Generating a fake status file for apt-get and apt-cache..."
@zcat $(MIRROR)/dists/$(CODENAME)/main/binary-$(ARCH)/Packages.gz | \
perl -000 -ne 's/^(Package: .*)$$/$$1\nStatus: install ok installed/m; \
print if (/^Priority: (required|important|standard)/m or \
/^Section: base/m);' \
> $(BDIR)/status
> $(ADIR)/status
# Updating the apt database
@$(apt) update
#
@ -156,7 +159,7 @@ correctstatus: status apt-update
@for i in `$(apt) deselected -f install`; do \
echo $$i; \
perl -i -000 -ne "print unless /^Package: \Q$$i\E/m" \
$(BDIR)/status; \
$(ADIR)/status; \
done
#
# Adding packages to the system :
@ -165,7 +168,7 @@ correctstatus: status apt-update
$(apt) cache dumpavail | perl -000 -ne \
"s/^(Package: .*)\$$/\$$1\nStatus: install ok installed/m; \
print if /^Package: \Q$$i\E\s*\$$/m;" \
>> $(BDIR)/status; \
>> $(ADIR)/status; \
done
#
# Showing the output of apt-get check :
@ -531,5 +534,5 @@ src-official_images: ok src-images
$(CODENAME)_status: ok init
@echo "Using the provided status file for $(CODENAME)-$(ARCH) ..."
@cp $(BASEDIR)/data/$(CODENAME)/status.$(ARCH) $(BDIR)/status \
@cp $(BASEDIR)/data/$(CODENAME)/status.$(ARCH) $(ADIR)/status \
2>/dev/null || $(MAKE) status || $(MAKE) correctstatus

View File

@ -8,23 +8,23 @@
# set -e
# Get the configuration information if necessary
if [ -z "$TDIR" -o -z "$CODENAME" -o -z "$ARCH" ]; then
if [ -z "$CODENAME" -o -z "$ARCH" -o -z "$APTTMP" ]; then
if [ -e CONF.sh ]; then
source CONF.sh
else
echo "Please set the good environment variables before "
echo "launching this program ..."
echo "Current values are :"
echo "TDIR=$TDIR"
echo "CODENAME=$CODENAME"
echo "ARCH=$ARCH"
echo "APTTMP=$APTTMP"
fi
fi
options=" -o Dir::State::status=$TDIR/$CODENAME-$ARCH/status \
-o Dir::State=$TDIR/$CODENAME-$ARCH/apt-state/ \
-o Dir::Cache=$TDIR/$CODENAME-$ARCH/apt-cache/ \
-o Dir::Etc=$TDIR/$CODENAME-$ARCH/apt/ \
options=" -o Dir::State::status=$APTTMP/$CODENAME-$ARCH/status \
-o Dir::State=$APTTMP/$CODENAME-$ARCH/apt-state/ \
-o Dir::Cache=$APTTMP/$CODENAME-$ARCH/apt-cache/ \
-o Dir::Etc=$APTTMP/$CODENAME-$ARCH/apt/ \
-o APT::Architecture=$ARCH "
if [ -n "$NONFREE" ]; then
@ -34,37 +34,37 @@ else
fi
# Check for the necessary dirs and files ...
if [ ! -d "$TDIR/$CODENAME-$ARCH/apt-state/lists/partial" ]; then
mkdir -p "$TDIR/$CODENAME-$ARCH/apt-state/lists/partial"
if [ ! -d "$APTTMP/$CODENAME-$ARCH/apt-state/lists/partial" ]; then
mkdir -p "$APTTMP/$CODENAME-$ARCH/apt-state/lists/partial"
fi
if [ ! -d "$TDIR/$CODENAME-$ARCH/apt-cache/archives/partial" ]; then
mkdir -p "$TDIR/$CODENAME-$ARCH/apt-cache/archives/partial"
if [ ! -d "$APTTMP/$CODENAME-$ARCH/apt-cache/archives/partial" ]; then
mkdir -p "$APTTMP/$CODENAME-$ARCH/apt-cache/archives/partial"
fi
if [ ! -d "$TDIR/$CODENAME-$ARCH/apt" ]; then
mkdir -p "$TDIR/$CODENAME-$ARCH/apt"
if [ ! -d "$APTTMP/$CODENAME-$ARCH/apt" ]; then
mkdir -p "$APTTMP/$CODENAME-$ARCH/apt"
fi
if [ ! -e "$TDIR/$CODENAME-$ARCH/apt/sources.list" ]; then
if [ ! -e "$APTTMP/$CODENAME-$ARCH/apt/sources.list" ]; then
# Generating a correct sources.list file
echo "deb file:$MIRROR $CODENAME $sections" \
> $TDIR/$CODENAME-$ARCH/apt/sources.list
> $APTTMP/$CODENAME-$ARCH/apt/sources.list
if [ -n "$NONUS" ]; then
# Slink used the old paths
if [ "$CODENAME" = "slink" ]; then
echo "deb file:$NONUS $CODENAME non-US" \
>> $TDIR/$CODENAME-$ARCH/apt/sources.list
>> $APTTMP/$CODENAME-$ARCH/apt/sources.list
else
echo "deb file:$NONUS $CODENAME/non-US $sections" \
>> $TDIR/$CODENAME-$ARCH/apt/sources.list
>> $APTTMP/$CODENAME-$ARCH/apt/sources.list
fi
fi
# Local packages ...
if [ -n "$LOCAL" ]; then
echo "deb file:$MIRROR $CODENAME local" \
>> $TDIR/$CODENAME-$ARCH/apt/sources.list
>> $APTTMP/$CODENAME-$ARCH/apt/sources.list
fi
fi
temp=$TDIR/$CODENAME-$ARCH/temp.apt-selection
temp=$APTTMP/$CODENAME-$ARCH/temp.apt-selection
# Launch the command
if [ "$1" = "update" -o "$1" = "check" ]; then

View File

@ -20,6 +20,7 @@ my $complete = $ENV{'COMPLETE'} || 0;
my $local = $ENV{'LOCAL'} || 0;
my $bdir = "$ENV{'TDIR'}/$ENV{'CODENAME'}-$ENV{'ARCH'}";
my $adir = "$ENV{'APTTMP'}/$ENV{'CODENAME'}-$ENV{'ARCH'}";
my $sdir = "$ENV{'TDIR'}/$ENV{'CODENAME'}-src";
my $verbose = $ENV{'VERBOSE'} || 0;

View File

@ -4,6 +4,7 @@ use strict;
my $symlink_farm = $ENV{'SYMLINK'} || 0;
my $link_verbose = $ENV{'VERBOSE'} || 0;
my $link_copy = $ENV{'COPYLINK'} || 0;
sub good_link ($$) {
my ($src, $dest) = @_;
@ -25,8 +26,15 @@ sub good_link ($$) {
if (not symlink ($src, $dest)) {
print STDERR "Symlink from $src to $dest failed: $!\n";
}
} elsif ($link_copy) {
print "Copy: $dest => $src\n" if ($link_verbose >= 3);
if (system("cp -ap $src $dest")) {
my $err_num = $? >> 8;
my $sig_num = $? & 127;
print STDERR "Copy from $src to $dest failed: cp exited with error code $err_num, signal $sig_num\n";
}
} else {
print "Harlink: $dest => $src\n" if ($link_verbose >= 3);
print "Hardlink: $dest => $src\n" if ($link_verbose >= 3);
if (not link ($src, $dest)) {
print STDERR "Link from $src to $dest failed: $!\n";
}

View File

@ -21,6 +21,7 @@ my $complete = $ENV{'COMPLETE'} || 0;
my $exclude = $ENV{'EXCLUDE'} || "$list.exclude";
my $apt = "$ENV{'BASEDIR'}/tools/apt-selection";
my $adir = "$ENV{'APTTMP'}/$ENV{'CODENAME'}-$ENV{'ARCH'}";
my $dir = "$ENV{'TDIR'}/$ENV{'CODENAME'}-$ENV{'ARCH'}";
my $verbose = $ENV{'VERBOSE'} || 0;
@ -128,7 +129,7 @@ my ($total_size, $cd_size, $size, $cd) = (0, 0, 0, 1);
my %cds;
# Automatically include packages listed in the status file
open(STATUS, "< $dir/status") || die "Can't open status file : $!\n";
open(STATUS, "< $adir/status") || die "Can't open status file : $!\n";
while (defined($_ = <STATUS>)) {
next if not m/^Package: (\S+)/;
$p = $1;