[SM-Commit] GIT changes to master grimoire by Thomas Orgis (99e7279813ac0bae4eb45c2cfc0a4bbc2fb74f80)

Thomas Orgis scm at sourcemage.org
Sun May 6 20:17:04 EDT 2007


GIT changes to master grimoire by Thomas Orgis <sobukus at sourcemage.org>:

 smgl/smgl-fhs/HISTORY |    6 ++++++
 smgl/smgl-fhs/INSTALL |   17 +++++++++++++----
 2 files changed, 19 insertions(+), 4 deletions(-)

New commits:
commit 7f2f46240cf9eee7501c5400c86a81047bdd1e65
Author: Thomas Orgis <sobukus at sourcemage.org>
Commit: Thomas Orgis <sobukus at sourcemage.org>

    smgl-fhs: Ensure minimal passwd files with root account for chroots.

diff --git a/smgl/smgl-fhs/HISTORY b/smgl/smgl-fhs/HISTORY
index 5720b05..c76d60f 100644
--- a/smgl/smgl-fhs/HISTORY
+++ b/smgl/smgl-fhs/HISTORY
@@ -1,3 +1,9 @@
+2007-05-06 Thomas Orgis <soukus at sourcemage.org>
+	* INSTALL: ensure minimal passwd files with root:root
+	  for possibly cast in yet-empty to-be chroot dir
+	  That way, _every_ system account should be created by casts
+	  instead of hand work.
+
 2007-03-18 Thomas Orgis <soukus at sourcemage.org>
 	* INSTALL: added creation of root and bin user (groups implied),
 	  this could/should be removed when we have our account system reworked.
diff --git a/smgl/smgl-fhs/INSTALL b/smgl/smgl-fhs/INSTALL
index acd4ac9..2e965ad 100755
--- a/smgl/smgl-fhs/INSTALL
+++ b/smgl/smgl-fhs/INSTALL
@@ -10,11 +10,9 @@ function  fhs_mkdir()
 }
 
 #
-# That is ugly, but we need to ensure minimal accounts that usually are copied
-# from iso. At least in theory (for chroots), we should create everything via spells.
 # Root account is always needed, bin user/group is provided by iso and an unknown
-# number of spells need it. Perhaps one should make a smgl-system-accounts spell and
-# remove all create_(account|group) from here?
+# number of spells need it.
+# Note: We assume that the currently active system has existing /etc/passwd.
 #
 create_account root &&
 create_account bin  &&
@@ -31,6 +29,17 @@ done  &&
 fhs_mkdir /tmp 1777  &&
 
 #
+# For a chroot, we need minimal passwd files with root account once we enter it.
+# without existing passwd, not even `useradd root` will work!
+#
+if ! [[ -e "$INSTALL_ROOT/etc/passwd" ]]; then
+  echo 'root:!:0:0:root:/root:/bin/bash' > "$INSTALL_ROOT/etc/passwd"
+fi &&
+if ! [[ -e "$INSTALL_ROOT/etc/group" ]]; then
+  echo 'root:!:0:' > "$INSTALL_ROOT/etc/group"
+fi &&
+
+#
 # http://www.pathname.com/fhs/2.2/fhs-6.1.html
 # in the linux specific section, /proc is indeed mentioned
 #



More information about the SM-Commit mailing list