Skip to contentSkip to conversation

package/urandom-scripts: new package

PATCH New christoph.muellner at theobroma-systems.com 2 participants 2 messages Jul 20, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/urandom-scripts: new package

From: Christoph M?llner <[email protected]>

The init script S20urandom is used to preserve the kernel's RNG seed between reboots. This functionality is not required for the package "initscripts". Further there are use-cases where this script should not be installed at all (e.g. systems that only have read-only partitions), but that's currently not possible as the script is a mandatory part of the package "initscripts".

Let's move the script into its own package "urandom-scripts" and select it, if the default skeleton is enabled. This maintains backward-compatibility and allows to deselect it.

---
 package/Config.in                                    |  1 +
 package/urandom-scripts/Config.in                    |  6 ++++++
 .../init.d => urandom-scripts}/S20urandom            |  0
 package/urandom-scripts/urandom-scripts.mk           | 12 ++++++++++++
 4 files changed, 19 insertions(+)
 create mode 100644 package/urandom-scripts/Config.in
 rename package/{initscripts/init.d => urandom-scripts}/S20urandom (100%)
 create mode 100644 package/urandom-scripts/urandom-scripts.mk
package/Config.in +1 -0
index 22531d4fb5..89bcafc398 100644
@@ -2290,6 +2290,7 @@ menu "Security"
 	source "package/selinux-python/Config.in"
 	source "package/semodule-utils/Config.in"
 	source "package/setools/Config.in"
+	source "package/urandom-scripts/Config.in"
 endmenu
 
 menu "Shell and utilities"
package/urandom-scripts/Config.in new file +6 -0
new file mode 100644
index 0000000000..5451206bd2
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_URANDOM_SCRIPTS
+	bool "urandom-initscripts"
+	default y if BR2_ROOTFS_SKELETON_DEFAULT
+	depends on BR2_PACKAGE_INITSCRIPTS
+	help
+	  Initscript to preserve the random seed between reboots.
package/urandom-scripts/S20urandom renamed from package/initscripts/init.d/S20urandom +0 -0
similarity index 100%
rename from package/initscripts/init.d/S20urandom
rename to package/urandom-scripts/S20urandom
package/urandom-scripts/urandom-scripts.mk new file +12 -0
new file mode 100644
index 0000000000..2c09728c46
@@ -0,0 +1,12 @@
+################################################################################
+#
+# urandom-scripts
+#
+################################################################################
+
+define URANDOM_SCRIPTS_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 0755 $(URANDOM_SCRIPTS_PKGDIR)/S20urandom \
+		$(TARGET_DIR)/etc/init.d/S20urandom
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/1 package/urandom-scripts: new package

Christoph, All,

On 2020-07-20 17:20 +0200, christoph.muellner at theobroma-systems.com spake thusly:

Quoted 9 lines

From: Christoph M?llner <[email protected]>

The init script S20urandom is used to preserve the kernel's RNG seed between reboots. This functionality is not required for the package "initscripts". Further there are use-cases where this script should not be installed at all (e.g. systems that only have read-only partitions), but that's currently not possible as the script is a mandatory part of the package "initscripts".

Quoted 5 lines

Let's move the script into its own package "urandom-scripts" and select it, if the default skeleton is enabled. This maintains backward-compatibility and allows to deselect it.

Applied to master, with a few changes, see below...

Quoted 28 lines
---
 package/Config.in                                    |  1 +
 package/urandom-scripts/Config.in                    |  6 ++++++
 .../init.d => urandom-scripts}/S20urandom            |  0
 package/urandom-scripts/urandom-scripts.mk           | 12 ++++++++++++
 4 files changed, 19 insertions(+)
 create mode 100644 package/urandom-scripts/Config.in
 rename package/{initscripts/init.d => urandom-scripts}/S20urandom (100%)
 create mode 100644 package/urandom-scripts/urandom-scripts.mk
package/Config.in +1 -0
index 22531d4fb5..89bcafc398 100644
@@ -2290,6 +2290,7 @@ menu "Security"
 	source "package/selinux-python/Config.in"
 	source "package/semodule-utils/Config.in"
 	source "package/setools/Config.in"
+	source "package/urandom-scripts/Config.in"
 endmenu
 
 menu "Shell and utilities"
package/urandom-scripts/Config.in new file +0 -0
new file mode 100644
index 0000000000..5451206bd2

package/urandom-scripts/Config.in line 4

Quoted 4 lines
package/urandom-scripts/Config.in new file +4 -0
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_URANDOM_SCRIPTS
+	bool "urandom-initscripts"
+	default y if BR2_ROOTFS_SKELETON_DEFAULT
+	depends on BR2_PACKAGE_INITSCRIPTS

I see that you miodelled your package after ifupdown-scripts, which is good (I like being copied, thanks!).

However, I think the best chnage was to keep the existign behaviour: it default to 'y' when initscripts is enabled, as it previously came from initscripts.

Furthermore, sysV init scripts can be used when openRC is the init system, and custom (none) init system could make use of them too. So I made it unavailable only for systemd.

package/urandom-scripts/Config.in line 6

Quoted 2 lines
package/urandom-scripts/Config.in new file +2 -0
+	help
+	  Initscript to preserve the random seed between reboots.

I extended the help text to state that this is a poor solution overall, and that better alternative exist.

Applied to master, thanks!

Regards,
Yann E. MORIN.

Quoted 25 lines
package/urandom-scripts/S20urandom renamed from package/initscripts/init.d/S20urandom +0 -0
similarity index 100%
rename from package/initscripts/init.d/S20urandom
rename to package/urandom-scripts/S20urandom
package/urandom-scripts/urandom-scripts.mk new file +12 -0
new file mode 100644
index 0000000000..2c09728c46
@@ -0,0 +1,12 @@
+################################################################################
+#
+# urandom-scripts
+#
+################################################################################
+
+define URANDOM_SCRIPTS_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 0755 $(URANDOM_SCRIPTS_PKGDIR)/S20urandom \
+		$(TARGET_DIR)/etc/init.d/S20urandom
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.26.2
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'