summaryrefslogtreecommitdiff
blob: a6824f524517d3b9cf3000436fb533ac3d051e60 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
--- ybin/yabootconfig.orig	2003-02-08 23:53:46.000000000 -0500
+++ ybin/yabootconfig	2003-02-26 15:07:50.000000000 -0500
@@ -4,6 +4,7 @@
 ##
 ## yabootconfig generates a simple /etc/yaboot.conf
 ## Copyright (C) 2001, 2002, 2003 Ethan Benson
+## Patched for Gentoo and dual boot - Mark Guertin <gerk@gentoo.org>
 ##
 ## This program is free software; you can redistribute it and/or
 ## modify it under the terms of the GNU General Public License
@@ -264,6 +265,31 @@
     return 0
 }
 
+dualboot()
+{
+	DRIVELIST=`ls -d /dev/?d?* | grep "[sh]d[abcdefghijkl]" | cut -b 6-8 | sort -u`
+
+	for i in $DRIVELIST
+	do
+		HFS=`mac-fdisk -l "/dev/$i" | grep '\<Apple_HFS\>' | grep -v "CDROM" | cut -d" " -f1`
+		for h in $HFS
+		do
+			if [ !-x `hpmount -r $h` > /dev/null 2>&1 ] ; then
+				if [ `hpls mach_kernel 2>/dev/null` ] ; then
+					[ "$QUIET" = 0 ] && echo "Found possible OS X/Darwin partition at $h"
+					OSX=$h
+				fi
+				if [ "`hpls "System Folder" 2>/dev/null`" ] ; then
+					[ "$QUIET" = 0 ] && echo "Found possible Mac OS partition at $h"
+					MACOS=$h
+				fi		
+				hpumount $h > /dev/null 2>&1
+			fi
+		done
+	done
+}
+
+
 ##########
 ## Main ##
 ##########
@@ -579,6 +605,15 @@
     fi
 fi
 
+## setup any Mac OS/OS X partitions
+dualboot
+if [ -n "$MACOS" ] ; then
+	MACOSBOOT="macos=${MACOS}\n"
+fi
+if [ -n "$OSX" ] ; then
+	OSXBOOT="macosx=${OSX}\n"
+fi
+
 ## generate global section of yaboot.conf
 GLOBAL="## yaboot.conf generated by $PRG $VERSION
 ##
@@ -596,7 +631,7 @@
 IMAGES="
 image=$IMAGE
 \tlabel=Linux
-\tread-only\n${APPEND:-}"
+\tread-only\n${APPEND:-}\n${OSXBOOT:-}\n${MACOSBOOT:-}"
 
 ## safely create a tmp file then move it into place after we are sure
 ## it was written.
@@ -667,4 +702,10 @@
     fi
 fi
 
+## Give user a warning about possible b0rkage
+
+[ "$QUIET" = 0 ] && echo -e "\nConfiguration complete.  If there are no errors above you should
+have a working configuration.  see man yaboot.conf if you run into
+any errors."
+
 exit 0