Revert "[package] e2fsprogs: update to 1.42.8 and add e4defrag"
[oweals/openwrt.git] / package / base-files / Makefile
1 #
2 # Copyright (C) 2007-2013 OpenWrt.org
3 # Copyright (C) 2010 Vertical Communications
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8
9 include $(TOPDIR)/rules.mk
10 include $(INCLUDE_DIR)/kernel.mk
11 include $(INCLUDE_DIR)/version.mk
12
13 PKG_NAME:=base-files
14 PKG_RELEASE:=146
15
16 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
17 PKG_BUILD_DEPENDS:=opkg/host
18
19 include $(INCLUDE_DIR)/package.mk
20
21 ifneq ($(DUMP),1)
22   TARGET:=-$(BOARD)
23   ifneq ($(wildcard $(PLATFORM_DIR)/base-files-$(PROFILE) $(PLATFORM_SUBDIR)/base-files-$(PROFILE)),)
24     TARGET:=$(TARGET)-$(PROFILE)
25   endif
26 endif
27
28 define Package/base-files
29   SECTION:=base
30   CATEGORY:=Base system
31   DEPENDS:=+netifd +libc +procd
32   TITLE:=Base filesystem for OpenWrt
33   URL:=http://openwrt.org/
34   VERSION:=$(PKG_RELEASE)-$(REVISION)
35 endef
36
37 define Package/base-files/conffiles
38 /etc/hosts
39 /etc/inittab
40 /etc/group
41 /etc/passwd
42 /etc/shadow
43 /etc/profile
44 /etc/shells
45 /etc/sysctl.conf
46 /etc/rc.local
47 /etc/sysupgrade.conf
48 /etc/config/
49 /etc/dropbear/
50 /etc/crontabs/
51 $(call $(TARGET)/conffiles)
52 endef
53
54 define Package/base-files/description
55  This package contains a base filesystem and system scripts for OpenWrt.
56 endef
57
58 ifneq ($(CONFIG_PREINITOPT),)
59 define ImageConfigOptions
60         mkdir -p $(1)/lib/preinit
61         echo 'pi_suppress_stderr="$(CONFIG_TARGET_PREINIT_SUPPRESS_STDERR)"' >$(1)/lib/preinit/00_preinit.conf
62         echo 'fs_failsafe_wait_timeout=$(if $(CONFIG_TARGET_PREINIT_TIMEOUT),$(CONFIG_TARGET_PREINIT_TIMEOUT),2)' >>$(1)/lib/preinit/00_preinit.conf
63         echo 'pi_init_path=$(if $(CONFIG_TARGET_INIT_PATH),$(CONFIG_TARGET_INIT_PATH),"/bin:/sbin:/usr/bin:/usr/sbin")' >>$(1)/lib/preinit/00_preinit.conf
64         echo 'pi_init_env=$(if $(CONFIG_TARGET_INIT_ENV),$(CONFIG_TARGET_INIT_ENV),"")' >>$(1)/lib/preinit/00_preinit.conf
65         echo 'pi_init_cmd=$(if $(CONFIG_TARGET_INIT_CMD),$(CONFIG_TARGET_INIT_CMD),"/sbin/init")' >>$(1)/lib/preinit/00_preinit.conf
66         echo 'pi_init_suppress_stderr="$(CONFIG_TARGET_INIT_SUPPRESS_STDERR)"' >>$(1)/lib/preinit/00_preinit.conf
67         echo 'pi_ifname=$(if $(CONFIG_TARGET_PREINIT_IFNAME),$(CONFIG_TARGET_PREINIT_IFNAME),"")' >>$(1)/lib/preinit/00_preinit.conf
68         echo 'pi_ip=$(if $(CONFIG_TARGET_PREINIT_IP),$(CONFIG_TARGET_PREINIT_IP),"192.168.1.1")' >>$(1)/lib/preinit/00_preinit.conf
69         echo 'pi_netmask=$(if $(CONFIG_TARGET_PREINIT_NETMASK),$(CONFIG_TARGET_PREINIT_NETMASK),"255.255.255.0")' >>$(1)/lib/preinit/00_preinit.conf
70         echo 'pi_broadcast=$(if $(CONFIG_TARGET_PREINIT_BROADCAST),$(CONFIG_TARGET_PREINIT_BROADCAST),"192.168.1.255")' >>$(1)/lib/preinit/00_preinit.conf
71         echo 'pi_preinit_net_messages="$(CONFIG_TARGET_PREINIT_SHOW_NETMSG)"' >>$(1)/lib/preinit/00_preinit.conf
72         echo 'pi_preinit_no_failsafe_netmsg="$(CONFIG_TARGET_PREINIT_SUPPRESS_FAILSAFE_NETMSG)"' >>$(1)/lib/preinit/00_preinit.conf
73 endef
74 endif
75
76 define Build/Prepare
77         mkdir -p $(PKG_BUILD_DIR)
78 endef
79
80 define Build/Compile/Default
81
82 endef
83 Build/Compile = $(Build/Compile/Default)
84
85 define Package/base-files/install
86         $(CP) ./files/* $(1)/
87         if [ -d $(GENERIC_PLATFORM_DIR)/base-files/. ]; then \
88                 $(CP) $(GENERIC_PLATFORM_DIR)/base-files/* $(1)/; \
89         fi
90         if [ -d $(PLATFORM_DIR)/base-files/. ]; then \
91                 $(CP) $(PLATFORM_DIR)/base-files/* $(1)/; \
92         fi
93         if [ -d $(PLATFORM_DIR)/base-files-$(PROFILE)/. ]; then \
94                 $(CP) $(PLATFORM_DIR)/base-files-$(PROFILE)/* $(1)/; \
95         fi
96         if [ -d $(PLATFORM_DIR)/$(PROFILE)/base-files/. ]; then \
97                 $(CP) $(PLATFORM_DIR)/$(PROFILE)/base-files/* $(1)/; \
98         fi
99         $(if $(filter-out $(PLATFORM_DIR),$(PLATFORM_SUBDIR)), \
100                 if [ -d $(PLATFORM_SUBDIR)/base-files/. ]; then \
101                         $(CP) $(PLATFORM_SUBDIR)/base-files/* $(1)/; \
102                 fi; \
103                 if [ -d $(PLATFORM_SUBDIR)/base-files-$(PROFILE)/. ]; then \
104                         $(CP) $(PLATFORM_SUBDIR)/base-files-$(PROFILE)/* $(1)/; \
105                 fi; \
106                 if [ -d $(PLATFORM_SUBDIR)/$(PROFILE)/base-files/. ]; then \
107                         $(CP) $(PLATFORM_SUBDIR)/$(PROFILE)/base-files/* $(1)/; \
108                 fi \
109         )
110
111         $(VERSION_SED) \
112                 $(1)/etc/banner \
113                 $(1)/etc/openwrt_version \
114                 $(1)/etc/openwrt_release
115
116         mkdir -p $(1)/CONTROL
117         mkdir -p $(1)/dev
118         mkdir -p $(1)/etc/crontabs
119         mkdir -p $(1)/etc/rc.d
120         mkdir -p $(1)/overlay
121         mkdir -p $(1)/lib/firmware
122         $(if $(LIB_SUFFIX),-ln -s lib $(1)/lib$(LIB_SUFFIX))
123         mkdir -p $(1)/mnt
124         mkdir -p $(1)/proc
125         mkdir -p $(1)/tmp
126         mkdir -p $(1)/usr/lib
127         $(if $(LIB_SUFFIX),-ln -s lib $(1)/usr/lib$(LIB_SUFFIX))
128         mkdir -p $(1)/usr/bin
129         mkdir -p $(1)/sys
130         mkdir -p $(1)/www
131         mkdir -p $(1)/root
132         ln -sf /proc/mounts $(1)/etc/mtab
133         rm -f $(1)/var
134         ln -sf /tmp $(1)/var
135         mkdir -p $(1)/etc
136         ln -sf /tmp/resolv.conf /tmp/fstab /tmp/TZ $(1)/etc/
137
138         chmod 0600 $(1)/etc/shadow
139         chmod 1777 $(1)/tmp
140
141         $(call ImageConfigOptions,$(1))
142         $(call Package/base-files/install-target,$(1))
143         for conffile in $(1)/etc/config/*; do \
144                 if [ -f "$$$$conffile" ]; then \
145                         grep "$$$${conffile##$(1)}" $(1)/CONTROL/conffiles || \
146                                 echo "$$$${conffile##$(1)}" >> $(1)/CONTROL/conffiles; \
147                 fi \
148         done
149 endef
150
151 ifneq ($(DUMP),1)
152   -include $(PLATFORM_DIR)/base-files.mk
153 endif
154
155 $(eval $(call BuildPackage,base-files))