All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] package/skeleton-init-openrc: prepare runlevels from make over skeleton
@ 2022-06-22 21:20 James Knight via buildroot
  2022-06-22 21:20 ` [Buildroot] [PATCH 2/2] .gitattributes: default lf line endings for text files James Knight via buildroot
  2023-02-07 21:20 ` [Buildroot] [PATCH 1/2] package/skeleton-init-openrc: prepare runlevels from make over skeleton Thomas Petazzoni via buildroot
  0 siblings, 2 replies; 6+ messages in thread
From: James Knight via buildroot @ 2022-06-22 21:20 UTC (permalink / raw)
  To: buildroot; +Cc: James Knight

The following commit changes the creation of an OpenRC environment's
`/etc/runlevels/default/sysv-rcs` symbolic link from the skeleton to
inside the package's Makefile (triggered from the
`SKELETON_INIT_OPENRC_INSTALL_TARGET_CMDS` call). The original symlink
to a `/etc/init.d/sysv-rcs` path may not gracefully work for all
developer environments. For example, on a fresh checkout in a Windows
environment, the symbolic link may be automatically updated to
include a drive specification. For example:

    $ git diff
    diff --git a/package/skeleton-init-openrc/skeleton/etc/runlevels/default/sysv-rcs b/package/skeleton-init-openrc/skeleton/etc/runlevels/default/sysv-rcs
    index ef5e00823c..e417b4bb44 120000
    --- a/package/skeleton-init-openrc/skeleton/etc/runlevels/default/sysv-rcs
    +++ b/package/skeleton-init-openrc/skeleton/etc/runlevels/default/sysv-rcs
    @@ -1 +1 @@
    -/etc/init.d/sysv-rcs
    \ No newline at end of file
    +G:/etc/init.d/sysv-rcs
    \ No newline at end of file

If a developer built with fresh checkout using an example
`qemu_x86_defconfig` tailored to target an OpenRC init system, an
improper symlink can be observed in the target system:

    ...
    Welcome to Buildroot
    buildroot login: root
    Jun 22 20:42:34 login[971]: root login on 'console'
    # /etc/runlevels/default/sysv-rcs  --version
    -sh: /etc/runlevels/default/sysv-rcs: not found
    # readlink /etc/runlevels/default/sysv-rcs
    /??/G:/etc/init.d/sysv-rcs
    #  /etc/init.d/sysv-rcs --version
    sysv-rcs (OpenRC) 0.43.3 (Buildroot 2022.05-225-g64390b6c42-dirty)

By switching from having the symbolic link in the skeleton file to
building it during the package's install stage, this (1) prevents
oddities with a Git working environment on environments like Windows,
as well as (2) ensures a proper symlink is created in a Windows
environment. For example:

    # readlink /etc/runlevels/default/sysv-rcs
    /etc/init.d/sysv-rcs
    # /etc/runlevels/default/sysv-rcs --version
    sysv-rcs (OpenRC) 0.43.3 (Buildroot 2022.05-225-g64390b6c42-dirty)

Signed-off-by: James Knight <james.knight@collins.com>
---
 package/skeleton-init-openrc/skeleton-init-openrc.mk             | 1 +
 .../skeleton-init-openrc/skeleton/etc/runlevels/default/sysv-rcs | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)
 delete mode 120000 package/skeleton-init-openrc/skeleton/etc/runlevels/default/sysv-rcs

diff --git a/package/skeleton-init-openrc/skeleton-init-openrc.mk b/package/skeleton-init-openrc/skeleton-init-openrc.mk
index b0538ad03ff6203cbe24ebc2e2e4bd2a5af4bed9..625c5d8a8ea0476f9574da9718083c3de69a3c1f 100644
--- a/package/skeleton-init-openrc/skeleton-init-openrc.mk
+++ b/package/skeleton-init-openrc/skeleton-init-openrc.mk
@@ -32,6 +32,7 @@ endif # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW
 define SKELETON_INIT_OPENRC_INSTALL_TARGET_CMDS
 	$(call SYSTEM_RSYNC,$(SKELETON_INIT_OPENRC_PKGDIR)/skeleton,$(TARGET_DIR))
 	$(SKELETON_INIT_OPENRC_ROOT_RO_OR_RW)
+	ln -s /etc/init.d/sysv-rcs $(TARGET_DIR)/etc/runlevels/default/sysv-rcs
 endef
 
 $(eval $(generic-package))
diff --git a/package/skeleton-init-openrc/skeleton/etc/runlevels/default/sysv-rcs b/package/skeleton-init-openrc/skeleton/etc/runlevels/default/sysv-rcs
deleted file mode 120000
index ef5e00823c63ed0244be26e6082e17d8e135f5ea..0000000000000000000000000000000000000000
--- a/package/skeleton-init-openrc/skeleton/etc/runlevels/default/sysv-rcs
+++ /dev/null
@@ -1 +0,0 @@
-/etc/init.d/sysv-rcs
\ No newline at end of file
-- 
2.30.0.windows.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-02-07 21:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-22 21:20 [Buildroot] [PATCH 1/2] package/skeleton-init-openrc: prepare runlevels from make over skeleton James Knight via buildroot
2022-06-22 21:20 ` [Buildroot] [PATCH 2/2] .gitattributes: default lf line endings for text files James Knight via buildroot
2022-06-23  5:51   ` James Hilliard
2022-06-23 15:35     ` [Buildroot] [External] " Knight, James D - Collins via buildroot
2022-09-18  9:32   ` [Buildroot] " Arnout Vandecappelle
2023-02-07 21:20 ` [Buildroot] [PATCH 1/2] package/skeleton-init-openrc: prepare runlevels from make over skeleton Thomas Petazzoni via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.