summaryrefslogtreecommitdiff
blob: 33e53253b45151d4c983cd012cf7d7de6a100bb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
https://bugs.gentoo.org/show_bug.cgi?id=363577

diff --git a/catalyst-2.0.18/modules/generic_stage_target.py b/catalyst-2.0.18/modules/generic_stage_target.py
index cc24c63..ad8138d 100644
--- a/catalyst-2.0.18/modules/generic_stage_target.py
+++ b/catalyst-2.0.18/modules/generic_stage_target.py
@@ -1124,11 +1124,17 @@ class generic_stage_target(generic_target):
 				self.settings["chroot_path"]+"/etc/hosts",\
 				"Could not replace /etc/hosts",env=self.env)
 
+		""" GNU sed should be used on Gentoo/FreeBSD """
+		if os.uname()[0] == "FreeBSD":
+			self.settings["sed"]="gsed"
+		else:
+			self.settings["sed"]="sed"
+
 		""" Remove our overlay """
 		if os.path.exists(self.settings["chroot_path"]+"/usr/local/portage"):
 			cmd("rm -rf "+self.settings["chroot_path"]+"/usr/local/portage",\
 				"Could not remove /usr/local/portage",env=self.env)
-			cmd("sed -i '/^PORTDIR_OVERLAY/d' "+self.settings["chroot_path"]+\
+			cmd(self.settings["sed"]+" -i '/^PORTDIR_OVERLAY/d' "+self.settings["chroot_path"]+\
 				"/etc/portage/make.conf",\
 				"Could not remove PORTDIR_OVERLAY from make.conf",env=self.env)
 
diff --git a/catalyst-2.0.18/targets/support/chroot-functions.sh b/catalyst-2.0.18/targets/support/chroot-functions.sh
index 67874a0..983a3a7 100755
--- a/catalyst-2.0.18/targets/support/chroot-functions.sh
+++ b/catalyst-2.0.18/targets/support/chroot-functions.sh
@@ -422,5 +422,22 @@ Comment=This is a link to the local copy of the Gentoo Linux Handbook.
 Icon=text-editor" > /usr/share/applications/gentoo-handbook.desktop
 }
 
+# GNU sed wrapper
+sed(){
+	if [ -e /usr/bin/gsed ]
+	then
+		/usr/bin/gsed "$@"
+	elif [ -e /bin/sed ]
+	then
+		/bin/sed "$@"
+	elif [ -e /usr/bin/sed ]
+	then
+		/usr/bin/sed "$@"
+	else
+		echo "ERROR: Failed to select sed."
+		exit 1
+	fi
+}
+
 # We do this everywhere, so why not put it in this script
 run_default_funcs