]> git.ipfire.org Git - ipfire-3.x.git/blob - lfs/stage2
s/TARGET/OBJECT/g
[ipfire-3.x.git] / lfs / stage2
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007 Michael Tremer & Christian Schmidt #
5 # #
6 # This program is free software: you can redistribute it and/or modify #
7 # it under the terms of the GNU General Public License as published by #
8 # the Free Software Foundation, either version 3 of the License, or #
9 # (at your option) any later version. #
10 # #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
15 # #
16 # You should have received a copy of the GNU General Public License #
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
18 # #
19 ###############################################################################
20
21 ###############################################################################
22 # Definitions
23 ###############################################################################
24
25 include Config
26
27 PKG_NAME = stage2
28 VER = LFS
29
30 THISAPP = $(PKG_NAME)-$(VER)
31
32 OBJECT = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)
33
34 ###############################################################################
35 # Top-level Rules
36 ###############################################################################
37
38 install : $(OBJECT)
39
40 download :
41
42 ###############################################################################
43 # Installation Details
44 ###############################################################################
45
46 $(OBJECT) :
47 @$(PREBUILD)
48
49 # Create directories
50 -mkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib,mnt,opt}
51 -mkdir -pv /{media/{floppy,cdrom},sbin,srv,var}
52 -install -dv -m 0750 /root
53 -install -dv -m 1777 /tmp /var/tmp
54 -mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
55 -mkdir -pv /usr/{,local/}share/{doc,info,locale,man}
56 -mkdir -v /usr/{,local/}share/{misc,terminfo,zoneinfo}
57 -mkdir -pv /usr/{,local/}share/man/man{1..8}
58 -for dir in /usr /usr/local; do \
59 ln -sfv share/{man,doc,info} $$dir; \
60 done
61 -mkdir -v /var/{lock,log,mail,run,spool}
62 -mkdir -pv /var/{opt,cache,lib/{misc,locate},local}
63
64 # Check for some important links and create them if they don't exist
65 #if [ ! -e /bin/bash ]; then ln -sfn $(TOOLS_DIR)/bin/bash /bin/bash && ln -sf bash /bin/sh; fi
66 #if [ ! -e /bin/cat ]; then ln -sfn $(TOOLS_DIR)/bin/cat /bin/cat; fi
67 #if [ ! -e /bin/echo ]; then ln -sfn $(TOOLS_DIR)/bin/echo /bin/echo; fi
68 #if [ ! -e /bin/grep ]; then ln -sfn $(TOOLS_DIR)/bin/grep /bin/grep; fi
69 #if [ ! -e /bin/pwd ]; then ln -sfn $(TOOLS_DIR)/bin/pwd /bin/pwd; fi
70 #if [ ! -e /bin/stty ]; then ln -sfn $(TOOLS_DIR)/bin/stty /bin/stty; fi
71
72 #if [ ! -e /usr/bin/perl ]; then ln -sfn $(TOOLS_DIR)/bin/perl /usr/bin/perl; fi
73
74 #[ ! -e /lib/libgcc_s.so.1 ] && ln -sfn $(TOOLS_DIR)/lib/libgcc_s.so{,.1} /usr/lib/
75 #[ ! -e /lib/libstdc++.so.6 ] && ln -sfn $(TOOLS_DIR)/lib/libstdc++.so{,.6} /usr/lib/
76
77 # Creating an empty mtab
78 touch /etc/mtab
79
80 # This trick is necessary in order to create two devices in the target /dev
81 # rather than in the host /dev
82 mkdir -p /dev1
83 mount --move /dev /dev1
84
85 # Make /dev/null and /dev/console
86 cd /dev && rm -f null console
87 cd /dev && mknod -m 0666 null c 1 3
88 cd /dev && mknod -m 0600 console c 5 1
89
90 # Now move the target /dev to point back to the host /dev
91 mount --move /dev1 /dev
92 rm -fr /dev1
93
94 # Config files
95 for i in $(DIR_SRC)/config/etc/*; do \
96 [ -f $$i ] && cp $$i /etc; \
97 done
98 -mkdir -pv /etc/modprobe.d
99 cp -av $(DIR_CONF)/modprobe.d/* /etc/modprobe.d/
100
101 ifeq "$(EMB)" "1"
102 # Enable serial on console 7
103 sed -e "s/^#7/7/" -i /etc/inittab
104 endif
105
106 echo "$(NAME) v$(VERSION) for $(MACHINE) - $(SLOGAN) (\l)" > /etc/issue
107 echo "===============================" >> /etc/issue
108 echo "\n running on \s \r \m" >> /etc/issue
109
110 touch /var/run/utmp /var/log/{btmp,lastlog,wtmp}
111 #chgrp -v utmp /var/run/utmp /var/log/lastlog
112 chmod -v 664 /var/run/utmp /var/log/lastlog
113
114 # Bash startup files
115 install --directory --mode=0755 --owner=root --group=root /etc/profile.d
116 for i in $(DIR_SRC)/config/profile.d/*; do \
117 [ -f $$i ] && cp $$i /etc/profile.d; \
118 done
119
120 # Nobody user
121 -mkdir -p /home/nobody
122 chown -R nobody:nobody /home/nobody
123
124 @$(POSTBUILD)