From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.77) (envelope-from ) id 1SmI2X-0004V3-4E for garchives@archives.gentoo.org; Wed, 04 Jul 2012 05:22:13 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 959D0E05DB; Wed, 4 Jul 2012 05:21:57 +0000 (UTC) Received: from mail-yx0-f181.google.com (mail-yx0-f181.google.com [209.85.213.181]) by pigeon.gentoo.org (Postfix) with ESMTP id 500C0E055E for ; Wed, 4 Jul 2012 05:20:34 +0000 (UTC) Received: by yenl3 with SMTP id l3so6736254yen.40 for ; Tue, 03 Jul 2012 22:20:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=lfq2LKBzEMWAjTHmv17IxvCoMsPWx6uKcBjZ1JTUkQs=; b=Lf4bCI+hfLP+CqgDqC/rldkxSytFqF26cFnhj+3CHNFoHBz8CqjAiL2p0SO312PPwN 54JEd4Dta0G7REdA125KdCLheH0eKF4CDcPlGS5val4lyFwDXGwgrsYdTQiAU7REZ+67 AMnHVrAz4K73ivh4eLKFlxJK80C52FYNCaWburU/VGxMDW+W56/OFrkRMrfI9wdyiuc8 mmOYtxnxHT4pvws/MGnvtECV5m/1oJSBv/P6SB+iOgLJTRp4uXXjaGUr7v/Zbu9JWIza gZ+/qyWKsO2kdM47RiIaqOowPsavbWHt7DPdUuFH7i/07+STjFsynmb+3tdJVWcneyfF HfLQ== Received: by 10.43.59.71 with SMTP id wn7mr6140358icb.0.1341379233035; Tue, 03 Jul 2012 22:20:33 -0700 (PDT) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Received: by 10.50.70.66 with HTTP; Tue, 3 Jul 2012 22:20:12 -0700 (PDT) In-Reply-To: References: From: Kaddeh Date: Tue, 3 Jul 2012 22:20:12 -0700 Message-ID: Subject: Re: [gentoo-user] Re: Gentoo install script To: gentoo-user@lists.gentoo.org Content-Type: multipart/alternative; boundary=bcaec51ddaa7b1b43b04c3fa30c1 X-Archives-Salt: 7d338ab4-5610-443a-a3ed-528fccb19257 X-Archives-Hash: 61f6562dc18b65545dd2747d18426744 --bcaec51ddaa7b1b43b04c3fa30c1 Content-Type: text/plain; charset=ISO-8859-1 Very well done, reminded me of some code that I wrote (poorly, I might add) but, I dug it up and found some changes that you might be able to implement instead of lines and lines of static configs. That being said, take some of these changes into consideration. Dynamic detection of drives and partitions: # Get Existing Drives existing_drives=$(fdisk -l | grep /dev | grep -i disk | cut -c11-13) # Set default drive default_drive=$(fdisk -l | grep --max-count=1 /dev | cut -c11-13) echo -e "What drive do you want to partition? [$existing_drives]: \c" read drive and then creating the partition table later: # Make Drive Selection if [ "$drive" == "" ] then selected_drive=$default_drive else # Verify Drive Exists does_exist=$(fdisk -l | grep --max-count=1 -ci $drive) if [ "$does_exist" == "1" ] then selected_drive=$drive else echo -e "The selected drive" $drive "does not exist. Using" $default_drive "instead." selected_drive=$default_drive fi fi num_partitions=$(fdisk -l | grep ^/dev | grep -ic $selected_drive) echo "There are" $num_partitions "partitions on" $selected_drive partitions=1 # Clear existing partition file rm -rf partition_table touch partition_table while [ "$partitions" -le "$num_partitions" ] do # Find partition numbers edit_partitions=$(fdisk -l | grep ^/dev/$selected_drive | cut -c9) # Parse out extra partitons if [ "$partitions" == "1" ] then work_partition=$(echo -e $edit_partitions | cut -c$partitions) # Write to partition_table file echo -e "d\n$work_partition" >> partition_table else if [ "$partitions_cut" == "" ] then # If First Partition after partition 1, cut off $partitions + 1 partitions_cut=$(($partitions+1)) else partitions_cut=$(($partitions_cut+1)) fi work_partition=$(echo -e $edit_partitions | cut -c$partitions_cut) # Write to partition_table file echo -e "d\n$work_partition" >> partition_table ((partitions_cut += 1)) fi ((partitions += 1)) done # build the rest of the table # Get Total System Memory total_mem=$(cat /proc/meminfo | grep -i memtotal | cut -c16- | sed s/\ // | sed s/kB//) swap_space=$(expr $(expr $total_mem + $total_mem) / 1024) # Write first partition to file echo -e "n\np\n1\n\n+100M\n" >> partition_table # Write Swap Space (double system memory) echo -e "n\np\n2\n\n+"$swap_space"M\n">> partition_table # Write / partition to file echo -e "n\np\n3\n\n\n" >> partition_table # Write partition setting to file and drive write echo -e "a\n1\nt\n2\n82\nw\n" >> partition_table # Set drive number variables boot_drive=$(echo $selected_drive"1") swap_drive=$(echo $selected_drive"2") root_drive=$(echo $selected_drive"3") # KEEP THIS COMMENTED OUT BELLOW HERE fdisk /dev/$selected_drive < partition_table Mainly due to the fact that you statically set the UUIDs of the drive that you want to use. Cheers, Kad On Sun, Jul 1, 2012 at 5:28 PM, Michael Mol wrote: > On Wed, Jun 27, 2012 at 10:13 PM, Michael Mol wrote: > > Very rough, and very much a works-for-me thing, but I thought I'd share. > > > > https://github.com/mikemol/gentoo-install > > > > I wrote it to ease the pain of the "install-configure-build" cycle I > > was going through to figure out what was breaking glibc. > > Just a bit of a followup. I've got most of the bugs worked out, and > I'm very pleased with it. I've used it to get through most of the > install sequence for inara, and it's currently on package 113/158 of > its second pass of 'emerge -e @world'. > > If anyone else gets around to trying it, let me know. :) > > -- > :wq > > --bcaec51ddaa7b1b43b04c3fa30c1 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Very well done, reminded me of some code that I wrote (poorly, I might add)= but, I dug it up and found some changes that you might be able to implemen= t instead of lines and lines of static configs. =A0That being said, take so= me of these changes into consideration.

