Splux Linux

source-based Linux using SPS

SPS · log · files · refs · tags · releases · people · languages · GitHub · commit

c9ccbad


Point installed systems at the official Git repositories

Date
Commitc9ccbade67ceff062e137688d1579d6b73f88879
GitHubmirror

Parents

Stat

 README.md           |  7 +++++--
 bin/setup           | 54 +++++++++++++++++++++--------------------------------
 tests/test_setup.sh | 19 ++++++++++---------
 3 files changed, 36 insertions(+), 44 deletions(-)

Diff

diff --git a/README.md b/README.md
index fad4f5d..27f735f 100644
--- a/README.md
+++ b/README.md
@@ -199,8 +199,11 @@ SSH, and more. `setup --list-sets` prints them. There is also an extra-package
 checklist (`--extra`) plus locale and login-shell screens.
 
 The installer writes hostname, timezone, keymap, and a first user into the
-target, then copies bundled live recipe trees (when present), runs
-`src update`, and `sget install`. Guided partitioning is optional and waits
+target, indexes the bundled live recipe trees in place (when present), runs
+`src update`, and `sget install`. The installed system is registered with
+the official `sps-core`/`sps-extra` Git repositories, so it keeps receiving
+recipe updates after install; only the install-time indexing uses the live
+bundles. Guided partitioning is optional and waits
 until the last confirmation. Choose systemd, OpenRC, s6, runit, dinit, Shepherd, or SysV as PID 1 (`--init`); those packages conflict. `grub-install` still needs
 `--install-bootloader` and `--disk`.
 
diff --git a/bin/setup b/bin/setup
index 707ed6b..2c8f3f1 100755
--- a/bin/setup
+++ b/bin/setup
@@ -1739,8 +1739,9 @@ setup_apply_config()
 	fi
 
 	setup_write_answers_file "$setup_etc/sps/setup-answers"
-	# Installed-system paths. src update during setup used $setup_root
-	# prefixes so it could index the copied trees before first boot.
+	# Installed-system paths. src update during setup used the live
+	# system's bundled trees; the installed machine tracks the official
+	# Git remotes so it keeps receiving recipe updates.
 	setup_write_repos_conf ""
 
 	if [ ! -f "$setup_etc/passwd" ]; then
@@ -1903,10 +1904,12 @@ EOF
 	fi
 }
 
