| 12 |
# Directory udebs are placed in. |
# Directory udebs are placed in. |
| 13 |
UDEBDIR=udebs |
UDEBDIR=udebs |
| 14 |
|
|
| 15 |
|
# Local directory that is searched for udebs, to avoid downloading. |
| 16 |
|
# (Or for udebs that are not yet available for download.) |
| 17 |
|
LOCALUDEBDIR=localudebs |
| 18 |
|
|
| 19 |
# All these options makes apt read ./sources.list, and |
# All these options makes apt read ./sources.list, and |
| 20 |
# use APTDIR for everything so it need not run as root. |
# use APTDIR for everything so it need not run as root. |
| 21 |
APT_GET=apt-get --assume-yes \ |
APT_GET=apt-get --assume-yes \ |
| 24 |
-o Debug::NoLocking=true \ |
-o Debug::NoLocking=true \ |
| 25 |
-o Dir::Cache=$(APTDIR)/cache |
-o Dir::Cache=$(APTDIR)/cache |
| 26 |
|
|
| 27 |
UDEBS=$(shell grep --no-filename -v ^\# lists/base lists/$(TYPE) ) |
UDEBS=$(shell grep --no-filename -v ^\# lists/base lists/$(TYPE)) |
| 28 |
|
|
| 29 |
build: tree reduce stats |
build: tree reduce stats |
| 30 |
|
|
| 39 |
mkdir -p $(APTDIR)/state/lists/partial |
mkdir -p $(APTDIR)/state/lists/partial |
| 40 |
mkdir -p $(APTDIR)/cache/archives/partial |
mkdir -p $(APTDIR)/cache/archives/partial |
| 41 |
$(APT_GET) update |
$(APT_GET) update |
| 42 |
$(APT_GET) -dy install $(UDEBS) |
# If there are local udebs, remove them from the list of things to |
| 43 |
# Now the udebs are in APTDIR/cache/archives/, but there may be |
# get. Then get all the udebs that are left to get. |
| 44 |
# other udebs there too besides those we asked for. So link those |
needed="$(UDEBS)"; \ |
| 45 |
# we asked for to UDEBDIR, renaming them to more useful names. |
for file in `find $(LOCALUDEBDIR) -type f -printf %f 2>/dev/null`; do \ |
| 46 |
|
package=`echo $$file | cut -d _ -f 1`; \ |
| 47 |
|
needed=`echo $$needed | sed "s/$$package *//"`; \ |
| 48 |
|
done; \ |
| 49 |
|
echo $$needed; \ |
| 50 |
|
$(APT_GET) -dy install $$needed |
| 51 |
|
# Now the udebs are in APTDIR/cache/archives/ and maybe LOCALUDEBDIR, |
| 52 |
|
# but there may be other udebs there too besides those we asked for. |
| 53 |
|
# So link those we asked for to UDEBDIR, renaming them to more useful |
| 54 |
|
# names. |
| 55 |
rm -rf $(UDEBDIR) |
rm -rf $(UDEBDIR) |
| 56 |
mkdir -p $(UDEBDIR) |
mkdir -p $(UDEBDIR) |
| 57 |
for package in $(UDEBS); do \ |
for package in $(UDEBS); do \ |
| 58 |
ln $(APTDIR)/cache/archives/$$package\_*.deb $(UDEBDIR)/$$package.udeb; \ |
if [ -e $(APTDIR)/cache/archives/$$package\_* ]; then \ |
| 59 |
|
ln -f $(APTDIR)/cache/archives/$$package\_* \ |
| 60 |
|
$(UDEBDIR)/$$package.udeb; \ |
| 61 |
|
fi; \ |
| 62 |
|
if [ -e $(LOCALUDEBDIR)/$$package\_* ]; then \ |
| 63 |
|
ln -f $(LOCALUDEBDIR)/$$package\_* \ |
| 64 |
|
$(UDEBDIR)/$$package.udeb; \ |
| 65 |
|
fi; \ |
| 66 |
done |
done |
| 67 |
|
|
| 68 |
# Build the installer tree. |
# Build the installer tree. |
| 69 |
DPKGDIR=$(TREE)/var/lib/dpkg |
DPKGDIR=$(TREE)/var/lib/dpkg |
| 70 |
tree: get_udebs |
tree: get_udebs |
| 71 |
|
dh_testroot |
| 72 |
|
|
| 73 |
# This build cannot be restarted, because dpkg gets confused. |
# This build cannot be restarted, because dpkg gets confused. |
| 74 |
rm -rf $(TREE) |
rm -rf $(TREE) |
| 75 |
# Set up the basic files [u]dpkg needs. |
# Set up the basic files [u]dpkg needs. |
| 79 |
mkdir -p $(DPKGDIR)/updates/ |
mkdir -p $(DPKGDIR)/updates/ |
| 80 |
touch $(DPKGDIR)/available |
touch $(DPKGDIR)/available |
| 81 |
# Unpack the udebs with dpkg, ignoring dependancies. |
# Unpack the udebs with dpkg, ignoring dependancies. |
| 82 |
fakeroot dpkg --force-depends --root=$(TREE) --unpack $(UDEBDIR)/*.udeb |
# (So you'd better get the deps right in your .list files!) |
| 83 |
|
# This command must run as root or fakeroot. |
| 84 |
|
dpkg --force-depends --root=$(TREE) --unpack $(UDEBDIR)/*.udeb |
| 85 |
# Clean up after dpkg. |
# Clean up after dpkg. |
| 86 |
rm -rf $(DPKGDIR)/updates |
rm -rf $(DPKGDIR)/updates |
| 87 |
rm -f $(DPKGDIR)/available $(DPKGDIR)/available-old \ |
rm -f $(DPKGDIR)/available $(DPKGDIR)/available-old \ |