]> git.ipfire.org Git - ipfire-3.x.git/blob - lfs/stage2
Merge branch 'master' of git://git.ipfire.org/ipfire-3.x
[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 PKG_VER = LFS
29
30 THISAPP = $(PKG_NAME)-$(PKG_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/{grsec,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 $$(find $(DIR_SRC)/config/etc/ -type f); do \
83 cp -vf $$i /etc; \
84 done
85 for i in $$(find $(DIR_CONFIG)/root/ -type f); do \
86 cp -vf $$i /root; \
87 done
88 for i in $$(find $(DIR_SRC)/config/grsecurity/ -type f); do \
89 cp -vf $$i /etc/grsec; \
90 done
91 -mkdir -pv /etc/modprobe.d
92 cp -av $(DIR_CONF)/modprobe.d/* /etc/modprobe.d/
93
94 ifeq "$(EMB)" "1"
95 # Enable serial on console 7
96 sed -e "s/^#7/7/" -i /etc/inittab
97 endif
98
99 echo "$(NAME) v$(VERSION) for $(MACHINE) - $(SLOGAN) (\l)" > /etc/issue
100 echo "===============================" >> /etc/issue
101 echo "\n running on \s \r \m" >> /etc/issue
102
103 echo "$(NAME) Release $(VERSION) ($(SLOGAN))" > /etc/$(SNAME)-release
104 ln -svf $(SNAME)-release /etc/system-release
105
106 touch /var/run/utmp /var/log/{btmp,lastlog,wtmp}
107 #chgrp -v utmp /var/run/utmp /var/log/lastlog
108 chmod -v 664 /var/run/utmp /var/log/lastlog
109
110 # Bash startup files
111 install --directory --mode=0755 --owner=root --group=root /etc/profile.d
112 for i in $(DIR_SRC)/config/profile.d/*; do \
113 [ -f $$i ] && cp $$i /etc/profile.d; \
114 done
115
116 # Nobody user
117 -mkdir -p /home/nobody
118 chown -R nobody:nobody /home/nobody
119
120 @$(POSTBUILD)