-# Copy bundled live recipe trees into the target and write repos.conf so
-# src update indexes local dir repos. Live ISOs already have those trees
-# at /usr/src/sps/{core,extra}; cloning GitHub during setup is what made
-# "updating source repositories" hang or fail offline.
+# Index the live system's bundled recipe trees in place (read-only) and
+# write repos.conf so src update during setup works offline. Live ISOs
+# already have those trees at /usr/src/sps/{core,extra}; cloning GitHub
+# during setup is what made "updating source repositories" hang or fail
+# offline. The installed machine re-points to the official Git remotes so
+# it keeps receiving recipe updates after install.
 setup_tree_has_recipe()
 {
 	setup_probe=$1
@@ -1922,46 +1925,30 @@ setup_tree_has_recipe()
 setup_seed_one_tree()
 {
 	setup_seed_name=$1
-	setup_seed_src=$setup_live_root/usr/src/sps/$setup_seed_name
-	setup_seed_dest=$setup_root/usr/src/sps/$setup_seed_name
+	setup_seed_src=${setup_live_root%/}/usr/src/sps/$setup_seed_name
 	setup_tree_has_recipe "$setup_seed_src" || return 1
-	setup_seed_src_abs=$(CDPATH= cd -P "$setup_seed_src" 2>/dev/null &&
-		pwd -P) || return 1
-	if [ -d "$setup_seed_dest" ]; then
-		setup_seed_dest_abs=$(CDPATH= cd -P "$setup_seed_dest" \
-			2>/dev/null && pwd -P) || setup_seed_dest_abs=
-		if [ -n "$setup_seed_dest_abs" ] &&
-		   [ "$setup_seed_src_abs" = "$setup_seed_dest_abs" ]; then
-			return 0
-		fi
-		if setup_tree_has_recipe "$setup_seed_dest"; then
-			return 0
-		fi
-	fi
-	printf '%s: copying live %s recipes into the target\n' \
-		"$sps_prog" "$setup_seed_name" >&2
-	mkdir -p "$setup_seed_dest" || return 1
-	cp -a "$setup_seed_src"/. "$setup_seed_dest"/ || return 1
-	rm -rf "$setup_seed_dest/.git"
 	return 0
 }
 
 setup_write_repos_conf()
 {
 	setup_repos_prefix=$1
+	setup_repos_mode=${2:-installed}
 	setup_repos_core=/usr/src/sps/core
 	setup_repos_extra=/usr/src/sps/extra
-	if [ -n "$setup_repos_prefix" ]; then
+	if [ -n "$setup_repos_prefix" ] && [ "$setup_repos_prefix" != / ]; then
 		setup_repos_core=$setup_repos_prefix$setup_repos_core
 		setup_repos_extra=$setup_repos_prefix$setup_repos_extra
 	fi
 	{
-		if [ "${setup_have_core:-0}" -eq 1 ]; then
+		if [ "$setup_repos_mode" = seed ] &&
+		   [ "${setup_have_core:-0}" -eq 1 ]; then
 			printf 'dir core %s 100\n' "$setup_repos_core"
 		else
 			printf 'git core https://github.com/RobertFlexx/sps-core.git 100\n'
 		fi
-		if [ "${setup_have_extra:-0}" -eq 1 ]; then
+		if [ "$setup_repos_mode" = seed ] &&
+		   [ "${setup_have_extra:-0}" -eq 1 ]; then
 			printf 'dir extra %s 80\n' "$setup_repos_extra"
 		else
 			printf 'git extra https://github.com/RobertFlexx/sps-extra.git 80\n'
@@ -1995,12 +1982,13 @@ setup_seed_recipe_trees()
 		setup_have_extra=1
 	fi
 
-	# Paths must exist on this system during src update. apply_config
-	# rewrites them to /usr/src/sps/... for the installed machine.
-	setup_write_repos_conf "$setup_root"
+	# During setup, the live system's bundled trees must exist for src
+	# update to index them in place. apply_config later re-points the
+	# installed machine at the official Git remotes.
+	setup_write_repos_conf "${setup_live_root%/}" seed
 
 	if [ "$setup_have_core" -eq 1 ] && [ "$setup_have_extra" -eq 1 ]; then
-		printf '%s: using bundled recipes; src update indexes them locally\n' \
+		printf '%s: indexing live bundled recipes; the installed system tracks the official Git repositories\n' \
 			"$sps_prog" >&2
 	else
 		printf '%s: missing bundled recipes; src update will clone from the network\n' \
diff --git a/tests/test_setup.sh b/tests/test_setup.sh
index 8845c33..8b52198 100755
--- a/tests/test_setup.sh
+++ b/tests/test_setup.sh
@@ -186,7 +186,8 @@ grep -q 'wheel:.*tester' "$root_pw/etc/group" ||
 
 printf '%s\n' 'setup fixture tests passed'
 
-# Bundled live recipes: copy into the target and index locally (no Git clone).
+# Bundled live recipes: index them in place offline during setup, but the
+# installed machine re-points at the official Git repositories.
 live=$tmp/live
 mkdir -p "$live/usr/src/sps/core/hello" "$live/usr/src/sps/extra/placeholder"
 cat >"$live/usr/src/sps/core/hello/recipe" <<'EOF'
@@ -225,15 +226,15 @@ mkdir -p "$root_seed" "$db_seed" "$cache_seed" "$build_seed"
 
 [ "$(cat "$root_seed/usr/share/sps-test/hello")" = bundled ] ||
 	fail 'bundled hello was not installed'
-[ -f "$root_seed/usr/src/sps/core/hello/recipe" ] ||
-	fail 'live recipe tree was not copied into the target'
-grep -qx 'dir core /usr/src/sps/core 100' "$root_seed/etc/sps/repos.conf" ||
-	fail 'installed repos.conf must use /usr/src/sps paths'
-grep -qx 'dir extra /usr/src/sps/extra 80' "$root_seed/etc/sps/repos.conf" ||
-	fail 'installed repos.conf must keep bundled extra as a dir repo'
-if grep -E '^[[:space:]]*git ' "$root_seed/etc/sps/repos.conf" >/dev/null; then
-	fail 'bundled live trees must not fall back to git'
+if grep -E '^[[:space:]]*dir (core|extra) ' "$root_seed/etc/sps/repos.conf" >/dev/null; then
+	fail 'installed repos.conf must not keep bundled trees as dir repos'
 fi
+grep -qx 'git core https://github.com/RobertFlexx/sps-core.git 100' \
+	"$root_seed/etc/sps/repos.conf" ||
+	fail 'installed repos.conf must track git core by default'
+grep -qx 'git extra https://github.com/RobertFlexx/sps-extra.git 80' \
+	"$root_seed/etc/sps/repos.conf" ||
+	fail 'installed repos.conf must track git extra by default'
 grep -F 'sps-community.git' "$root_seed/etc/sps/repos.conf" >/dev/null ||
 	fail 'installed repos.conf must document opt-in community'
 if grep -E '^[[:space:]]*git community ' "$root_seed/etc/sps/repos.conf" >/dev/null; then