]>
Commit | Line | Data |
---|---|---|
cd1a2927 | 1 | ############################################################################### |
cd1a2927 | 2 | # # |
70df8302 | 3 | # IPFire.org - A linux based firewall # |
65630b4a | 4 | # Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> # |
70df8302 MT |
5 | # # |
6 | # This program is free software: you can redistribute it and/or modify # | |
cd1a2927 | 7 | # it under the terms of the GNU General Public License as published by # |
70df8302 | 8 | # the Free Software Foundation, either version 3 of the License, or # |
cd1a2927 MT |
9 | # (at your option) any later version. # |
10 | # # | |
70df8302 | 11 | # This program is distributed in the hope that it will be useful, # |
cd1a2927 MT |
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 # | |
70df8302 | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. # |
cd1a2927 | 18 | # # |
cd1a2927 MT |
19 | ############################################################################### |
20 | ||
21 | ############################################################################### | |
22 | # Definitions | |
23 | ############################################################################### | |
24 | ||
25 | include Config | |
26 | ||
15679d9f MT |
27 | VER = ipfire |
28 | ||
cd1a2927 MT |
29 | THISAPP = stage2 |
30 | TARGET = $(DIR_INFO)/$(THISAPP) | |
31 | ||
32 | ############################################################################### | |
33 | # Top-level Rules | |
34 | ############################################################################### | |
35 | ||
36 | install : $(TARGET) | |
37 | ||
38 | check : | |
39 | ||
40 | download : | |
41 | ||
9a7e4d85 | 42 | b2 : |
cd1a2927 MT |
43 | |
44 | ############################################################################### | |
45 | # Installation Details | |
46 | ############################################################################### | |
47 | ||
48 | $(TARGET) : | |
49 | @$(PREBUILD) | |
50 | ||
51 | # Create directories | |
7e6be0de | 52 | -mkdir -pv /{bin,boot,etc/opt,etc/modprobe.d,home,lib/firmware/brcm,mnt,opt,run} |
59de0b00 | 53 | -mkdir -pv /{media/{floppy,cdrom,usbkey},sbin,srv,var} |
9b0ff0a0 MT |
54 | -install -dv -m 0750 /root |
55 | -install -dv -m 1777 /tmp /var/tmp | |
6dc206ab | 56 | -mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src} |
9b0ff0a0 | 57 | -mkdir -pv /usr/{,local/}share/{doc,info,locale,man} |
65630b4a | 58 | -mkdir -v /usr/{,local/}share/{misc,terminfo,zoneinfo} |
9b0ff0a0 | 59 | -mkdir -pv /usr/{,local/}share/man/man{1..8} |
90d372c4 MT |
60 | #-for dir in /usr /usr/local; do \ |
61 | # ln -sv share/{man,doc,info} $$dir; \ | |
62 | #done | |
b8e2d108 AF |
63 | |
64 | # Symlink /var/run -> /run. | |
65 | ln -svf ../run /var/run | |
fc155193 | 66 | |
fc155193 MT |
67 | ln -svf lib /lib64 |
68 | ln -svf lib /usr/lib64 | |
fc155193 | 69 | |
2d5494a8 MT |
70 | ifeq "$(BUILD_ARCH)" "riscv64" |
71 | ln -svf . /lib/lp64d | |
72 | ln -svf . /usr/lib/lp64d | |
73 | endif | |
74 | ||
cd1a2927 MT |
75 | # Symlinks |
76 | # for this reason, stage2 rebuild will broke the iso:perl, grubbatch | |
6c4cc7ea MT |
77 | -ln -sv $(TOOLS_DIR)/bin/{bash,cat,echo,pwd,stty} /bin |
78 | -ln -sv $(TOOLS_DIR)/bin/perl /usr/bin | |
79 | -ln -sv $(TOOLS_DIR)/lib/libgcc_s.so{,.1} /usr/lib | |
80 | -ln -sv $(TOOLS_DIR)/lib/libstdc++.so{,.6} /usr/lib | |
81 | sed 's@$(TOOLS_DIR)@/usr@' $(TOOLS_DIR)/lib/libstdc++.la > /usr/lib/libstdc++.la | |
9b0ff0a0 | 82 | -ln -sv bash /bin/sh |
cd1a2927 MT |
83 | |
84 | # Config files | |
fb617ff5 | 85 | cp -rvf $(DIR_SRC)/config/etc/* /etc; |
7ae1dcb3 | 86 | [ ! -d "$(DIR_SRC)/config/etc-$(BUILD_ARCH)" ] || cp -rvf $(DIR_SRC)/config/etc-$(BUILD_ARCH)/* /etc |
7e6be0de | 87 | cp -rvf $(DIR_SRC)/config/lib/* /lib; |
cad2ce78 PM |
88 | touch /etc/fstab |
89 | ln -s /proc/self/mounts /etc/mtab | |
0b59f25c MT |
90 | echo "$(NAME) v$(VERSION) - $(SLOGAN)" > /etc/issue |
91 | echo "===============================" >> /etc/issue | |
92 | echo "\n running on \s \r \m" >> /etc/issue | |
5a7f7dd5 | 93 | -cat /etc/motd >> /etc/issue |
0b59f25c | 94 | |
71e32384 MT |
95 | # Bash startup files |
96 | install --directory --mode=0755 --owner=root --group=root /etc/profile.d | |
97 | for i in $(DIR_SRC)/config/profile.d/*; do \ | |
98 | [ -f $$i ] && cp $$i /etc/profile.d; \ | |
99 | done | |
05402246 | 100 | chmod 755 /etc/bashrc |
b21b0df6 MT |
101 | |
102 | # Install root's bash files. | |
103 | for i in $(DIR_SRC)/config/bash/dot_*; do \ | |
104 | [ -f $$i ] && cp $$i /root/$$(basename $${i/dot_/\.}); \ | |
105 | done | |
cd1a2927 MT |
106 | |
107 | # Scripts | |
108 | for i in `find $(DIR_SRC)/src/scripts -maxdepth 1 -type f`; do \ | |
109 | sed "s+CONFIG_ROOT+$(CONFIG_ROOT)+g" $$i > /usr/local/bin/`basename $$i`; \ | |
110 | chmod 755 /usr/local/bin/`basename $$i`; \ | |
111 | done | |
112 | ||
07cdb8f6 | 113 | # Move script to correct place. |
708f2b73 | 114 | mv -vf /usr/local/bin/openvpn-metrics /usr/sbin/ |
4d900227 | 115 | mv -vf /usr/local/bin/captive-cleanup /usr/bin/ |
66c36198 | 116 | |
73372ed4 MT |
117 | # Install firewall scripts. |
118 | mkdir -pv /usr/lib/firewall | |
119 | install -m 755 $(DIR_SRC)/config/firewall/rules.pl \ | |
120 | /usr/lib/firewall/rules.pl | |
121 | install -m 644 $(DIR_SRC)/config/firewall/firewall-lib.pl \ | |
122 | /usr/lib/firewall/firewall-lib.pl | |
6c920b19 MT |
123 | install -m 755 $(DIR_SRC)/config/firewall/ipsec-policy \ |
124 | /usr/lib/firewall/ipsec-policy | |
73372ed4 | 125 | |
cd1a2927 MT |
126 | # Nobody user |
127 | -mkdir -p /home/nobody | |
128 | chown -R nobody:nobody /home/nobody | |
129 | ||
9b0ff0a0 | 130 | # Create /var dirs and files |
b8e2d108 | 131 | -mkdir -v /var/{lock,log,mail,spool,empty} |
e4a5b224 | 132 | -mkdir -pv /var/{opt,cache,lib/misc,local} |
069ae085 MT |
133 | -mkdir -pv /var/log/{counter,calamaris} |
134 | chown nobody.nobody /var/log/calamaris | |
5edc06b7 | 135 | touch /var/log/{btmp,lastlog,wtmp} |
057aaf42 | 136 | chmod -v 600 /var/log/btmp |
b8e2d108 AF |
137 | chgrp -v utmp /var/log/lastlog |
138 | chmod -v 664 /var/log/lastlog | |
b474c1ca | 139 | |
90d372c4 MT |
140 | # Permissions |
141 | chmod 0711 /var/empty | |
66c36198 | 142 | |
99f3c72f MT |
143 | # A small hack to include /root to the iso but not all of it's files. |
144 | touch /root/ipfire | |
90d372c4 | 145 | |
7274a673 JPT |
146 | # License agreement |
147 | -mkdir -pv /usr/share/doc/licenses/ | |
148 | cp -vf $(DIR_SRC)/doc/COPYING /usr/share/doc/licenses/GPLv3 | |
149 | ||
d02853e7 MT |
150 | # System release |
151 | echo "$(SYSTEM_RELEASE)" > /etc/system-release | |
152 | ||
20253656 MT |
153 | # OS release |
154 | : >/etc/os-release | |
155 | echo "NAME=\"$(NAME)\"" >> /etc/os-release | |
156 | echo "VERSION=\"$(VERSION)\"" >> /etc/os-release | |
157 | echo "ID=$(SNAME)" >> /etc/os-release | |
158 | echo "VERSION_ID=2" >> /etc/os-release | |
159 | echo "PRETTY_NAME=\"$(SYSTEM_RELEASE)\"" >> /etc/os-release | |
160 | echo "ANSI_COLOR=\"0:31\"" >> /etc/os-release | |
161 | ||
065c9931 MT |
162 | # Pakfire |
163 | -mkdir -pv /opt/pakfire/db/core | |
06fc566a | 164 | echo "$(CORE)" > /opt/pakfire/db/core/mine |
065c9931 | 165 | |
9759d96e SS |
166 | # IPblocklist. |
167 | -mkdir -pv /var/lib/ipblocklist | |
168 | chown nobody:nobody /var/lib/ipblocklist | |
169 | ||
cd1a2927 | 170 | @$(POSTBUILD) |