[PATCH v2 3/3] Distribute files from root_file_system to packages

Adrian Schmutzler freifunk at adrianschmutzler.de
Di Dez 26 12:56:04 CET 2017


This removes the root_file_system folder (and the copy command
from buildscript) and puts the files into packages.

Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>

---

Changes in v2:
- Create $target/files/etc (previously created by copying)
- Use install-overlay in Makefile
---
 bsp/default/root_file_system/etc/banner            |  9 ---
 bsp/default/root_file_system/etc/init.d/zdone      | 11 ----
 bsp/default/root_file_system/etc/profile           | 25 --------
 bsp/default/root_file_system/etc/rc.local          |  7 ---
 bsp/default/root_file_system/etc/sysctl.conf       | 71 ----------------------
 buildscript                                        |  2 +-
 src/packages/fff/fff-config/Makefile               |  6 +-
 src/packages/fff/fff-config/files/etc/init.d/zdone | 11 ++++
 src/packages/fff/fff-config/overlay/etc/banner     |  9 +++
 src/packages/fff/fff-config/overlay/etc/profile    | 25 ++++++++
 src/packages/fff/fff-network/Makefile              |  6 +-
 src/packages/fff/fff-network/overlay/etc/rc.local  |  7 +++
 .../fff/fff-network/overlay/etc/sysctl.conf        | 71 ++++++++++++++++++++++
 13 files changed, 134 insertions(+), 126 deletions(-)
 delete mode 100644 bsp/default/root_file_system/etc/banner
 delete mode 100755 bsp/default/root_file_system/etc/init.d/zdone
 delete mode 100644 bsp/default/root_file_system/etc/profile
 delete mode 100755 bsp/default/root_file_system/etc/rc.local
 delete mode 100644 bsp/default/root_file_system/etc/sysctl.conf
 create mode 100755 src/packages/fff/fff-config/files/etc/init.d/zdone
 create mode 100644 src/packages/fff/fff-config/overlay/etc/banner
 create mode 100644 src/packages/fff/fff-config/overlay/etc/profile
 create mode 100755 src/packages/fff/fff-network/overlay/etc/rc.local
 create mode 100644 src/packages/fff/fff-network/overlay/etc/sysctl.conf