Dynamic detection of drives and partitions:
# Get Existing Drives
existing_drives=3D$(fdisk -l | grep /dev | grep -i disk | cut -c11-13)

# Set default drive
default_drive=3D$(fdisk -l | grep --max-count=3D1 /dev | cut -c11-13)

echo -e "What drive do you want to partition? [$existing_drives]: \c&q=
uot;
read drive
and then creating the partition table later:
# Make Drive Sele=
ction
if [ "$drive" =3D=3D "" ]
then
	selected_drive=3D$default_drive
else
	# Verify Drive Exists
	does_exist=3D$(fdisk -l | grep --max-count=3D1 -ci $drive)

	if [ "$does_exist" =3D=3D "1" ]
	then
		selected_drive=3D$drive
	else
		echo -e "The selected drive" $drive "does not exist.  Usin=
g" $default_drive "instead."
		selected_drive=3D$default_drive
	fi
fi

num_partitions=3D$(fdisk -l | grep ^/dev | grep -ic $selected_drive)

echo "There are" $num_partitions "partitions on" $selec=
ted_drive

partitions=3D1

# Clear existing partition file
rm -rf partition_table
touch partition_table

while [ "$partitions" -le "$num_partitions" ]
do
	# Find partition numbers
	edit_partitions=3D$(fdisk -l | grep ^/dev/$selected_drive | cut -c9)
=09
	# Parse out extra partitons
	if [ "$partitions" =3D=3D "1" ]
	then
		work_partition=3D$(echo -e $edit_partitions | cut -c$partitions)
		# Write to partition_table file
		echo -e "d\n$work_partition" >> partition_table
	else
		if [ "$partitions_cut" =3D=3D "" ]
		then
			# If First Partition after partition 1, cut off $partitions + 1
			partitions_cut=3D$(($partitions+1))
		else
			partitions_cut=3D$(($partitions_cut+1))
		fi
		work_partition=3D$(echo -e $edit_partitions | cut -c$partitions_cut)
		# Write to partition_table file
		echo -e "d\n$work_partition" >> partition_table
		((partitions_cut +=3D 1))
	fi
	((partitions +=3D 1))
=09
done

# build the rest of the table
# Get Total System Memory
total_mem=3D$(cat /proc/meminfo | grep -i memtotal | cut -c16- | sed s/\ //=
 | sed s/kB//)
swap_space=3D$(expr $(expr $total_mem + $total_mem) / 1024)

# Write first partition to file
echo -e "n\np\n1\n\n+100M\n" >> partition_table

# Write Swap Space (double system memory)
echo -e "n\np\n2\n\n+"$swap_space"M\n">> partitio=
n_table

# Write / partition to file
echo -e "n\np\n3\n\n\n" >> partition_table

# Write partition setting to file and drive write
echo -e "a\n1\nt\n2\n82\nw\n" >> partition_table

# Set drive number variables
boot_drive=3D$(echo $selected_drive"1")
swap_drive=3D$(echo $selected_drive"2")
root_drive=3D$(echo $selected_drive"3")

# KEEP THIS COMMENTED OUT BELLOW HERE
fdisk /dev/$selected_drive < partition_table
Mainly due to the fact that you statically set the UUIDs of the drive= that you want to use.

Cheers,
Kad
=

On Sun, Jul 1, 2012 at 5:28 PM, Michael= Mol <mikemol@gmail.com> wrote:
On W= ed, Jun 27, 2012 at 10:13 PM, Michael Mol <mikemol@gmail.com> wrote:
> Very rough, and very much a works-for-me thing, but I thought I'd = share.
>
> https://github.com/mikemol/gentoo-install
>
> I wrote it to ease the pain of the "install-configure-build"= cycle I
> was going through to figure out what was breaking glibc.

Just a bit of a followup. I've got most of the bugs worked = out, and
I'm very pleased with it. I've used it to get through most of the install sequence for inara, and it's currently on package 113/158 of its second pass of 'emerge -e @world'.

If anyone else gets around to trying it, let me know. :)

--
:wq


--bcaec51ddaa7b1b43b04c3fa30c1--