/[d-i]/trunk/build/Makefile
ViewVC logotype

Contents of /trunk/build/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 333 - (hide annotations) (download)
Fri Jan 12 02:10:03 2001 UTC (12 years, 5 months ago) by joeyh
File size: 3883 byte(s)
tweaks
1 joeyh 330 #!/usr/bin/make -f
2     #
3     # Debian Installer system makefile.
4     # Copyright 2001 by Joey Hess <joeyh@debian.org>.
5     # Licensed under the terms of the GPL.
6     #
7     # This makefile builds a debian-installer system from a collection of
8     # udebs.
9    
10 joeyh 324 # The type of system to build. Determines what udebs are unpacked into
11     # the system. See the .list files for various types. You may want to
12     # override this on the command line.
13     TYPE=net
14    
15 joeyh 332 # List here any extra udebs that are not in the list file but that
16 joeyh 329 # should still be included on the system.
17     EXTRAS=""
18    
19 joeyh 332 # Build tree location.
20     DEST=debian-installer
21 joeyh 324
22     # Directory apt uses for stuff.
23     APTDIR=apt
24    
25     # Directory udebs are placed in.
26     UDEBDIR=udebs
27    
28 joeyh 328 # Local directory that is searched for udebs, to avoid downloading.
29     # (Or for udebs that are not yet available for download.)
30     LOCALUDEBDIR=localudebs
31    
32 joeyh 331 # Figure out which sources.list to use. The .local one is preferred,
33     # so you can set up a locally preferred one (and not accidentially cvs
34     # commit it).
35     ifeq ($(wildcard sources.list.local),sources.list.local)
36     SOURCES_LIST=sources.list.local
37     else
38     SOURCES_LIST=sources.list
39     endif
40    
41 joeyh 332 # All these options makes apt read the right sources list, and
42 joeyh 324 # use APTDIR for everything so it need not run as root.
43     APT_GET=apt-get --assume-yes \
44 joeyh 331 -o Dir::Etc::sourcelist=./$(SOURCES_LIST) \
45 joeyh 324 -o Dir::State=$(APTDIR)/state \
46     -o Debug::NoLocking=true \
47     -o Dir::Cache=$(APTDIR)/cache
48    
49 joeyh 332 # Comments are allowed in the lists.
50 joeyh 329 UDEBS=$(shell grep --no-filename -v ^\# lists/base lists/$(TYPE)) $(EXTRAS)
51 joeyh 324
52 joeyh 326 build: tree reduce stats
53 joeyh 324
54 joeyh 325 demo:
55 joeyh 332 chroot $(DEST) bin/sh
56 joeyh 325
57 joeyh 324 clean:
58 joeyh 332 rm -rf $(DEST) $(APTDIR) $(UDEBDIR)
59 joeyh 324
60 joeyh 332 # Get all required udebs and put in UDEBDIR.
61 joeyh 324 get_udebs:
62     mkdir -p $(APTDIR)/state/lists/partial
63     mkdir -p $(APTDIR)/cache/archives/partial
64     $(APT_GET) update
65 joeyh 328 # If there are local udebs, remove them from the list of things to
66     # get. Then get all the udebs that are left to get.
67     needed="$(UDEBS)"; \
68 joeyh 329 for file in `find $(LOCALUDEBDIR) -type f -printf "%f\n" 2>/dev/null`; do \
69 joeyh 328 package=`echo $$file | cut -d _ -f 1`; \
70     needed=`echo $$needed | sed "s/$$package *//"`; \
71     done; \
72     echo $$needed; \
73     $(APT_GET) -dy install $$needed
74     # Now the udebs are in APTDIR/cache/archives/ and maybe LOCALUDEBDIR,
75     # but there may be other udebs there too besides those we asked for.
76     # So link those we asked for to UDEBDIR, renaming them to more useful
77     # names.
78 joeyh 324 rm -rf $(UDEBDIR)
79     mkdir -p $(UDEBDIR)
80     for package in $(UDEBS); do \
81 joeyh 328 if [ -e $(APTDIR)/cache/archives/$$package\_* ]; then \
82     ln -f $(APTDIR)/cache/archives/$$package\_* \
83     $(UDEBDIR)/$$package.udeb; \
84     fi; \
85     if [ -e $(LOCALUDEBDIR)/$$package\_* ]; then \
86     ln -f $(LOCALUDEBDIR)/$$package\_* \
87     $(UDEBDIR)/$$package.udeb; \
88     fi; \
89 joeyh 324 done
90    
91     # Build the installer tree.
92 joeyh 332 DPKGDIR=$(DEST)/var/lib/dpkg
93 joeyh 324 tree: get_udebs
94 joeyh 328 dh_testroot
95    
96 joeyh 324 # This build cannot be restarted, because dpkg gets confused.
97 joeyh 332 rm -rf $(DEST)
98 joeyh 324 # Set up the basic files [u]dpkg needs.
99     mkdir -p $(DPKGDIR)/info
100     touch $(DPKGDIR)/status
101     # Only dpkg needs this stuff, so it can be removed later.
102     mkdir -p $(DPKGDIR)/updates/
103     touch $(DPKGDIR)/available
104     # Unpack the udebs with dpkg, ignoring dependancies.
105 joeyh 328 # (So you'd better get the deps right in your .list files!)
106     # This command must run as root or fakeroot.
107 joeyh 332 dpkg --force-depends --root=$(DEST) --unpack $(UDEBDIR)/*.udeb
108 joeyh 324 # Clean up after dpkg.
109     rm -rf $(DPKGDIR)/updates
110 joeyh 332 rm -f $(DPKGDIR)/available $(DPKGDIR)/*-old $(DPKGDIR)/lock
111 joeyh 324 # TODO: configure some of the packages?
112    
113 joeyh 325 # This is temporary; I have filed a bug asking ash-udeb to include
114     # the link.
115 joeyh 332 ln -s ash $(DEST)/bin/sh
116 joeyh 325
117 joeyh 324 # Library reduction.
118 joeyh 333 reduce:
119 joeyh 332 mkdir -p $(DEST)/lib
120 joeyh 333 mklibs.sh -v -d $(DEST)/lib `find $(DEST) -type f -perm +0111`
121 joeyh 326
122     stats:
123     @echo
124     @echo System stats
125     @echo ------------
126     @echo Installed udebs: $(UDEBS)
127 joeyh 332 @echo Total system size: $(shell du -h -s $(DEST) | cut -f 1)
128 joeyh 326 # Add your interesting stats here.
129 joeyh 332

  ViewVC Help
Powered by ViewVC 1.1.5