Skip to contentSkip to conversation

system: use system shell as root shell

PATCH New Yann E. MORIN 2 participants 4 messages Aug 1, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 system: use system shell as root shell

From: Philip Molloy <[email protected]>

[yann.morin.1998 at free.fr: use the sytem shell, not a new option,
as suggested by Arnout]

Cc Arnout Vandecappelle <[email protected]>

---
Changes v1 -> v2:
- drop the new option, use the system shell

---
 package/skeleton-init-common/skeleton-init-common.mk | 2 ++
 1 file changed, 2 insertions(+)
package/skeleton-init-common/skeleton-init-common.mk +2 -0
index e429b13d78..b4fb11b369 100644
@@ -95,6 +95,8 @@ SKELETON_INIT_COMMON_TARGET_FINALIZE_HOOKS += SKELETON_INIT_COMMON_ADD_SH_TO_SHE
 ifneq ($(SKELETON_INIT_COMMON_BIN_SH),)
 define SKELETON_INIT_COMMON_SET_BIN_SH
 	ln -sf $(SKELETON_INIT_COMMON_BIN_SH) $(TARGET_DIR)/bin/sh
+	$(SED) '/^\root/s,:[^:]*$$,$(SKELETON_INIT_COMMON_BIN_SH),' \
+		$(TARGET_DIR)/etc/passwd
 endef
 endif
 endif
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 1/1 system: use system shell as root shell

Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

From: Philip Molloy <[email protected]>

Quoted 8 lines

[yann.morin.1998 at free.fr: use the sytem shell, not a new option,
as suggested by Arnout]

Cc Arnout Vandecappelle <[email protected]>

---
Changes v1 -> v2:
- drop the new option, use the system shell

Committed after extending the commit message with a description about _WHY_ this is done (taken from Philip's help text), thanks.

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH v2 1/1 system: use system shell as root shell

In reply to Yann E. MORIN
Quoted 21 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

From: Philip Molloy <[email protected]>

[yann.morin.1998 at free.fr: use the sytem shell, not a new option,
as suggested by Arnout]

Cc Arnout Vandecappelle <[email protected]>

---
Changes v1 -> v2:
- drop the new option, use the system shell

---
 package/skeleton-init-common/skeleton-init-common.mk | 2 ++
 1 file changed, 2 insertions(+)
package/skeleton-init-common/skeleton-init-common.mk +0 -0
index e429b13d78..b4fb11b369 100644

package/skeleton-init-common/skeleton-init-common.mk SKELETON_INIT_COMMON_TARGET_FINALIZE_HOOKS += SKELETON_INIT_COMMON_ADD_SH_TO_SHE · line 99

Quoted 5 lines
package/skeleton-init-common/skeleton-init-common.mk +2 -0
@@ -95,6 +95,8 @@ SKELETON_INIT_COMMON_TARGET_FINALIZE_HOOKS += SKELETON_INIT_COMMON_ADD_SH_TO_SHE
 ifneq ($(SKELETON_INIT_COMMON_BIN_SH),)
 define SKELETON_INIT_COMMON_SET_BIN_SH
 	ln -sf $(SKELETON_INIT_COMMON_BIN_SH) $(TARGET_DIR)/bin/sh
+	$(SED) '/^\root/s,:[^:]*$$,$(SKELETON_INIT_COMMON_BIN_SH),' \
+		$(TARGET_DIR)/etc/passwd

Hmm, wait a second - This sed invocation doesn't make any sense to me.

You search for ^\root, what is the backslash for? The search should also include the : separator to ensure it doesn't match 'rootfoo' or similar.

You replace the last : and everything after it (E.G. /bin/sh) with $(SKELETON_INIT_COMMON_BIN_SH), so you drop the last :.

I've fixed that up while committing, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH v2 1/1 system: use system shell as root shell

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

Hi,

Quoted 7 lines

Hmm, wait a second - This sed invocation doesn't make any sense to me.

You search for ^\root, what is the backslash for? The search should also include the : separator to ensure it doesn't match 'rootfoo' or similar.

You replace the last : and everything after it (E.G. /bin/sh) with $(SKELETON_INIT_COMMON_BIN_SH), so you drop the last :.

Sorry, sent too fast - Last issue: SKELETON_INIT_COMMON_BIN_SH is the name of the shell without path info, so we need to ensure it is prefixed with /bin/

Signature · 1 line
Bye, Peter Korsgaard