debian-cd-clone/tools/add_secured

95 lines
3.5 KiB
Plaintext
Raw Normal View History

#!/bin/sh
# We are in the temp directory of a CD image
# aka $[SB]DIR/CD<x>/
# Everything is already in place (just md5sum.txt missing)
# Complete the "Release" file if it exists
if [ -e "dists/$CODENAME/Release" ]; then
# Add the MD5Sum field again
echo "MD5Sum:" >> dists/$CODENAME/Release
find dists/$CODENAME/ -name 'Packages' -o -name 'Packages.gz' \
-o -name 'Sources' -o -name 'Sources.gz' -o -name 'Release' | \
grep -v non-US/ | grep -v dists/$CODENAME/Release | \
sed -e "s#^dists/$CODENAME/##" | \
(while read file; do \
rfile="dists/$CODENAME/$file"; \
c=`wc -c < $rfile`; \
m=`md5sum < $rfile | cut -d" " -f1`; \
printf " %s %8d %s\n" $m $c $file; \
done) >> dists/$CODENAME/Release
# TODO: Should add SHA1 field here
# Check with libdigest-sha1-perl
fi
if [ -n "$NONUS" -a -e "dists/$CODENAME/non-US/Release" ]; then
# Add the MD5Sum field again
echo "MD5Sum:" >> dists/$CODENAME/non-US/Release
find dists/$CODENAME/non-US/ -name 'Packages' -o -name 'Packages.gz' \
-o -name 'Sources' -o -name 'Sources.gz' -o -name 'Release' | \
grep -v dists/$CODENAME/non-US/Release | \
sed -e "s#^dists/$CODENAME/non-US/##" | \
(while read file; do \
rfile="dists/$CODENAME/non-US/$file"; \
c=`wc -c < $rfile`; \
m=`md5sum < $rfile | cut -d" " -f1`; \
printf " %s %8d %s\n" $m $c $file; \
done) >> dists/$CODENAME/non-US/Release
# TODO: Should add SHA1 field here
# Check with libdigest-sha1-perl
fi
# Create the $CODENAME-secured tree by copying files from the mirror
# And including the Release file and its signature
if [ -n "$SECURED" ]; then
test -d "dists/$CODENAME-secured" || mkdir dists/$CODENAME-secured
if [ -e "$MIRROR/dists/$CODENAME/Release" ]; then
# Copy Release and Release.gpg files
cp $MIRROR/dists/$CODENAME/Release dists/$CODENAME-secured/
if [ -e "$MIRROR/dists/$CODENAME/Release.gpg" ]; then
cp $MIRROR/dists/$CODENAME/Release.gpg dists/$CODENAME-secured/
fi
# Create the .aptignr file in the standard tree
:> dists/$CODENAME/.aptignr
# Include files listed in Release that corresponds to our arch
grep "^ " dists/$CODENAME-secured/Release | \
egrep "binary-$ARCH/|source/" | \
(while read m s file; do \
dir="dists/$CODENAME-secured/`dirname $file`"; \
test -d "$dir" || mkdir -p $dir; \
cp $MIRROR/dists/$CODENAME/$file $dir/; \
done)
# Create the files.list.gz
(find pool/ -type f; find dists/ -type f) | \
gzip --best -c > dists/$CODENAME-secured/files.list.gz
fi
if [ -n "$NONUS" -a -e "$NONUS/dists/$CODENAME/non-US/Release" ]; then
if [ ! -d "dists/$CODENAME-secured/non-US" ]; then
mkdir dists/$CODENAME-secured/non-US
fi
# Copy Release and Release.gpg files
cp $NONUS/dists/$CODENAME/non-US/Release dists/$CODENAME-secured/non-US/
if [ -e "$NONUS/dists/$CODENAME/non-US/Release.gpg" ]; then
cp $NONUS/dists/$CODENAME/non-US/Release.gpg \
dists/$CODENAME-secured/non-US/
fi
# Include files listed in Release that corresponds to our arch
grep "^ " dists/$CODENAME-secured/non-US/Release | \
egrep "binary-$ARCH/|source/" | \
(while read m s file; do \
dir="dists/$CODENAME-secured/non-US/`dirname $file`"; \
test -d "$dir" || mkdir -p $dir; \
cp $NONUS/dists/$CODENAME/non-US/$file $dir/; \
done)
# The non-US files.list.gz is the same than the main one
ln -sf ../files.list.gz dists/$CODENAME-secured/non-US/files.list.gz
fi
fi # if secured