]> git.ipfire.org Git - ipfire-3.x.git/blob - lfs/stage2
3ae693b564add7110c15334879e5927f6fb53602
[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 # Creating an empty mtab
65 touch /etc/mtab
66
67 # This trick is necessary in order to create two devices in the target /dev
68 # rather than in the host /dev
69 mkdir -p /dev1
70 mount --move /dev /dev1
71
72 # Make /dev/null and /dev/console
73 cd /dev && rm -f null console
74 cd /dev && mknod -m 0666 null c 1 3
75 cd /dev && mknod -m 0600 console c 5 1
76
77 # Now move the target /dev to point back to the host /dev
78 mount --move /dev1 /dev
79 rm -fr /dev1
80
81 # Config files
82 for i in $(DIR_SRC)/config/etc/*; do \
83 cp -vf $$i /etc; \
84 done
85 for i in $(DIR_CONFIG)/root/*; do \
86 cp -vf $$i /root; \
87 done
88 -mkdir -pv /etc/modprobe.d
89 cp -av $(DIR_CONF)/modprobe.d/* /etc/modprobe.d/
90
91 ifeq "$(EMB)" "1"
92 # Enable serial on console 7
93 sed -e "s/^#7/7/" -i /etc/inittab
94 endif
95
96 echo "$(NAME) v$(VERSION) for $(MACHINE) - $(SLOGAN) (\l)" > /etc/issue
97 echo "===============================" >> /etc/issue
98 echo "\n running on \s \r \m" >> /etc/issue
99
100 echo "$(NAME) Release $(VERSION) ($(SLOGAN))" > /etc/$(SNAME)-release
101 ln -svf $(SNAME)-release /etc/system-release
102
103 touch /var/run/utmp /var/log/{btmp,lastlog,wtmp}
104 #chgrp -v utmp /var/run/utmp /var/log/lastlog
105 chmod -v 664 /var/run/utmp /var/log/lastlog
106
107 # Bash startup files
108 install --directory --mode=0755 --owner=root --group=root /etc/profile.d
109 for i in $(DIR_SRC)/config/profile.d/*; do \
110 [ -f $$i ] && cp $$i /etc/profile.d; \
111 done
112
113 # Nobody user
114 -mkdir -p /home/nobody
115 chown -R nobody:nobody /home/nobody
116
117 @$(POSTBUILD)