48c4ff2092aa21b61f1d0c15aa398e835c4bbc49
[ipfire-2.x.git] / lfs / configroot
1 ###############################################################################
2 # This file is part of the IPCop Firewall.                                    #
3 #                                                                             #
4 # IPCop is free software; you can redistribute it and/or modify               #
5 # it under the terms of the GNU General Public License as published by        #
6 # the Free Software Foundation; either version 2 of the License, or           #
7 # (at your option) any later version.                                         #
8 #                                                                             #
9 # IPCop is distributed in the hope that it will be useful,                    #
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of              #
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
12 # GNU General Public License for more details.                                #
13 #                                                                             #
14 # You should have received a copy of the GNU General Public License           #
15 # along with IPCop; if not, write to the Free Software                        #
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA    #
17 #                                                                             #
18 # Makefiles are based on LFSMake, which is                                    #
19 # Copyright (C) 2002 Rod Roard <rod@sunsetsystems.com>                        #
20 #                                                                             #
21 ###############################################################################
22
23 ###############################################################################
24 # Definitions
25 ###############################################################################
26
27 include Config
28
29 THISAPP    = configroot
30 DIR_APP    = $(DIR_SRC)/$(THISAPP)
31 TARGET     = $(DIR_INFO)/$(THISAPP)
32
33 ###############################################################################
34 # Top-level Rules
35 ###############################################################################
36
37 install : $(TARGET)
38
39 check :
40
41 download :
42
43 md5 :
44
45 ###############################################################################
46 # Installation Details
47 ###############################################################################
48
49 $(TARGET) :
50         @$(PREBUILD)
51
52         # Create all directories
53         for i in addon-lang alcatelusb auth backup backup/sets ca certs cnx_pci crls ddns dhcp dhcpc dmzholes \
54             eagle-usb eciadsl ethernet isdn key langs logging main modem net-traffic nfs optionsfw patches pakfire portfw \
55             ppp private proxy/advanced qos red remote snort time urlfilter/autoupdate urlfilter/bin vpn wireless xtaccess ; do \
56                 mkdir -p $(CONFIG_ROOT)/$$i; \
57         done
58
59         # Touch empty files
60         for i in auth/users backup/include.user backup/exclude.user \
61             certs/index.txt ddns/config ddns/noipsettings ddns/settings ddns/ipcache dhcp/settings \
62             dhcp/fixleases dhcp/advoptions dmzholes/config ethernet/aliases ethernet/settings \
63             isdn/settings main/hosts main/settings optionsfw/settings pakfire/settings patches/available patches/installed \
64             portfw/config ppp/settings-1 ppp/settings-2 ppp/settings-3 ppp/settings-4 \
65             ppp/settings-5 ppp/settings proxy/settings remote/settings qos/settings qos/classes qos/subclasses qos/level7config qos/portconfig \
66             snort/settings vpn/config vpn/settings vpn/ipsec.conf \
67             vpn/ipsec.secrets vpn/caconfig wireless/config wireless/settings; do \
68                 touch $(CONFIG_ROOT)/$$i; \
69         done
70
71         # Copy initial configfiles
72         cp $(DIR_SRC)/config/cfgroot/header.pl                  $(CONFIG_ROOT)/
73         cp $(DIR_SRC)/config/cfgroot/general-functions.pl       $(CONFIG_ROOT)/
74         cp $(DIR_SRC)/config/cfgroot/lang.pl                    $(CONFIG_ROOT)/
75         cp $(DIR_SRC)/config/cfgroot/countries.pl                       $(CONFIG_ROOT)/
76         cp $(DIR_SRC)/config/cfgroot/backup-exclude             $(CONFIG_ROOT)/backup/exclude.system
77         cp $(DIR_SRC)/config/cfgroot/backup-include             $(CONFIG_ROOT)/backup/include.system
78         cp $(DIR_SRC)/config/cfgroot/backup-exclude.hardware    $(CONFIG_ROOT)/backup/exclude.hardware
79         cp $(DIR_SRC)/config/cfgroot/advoptions-list            $(CONFIG_ROOT)/dhcp/advoptions-list
80         cp $(DIR_SRC)/config/cfgroot/modem-defaults             $(CONFIG_ROOT)/modem/defaults
81         cp $(DIR_SRC)/config/cfgroot/modem-settings             $(CONFIG_ROOT)/modem/settings
82         cp $(DIR_SRC)/config/cfgroot/net-traffic-lib.pl         $(CONFIG_ROOT)/net-traffic/net-traffic-lib.pl
83         cp $(DIR_SRC)/config/cfgroot/nfs-server                 $(CONFIG_ROOT)/nfs/nfs-server
84         cp $(DIR_SRC)/config/cfgroot/proxy-acl                  $(CONFIG_ROOT)/proxy/acl-1.4
85         cp $(DIR_SRC)/config/cfgroot/ssh-settings                       $(CONFIG_ROOT)/remote/settings
86         cp $(DIR_SRC)/config/cfgroot/xtaccess-config            $(CONFIG_ROOT)/xtaccess/config
87         cp $(DIR_SRC)/config/cfgroot/time-settings              $(CONFIG_ROOT)/time/settings
88         cp $(DIR_SRC)/config/cfgroot/logging-settings           $(CONFIG_ROOT)/logging/settings
89         cp $(DIR_SRC)/config/cfgroot/useragents                 $(CONFIG_ROOT)/proxy/advanced
90         cp $(DIR_SRC)/langs/list                                        $(CONFIG_ROOT)/langs/
91
92         # Oneliner configfiles
93         echo  "ENABLED=off"             > $(CONFIG_ROOT)/vpn/settings
94         echo  "VPN_DELAYED_START=0"     >>$(CONFIG_ROOT)/vpn/settings
95         echo  "01"                      > $(CONFIG_ROOT)/certs/serial
96         echo  "nameserver    1.2.3.4"   > $(CONFIG_ROOT)/ppp/fake-resolv.conf
97         echo  "DISABLEPING=NO"          > $(CONFIG_ROOT)/optionsfw/settings
98
99         # Symbolic links
100         ln -sf /etc/rc.d/rc.updatered $(CONFIG_ROOT)/dhcpc/dhcpcd.exe
101
102         # Modify variables in header.pl
103         sed -i -e "s+CONFIG_ROOT+$(CONFIG_ROOT)+g" \
104             -e "s+VERSION+$(VERSION)+g" \
105             $(CONFIG_ROOT)/header.pl
106
107         # Modify variables in general-functions.pl
108         sed -i -e "s+CONFIG_ROOT+$(CONFIG_ROOT)+g" \
109             -e "s+VERSION+$(VERSION)+g" \
110             $(CONFIG_ROOT)/general-functions.pl
111
112         # Modify CONFIG_ROOT in lang.pl
113         sed -i -e "s+CONFIG_ROOT+$(CONFIG_ROOT)+g" \
114             $(CONFIG_ROOT)/lang.pl
115
116         # Language files
117         cp $(DIR_SRC)/langs/de/cgi-bin/de.pl $(CONFIG_ROOT)/langs/
118         cp $(DIR_SRC)/langs/en/cgi-bin/en.pl $(CONFIG_ROOT)/langs/
119
120         # Configroot permissions
121         chown -R nobody:nobody $(CONFIG_ROOT)
122         chown      root:root   $(CONFIG_ROOT)
123         for i in backup/ header.pl general-functions.pl lang.pl addon-lang/ langs/ red/ ; do \
124             chown -R root:root $(CONFIG_ROOT)/$$i; \
125         done
126         chown nobody:nobody $(CONFIG_ROOT)/backup/sets
127         chown root:nobody $(CONFIG_ROOT)/dhcpc
128
129         @$(POSTBUILD)