| 1 |
joeyh |
324 |
# The type of system to build. Determines what udebs are unpacked into
|
| 2 |
|
|
# the system. See the .list files for various types. You may want to
|
| 3 |
|
|
# override this on the command line.
|
| 4 |
|
|
TYPE=net
|
| 5 |
|
|
|
| 6 |
|
|
# Build tree location. This can be overridden too.
|
| 7 |
|
|
TREE=builddir
|
| 8 |
|
|
|
| 9 |
|
|
# Directory apt uses for stuff.
|
| 10 |
|
|
APTDIR=apt
|
| 11 |
|
|
|
| 12 |
|
|
# Directory udebs are placed in.
|
| 13 |
|
|
UDEBDIR=udebs
|
| 14 |
|
|
|
| 15 |
|
|
# All these options makes apt read ./sources.list, and
|
| 16 |
|
|
# use APTDIR for everything so it need not run as root.
|
| 17 |
|
|
APT_GET=apt-get --assume-yes \
|
| 18 |
|
|
-o Dir::Etc::sourcelist=./sources.list \
|
| 19 |
|
|
-o Dir::State=$(APTDIR)/state \
|
| 20 |
|
|
-o Debug::NoLocking=true \
|
| 21 |
|
|
-o Dir::Cache=$(APTDIR)/cache
|
| 22 |
|
|
|
| 23 |
|
|
UDEBS=$(shell grep --no-filename -v ^\# lists/base lists/$(TYPE) )
|
| 24 |
|
|
|
| 25 |
joeyh |
326 |
build: tree reduce stats
|
| 26 |
joeyh |
324 |
|
| 27 |
joeyh |
325 |
demo:
|
| 28 |
|
|
chroot $(TREE) bin/sh
|
| 29 |
|
|
|
| 30 |
joeyh |
324 |
clean:
|
| 31 |
|
|
rm -rf $(TREE) $(APTDIR) $(UDEBDIR)
|
| 32 |
|
|
|
| 33 |
|
|
# Download all required udebs to UDEBDIR
|
| 34 |
|
|
get_udebs:
|
| 35 |
|
|
mkdir -p $(APTDIR)/state/lists/partial
|
| 36 |
|
|
mkdir -p $(APTDIR)/cache/archives/partial
|
| 37 |
|
|
$(APT_GET) update
|
| 38 |
|
|
$(APT_GET) -dy install $(UDEBS)
|
| 39 |
|
|
# Now the udebs are in APTDIR/cache/archives/, but there may be
|
| 40 |
|
|
# other udebs there too besides those we asked for. So link those
|
| 41 |
|
|
# we asked for to UDEBDIR, renaming them to more useful names.
|
| 42 |
|
|
rm -rf $(UDEBDIR)
|
| 43 |
|
|
mkdir -p $(UDEBDIR)
|
| 44 |
|
|
for package in $(UDEBS); do \
|
| 45 |
|
|
ln $(APTDIR)/cache/archives/$$package\_*.deb $(UDEBDIR)/$$package.udeb; \
|
| 46 |
|
|
done
|
| 47 |
|
|
|
| 48 |
|
|
# Build the installer tree.
|
| 49 |
|
|
DPKGDIR=$(TREE)/var/lib/dpkg
|
| 50 |
|
|
tree: get_udebs
|
| 51 |
|
|
# This build cannot be restarted, because dpkg gets confused.
|
| 52 |
|
|
rm -rf $(TREE)
|
| 53 |
|
|
# Set up the basic files [u]dpkg needs.
|
| 54 |
|
|
mkdir -p $(DPKGDIR)/info
|
| 55 |
|
|
touch $(DPKGDIR)/status
|
| 56 |
|
|
# Only dpkg needs this stuff, so it can be removed later.
|
| 57 |
|
|
mkdir -p $(DPKGDIR)/updates/
|
| 58 |
|
|
touch $(DPKGDIR)/available
|
| 59 |
|
|
# Unpack the udebs with dpkg, ignoring dependancies.
|
| 60 |
|
|
fakeroot dpkg --force-depends --root=$(TREE) --unpack $(UDEBDIR)/*.udeb
|
| 61 |
|
|
# Clean up after dpkg.
|
| 62 |
|
|
rm -rf $(DPKGDIR)/updates
|
| 63 |
|
|
rm -f $(DPKGDIR)/available $(DPKGDIR)/available-old \
|
| 64 |
|
|
$(DPKGDIR)/status-old $(DPKGDIR)/lock
|
| 65 |
|
|
# TODO: configure some of the packages?
|
| 66 |
|
|
# To save a little room, the status file could be reduced
|
| 67 |
|
|
# to only contain those fields that udpkg knows about.
|
| 68 |
|
|
|
| 69 |
joeyh |
325 |
# This is temporary; I have filed a bug asking ash-udeb to include
|
| 70 |
|
|
# the link.
|
| 71 |
|
|
ln -s ash builddir/bin/sh
|
| 72 |
|
|
|
| 73 |
joeyh |
324 |
# Library reduction.
|
| 74 |
|
|
reduce: tree
|
| 75 |
|
|
mkdir -p $(TREE)/lib
|
| 76 |
|
|
mklibs.sh -d $(TREE)/lib `find $(TREE) -type f -perm +0111`
|
| 77 |
joeyh |
326 |
|
| 78 |
|
|
stats:
|
| 79 |
|
|
@echo
|
| 80 |
|
|
@echo System stats
|
| 81 |
|
|
@echo ------------
|
| 82 |
|
|
@echo Installed udebs: $(UDEBS)
|
| 83 |
|
|
@echo Total system size: $(shell du -h -s $(TREE) | cut -f 1)
|
| 84 |
|
|
# Add your interesting stats here.
|
| 85 |
|
|
|