diff --git a/bsp/default/root_file_system/etc/banner b/bsp/default/root_file_system/etc/banner
deleted file mode 100644
index 670e55a..0000000
--- a/bsp/default/root_file_system/etc/banner
+++ /dev/null
@@ -1,9 +0,0 @@
-  ____  ____  ____
- |     |     |       Freifunk
- |____ |____ |____    Franken
- |     |     |         Firmware
- |     |     |      
-
-Welcome to the free wireless experience
-More information at http://franken.freifunk.net
- ---------------------------------------------------------
diff --git a/bsp/default/root_file_system/etc/init.d/zdone b/bsp/default/root_file_system/etc/init.d/zdone
deleted file mode 100755
index f4aaf02..0000000
--- a/bsp/default/root_file_system/etc/init.d/zdone
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh /etc/rc.common
-
-# Copyright 2017 Adrian Schmutzler
-# License GPLv3
-
-START=99
-
-start()
-{
-	touch /tmp/started
-}
diff --git a/bsp/default/root_file_system/etc/profile b/bsp/default/root_file_system/etc/profile
deleted file mode 100644
index 4bfa5c5..0000000
--- a/bsp/default/root_file_system/etc/profile
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-[ -f /etc/banner ] && cat /etc/banner
-
-export PATH=/usr/bin:/usr/sbin:/bin:/sbin
-export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
-export HOME=${HOME:-/root}
-
-[ -x /bin/more ] || alias more=less
-[ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi
-
-[ -z "$KSH_VERSION" -o \! -s /etc/mkshrc ] || . /etc/mkshrc
-
-[ -x /usr/bin/arp ] || arp() { cat /proc/net/arp; }
-[ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
-
-# I'm lazy, let's add some aliases
-alias ..='cd ..'
-alias ...='cd ../..'
-alias l='ls -CF'
-alias la='ls -A'
-alias ll='ls -alF'
-alias ls='ls --color=auto'
-
-# and color my prompt
-export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
\ No newline at end of file
diff --git a/bsp/default/root_file_system/etc/rc.local b/bsp/default/root_file_system/etc/rc.local
deleted file mode 100755
index f174234..0000000
--- a/bsp/default/root_file_system/etc/rc.local
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-# Put your custom commands here that should be executed once
-# the system init finished. By default this file does nothing.
-
-/usr/sbin/configurenetwork
-
-exit 0
diff --git a/bsp/default/root_file_system/etc/sysctl.conf b/bsp/default/root_file_system/etc/sysctl.conf
deleted file mode 100644
index f6d85a7..0000000
--- a/bsp/default/root_file_system/etc/sysctl.conf
+++ /dev/null
@@ -1,71 +0,0 @@
-kernel.panic=3
-net.ipv4.conf.default.arp_ignore=1
-net.ipv4.conf.all.arp_ignore=1
-net.ipv4.conf.all.forwarding=0
-net.ipv4.conf.all.send_redirects=0
-net.ipv4.tcp_ecn=0
-net.ipv4.tcp_fin_timeout=30
-net.ipv4.tcp_keepalive_time=120
-net.ipv4.tcp_syncookies=1
-net.ipv4.tcp_timestamps=0
-net.ipv4.netfilter.ip_conntrack_checksum=0
-net.ipv4.netfilter.ip_conntrack_max=16384
-net.ipv4.netfilter.ip_conntrack_tcp_timeout_established=3600
-net.ipv4.netfilter.ip_conntrack_udp_timeout=60
-net.ipv4.netfilter.ip_conntrack_udp_timeout_stream=180
-net.core.netdev_max_backlog=30
-net.netfilter.nf_conntrack_checksum=0
-
-#Controls source route verification
-net.ipv4.conf.default.rp_filter=1
-
-#Do not accept source routing
-net.ipv4.conf.all.accept_source_route=0
-net.ipv4.conf.all.accept_redirects=0
-net.ipv4.conf.default.accept_source_route=0
-net.ipv4.conf.default.accept_redirects=0
-net.ipv4.icmp_echo_ignore_broadcasts=1
-net.ipv4.icmp_ignore_bogus_error_responses=1
-net.ipv4.ip_forward=0
-# net.ipv6.conf.all.forwarding=1
-
-# disable bridge firewalling by default
-net.bridge.bridge-nf-call-arptables=0
-net.bridge.bridge-nf-call-ip6tables=0
-net.bridge.bridge-nf-call-iptables=0
-
-net.ipv6.conf.default.accept_dad=0
-net.ipv6.conf.default.accept_ra=0
-net.ipv6.conf.default.accept_redirects=0
-net.ipv6.conf.all.accept_dad=0
-net.ipv6.conf.all.accept_ra=1
-net.ipv6.conf.all.accept_redirects=0
-
-# Number of Router Solicitations to send until assuming no routers are present.
-# This is host and not router
-net.ipv6.conf.default.router_solicitations = 0
-net.ipv6.conf.all.router_solicitations = 0
- 
-# Accept Router Preference in RA?
-net.ipv6.conf.default.accept_ra_rtr_pref = 0
-net.ipv6.conf.all.accept_ra_rtr_pref = 1
- 
-# Learn Prefix Information in Router Advertisement
-net.ipv6.conf.default.accept_ra_pinfo = 0
-net.ipv6.conf.all.accept_ra_pinfo = 1
- 
-# Setting controls whether the system will accept Hop Limit settings from a router advertisement
-net.ipv6.conf.default.accept_ra_defrtr = 0
-net.ipv6.conf.all.accept_ra_defrtr = 1
-
-#router advertisements can cause the system to assign a global unicast address to an interface
-net.ipv6.conf.default.autoconf = 0
-net.ipv6.conf.all.autoconf = 1
-
-#how many neighbor solicitations to send out per address?
-net.ipv6.conf.default.dad_transmits = 3
-net.ipv6.conf.all.dad_transmits = 3
-
-# How many global unicast IPv6 addresses can be assigned to each interface?
-net.ipv6.conf.default.max_addresses = 0
-net.ipv6.conf.all.max_addresses = 0
\ No newline at end of file
diff --git a/buildscript b/buildscript
index b2030ba..cd1ca03 100755
--- a/buildscript
+++ b/buildscript
@@ -179,8 +179,8 @@ prebuild() {
     #create filesdir for our config
     /bin/rm -rf "$target"/files
     mkdir "$target"/files
+    mkdir "$target"/files/etc
 
-    cp -r ./bsp/default/root_file_system/* "$target"/files/
     cp ./bsp/"$machine"/.config "$target"/.config
 
     while IFS= read -r -d '' template
diff --git a/src/packages/fff/fff-config/Makefile b/src/packages/fff/fff-config/Makefile
index 690719a..0633e7a 100644
--- a/src/packages/fff/fff-config/Makefile
+++ b/src/packages/fff/fff-config/Makefile
@@ -1,7 +1,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=fff-config
-PKG_VERSION:=2
+PKG_VERSION:=3
 PKG_RELEASE:=1
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
@@ -33,6 +33,10 @@ define Build/Compile
     # nothing
 endef
 
+define Package/$(PKG_NAME)/install-overlay
+	$(CP) ./overlay/* $(1)/
+endef
+
 define Package/$(PKG_NAME)/install
     $(CP) ./files/* $(1)/
 endef
diff --git a/src/packages/fff/fff-config/files/etc/init.d/zdone b/src/packages/fff/fff-config/files/etc/init.d/zdone
new file mode 100755
index 0000000..f4aaf02
--- /dev/null
+++ b/src/packages/fff/fff-config/files/etc/init.d/zdone
@@ -0,0 +1,11 @@
+#!/bin/sh /etc/rc.common
+
+# Copyright 2017 Adrian Schmutzler
+# License GPLv3
+
+START=99
+
+start()
+{
+	touch /tmp/started
+}
diff --git a/src/packages/fff/fff-config/overlay/etc/banner b/src/packages/fff/fff-config/overlay/etc/banner
new file mode 100644
index 0000000..670e55a
--- /dev/null
+++ b/src/packages/fff/fff-config/overlay/etc/banner
@@ -0,0 +1,9 @@
+  ____  ____  ____
+ |     |     |       Freifunk
+ |____ |____ |____    Franken
+ |     |     |         Firmware
+ |     |     |      
+
+Welcome to the free wireless experience
+More information at http://franken.freifunk.net
+ ---------------------------------------------------------
diff --git a/src/packages/fff/fff-config/overlay/etc/profile b/src/packages/fff/fff-config/overlay/etc/profile
new file mode 100644
index 0000000..4bfa5c5
--- /dev/null
+++ b/src/packages/fff/fff-config/overlay/etc/profile
@@ -0,0 +1,25 @@
+#!/bin/sh
+[ -f /etc/banner ] && cat /etc/banner
+
+export PATH=/usr/bin:/usr/sbin:/bin:/sbin
+export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
+export HOME=${HOME:-/root}
+
+[ -x /bin/more ] || alias more=less
+[ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi
+
+[ -z "$KSH_VERSION" -o \! -s /etc/mkshrc ] || . /etc/mkshrc
+
+[ -x /usr/bin/arp ] || arp() { cat /proc/net/arp; }
+[ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
+
+# I'm lazy, let's add some aliases
+alias ..='cd ..'
+alias ...='cd ../..'
+alias l='ls -CF'
+alias la='ls -A'
+alias ll='ls -alF'
+alias ls='ls --color=auto'
+
+# and color my prompt
+export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
\ No newline at end of file
diff --git a/src/packages/fff/fff-network/Makefile b/src/packages/fff/fff-network/Makefile
index 348897d..f76bc31 100644
--- a/src/packages/fff/fff-network/Makefile
+++ b/src/packages/fff/fff-network/Makefile
@@ -1,7 +1,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=fff-network
-PKG_VERSION:=10
+PKG_VERSION:=11
 PKG_RELEASE:=1
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
@@ -32,6 +32,10 @@ define Build/Compile
 	# nothing
 endef
 
+define Package/$(PKG_NAME)/install-overlay
+	$(CP) ./overlay/* $(1)/
+endef
+
 define Package/$(PKG_NAME)/install
 	$(CP) ./files/* $(1)/
 	test -d ./$(BOARD) && $(CP) ./$(BOARD)/* $(1)/etc/
diff --git a/src/packages/fff/fff-network/overlay/etc/rc.local b/src/packages/fff/fff-network/overlay/etc/rc.local
new file mode 100755
index 0000000..f174234
--- /dev/null
+++ b/src/packages/fff/fff-network/overlay/etc/rc.local
@@ -0,0 +1,7 @@
+#!/bin/sh
+# Put your custom commands here that should be executed once
+# the system init finished. By default this file does nothing.
+
+/usr/sbin/configurenetwork
+
+exit 0
diff --git a/src/packages/fff/fff-network/overlay/etc/sysctl.conf b/src/packages/fff/fff-network/overlay/etc/sysctl.conf
new file mode 100644
index 0000000..f6d85a7
--- /dev/null
+++ b/src/packages/fff/fff-network/overlay/etc/sysctl.conf
@@ -0,0 +1,71 @@
+kernel.panic=3
+net.ipv4.conf.default.arp_ignore=1
+net.ipv4.conf.all.arp_ignore=1
+net.ipv4.conf.all.forwarding=0
+net.ipv4.conf.all.send_redirects=0
+net.ipv4.tcp_ecn=0
+net.ipv4.tcp_fin_timeout=30
+net.ipv4.tcp_keepalive_time=120
+net.ipv4.tcp_syncookies=1
+net.ipv4.tcp_timestamps=0
+net.ipv4.netfilter.ip_conntrack_checksum=0
+net.ipv4.netfilter.ip_conntrack_max=16384
+net.ipv4.netfilter.ip_conntrack_tcp_timeout_established=3600
+net.ipv4.netfilter.ip_conntrack_udp_timeout=60
+net.ipv4.netfilter.ip_conntrack_udp_timeout_stream=180
+net.core.netdev_max_backlog=30
+net.netfilter.nf_conntrack_checksum=0
+
+#Controls source route verification
+net.ipv4.conf.default.rp_filter=1
+
+#Do not accept source routing
+net.ipv4.conf.all.accept_source_route=0
+net.ipv4.conf.all.accept_redirects=0
+net.ipv4.conf.default.accept_source_route=0
+net.ipv4.conf.default.accept_redirects=0
+net.ipv4.icmp_echo_ignore_broadcasts=1
+net.ipv4.icmp_ignore_bogus_error_responses=1
+net.ipv4.ip_forward=0
+# net.ipv6.conf.all.forwarding=1
+
+# disable bridge firewalling by default
+net.bridge.bridge-nf-call-arptables=0
+net.bridge.bridge-nf-call-ip6tables=0
+net.bridge.bridge-nf-call-iptables=0
+
+net.ipv6.conf.default.accept_dad=0
+net.ipv6.conf.default.accept_ra=0
+net.ipv6.conf.default.accept_redirects=0
+net.ipv6.conf.all.accept_dad=0
+net.ipv6.conf.all.accept_ra=1
+net.ipv6.conf.all.accept_redirects=0
+
+# Number of Router Solicitations to send until assuming no routers are present.
+# This is host and not router
+net.ipv6.conf.default.router_solicitations = 0
+net.ipv6.conf.all.router_solicitations = 0
+ 
+# Accept Router Preference in RA?
+net.ipv6.conf.default.accept_ra_rtr_pref = 0
+net.ipv6.conf.all.accept_ra_rtr_pref = 1
+ 
+# Learn Prefix Information in Router Advertisement
+net.ipv6.conf.default.accept_ra_pinfo = 0
+net.ipv6.conf.all.accept_ra_pinfo = 1
+ 
+# Setting controls whether the system will accept Hop Limit settings from a router advertisement
+net.ipv6.conf.default.accept_ra_defrtr = 0
+net.ipv6.conf.all.accept_ra_defrtr = 1
+
+#router advertisements can cause the system to assign a global unicast address to an interface
+net.ipv6.conf.default.autoconf = 0
+net.ipv6.conf.all.autoconf = 1
+
+#how many neighbor solicitations to send out per address?
+net.ipv6.conf.default.dad_transmits = 3
+net.ipv6.conf.all.dad_transmits = 3
+
+# How many global unicast IPv6 addresses can be assigned to each interface?
+net.ipv6.conf.default.max_addresses = 0
+net.ipv6.conf.all.max_addresses = 0
\ No newline at end of file
-- 
2.7.4



Mehr Informationen über die Mailingliste franken-dev