Prompt for hostname, better logging
This commit is contained in:
		@@ -129,6 +129,7 @@ build-gentoo() {
 | 
				
			|||||||
	pushd "$_optdest" > /dev/null 2>&1
 | 
						pushd "$_optdest" > /dev/null 2>&1
 | 
				
			||||||
	# These is a very generic make.conf to get the system up and running
 | 
						# These is a very generic make.conf to get the system up and running
 | 
				
			||||||
	# We use march of x86-64 to ensure compatibility if we're bootstrapping on a host other than the target
 | 
						# We use march of x86-64 to ensure compatibility if we're bootstrapping on a host other than the target
 | 
				
			||||||
 | 
						log "Building make.conf"
 | 
				
			||||||
	cat <<-EOF > "$_optdest/etc/portage/make.conf"
 | 
						cat <<-EOF > "$_optdest/etc/portage/make.conf"
 | 
				
			||||||
	# ABI_X86 is used to control multilib support
 | 
						# ABI_X86 is used to control multilib support
 | 
				
			||||||
	ABI_X86="64 32"
 | 
						ABI_X86="64 32"
 | 
				
			||||||
@@ -143,6 +144,7 @@ build-gentoo() {
 | 
				
			|||||||
	USE="networkmanager systemd -elogind -test"
 | 
						USE="networkmanager systemd -elogind -test"
 | 
				
			||||||
	EOF
 | 
						EOF
 | 
				
			||||||
	# This is required on >=17.1 to unroll some circular dependencies
 | 
						# This is required on >=17.1 to unroll some circular dependencies
 | 
				
			||||||
 | 
						log "Setting package.use settings for gentoostrap"
 | 
				
			||||||
	cat <<-EOF > "$_optdest/etc/portage/package.use/gentoostrap"
 | 
						cat <<-EOF > "$_optdest/etc/portage/package.use/gentoostrap"
 | 
				
			||||||
	# These solve circular dependency issues
 | 
						# These solve circular dependency issues
 | 
				
			||||||
	dev-lang/python -bluetooth -sqlite
 | 
						dev-lang/python -bluetooth -sqlite
 | 
				
			||||||
@@ -150,26 +152,36 @@ build-gentoo() {
 | 
				
			|||||||
	sys-libs/ncurses -gpm
 | 
						sys-libs/ncurses -gpm
 | 
				
			||||||
	EOF
 | 
						EOF
 | 
				
			||||||
	# Configure default ebuild repositories
 | 
						# Configure default ebuild repositories
 | 
				
			||||||
 | 
						log "Syncing ebuild repos"
 | 
				
			||||||
	mkdir -p "$_optdest/etc/portage/repos.conf"
 | 
						mkdir -p "$_optdest/etc/portage/repos.conf"
 | 
				
			||||||
	cp "$_optdest/usr/share/portage/config/repos.conf" \
 | 
						cp "$_optdest/usr/share/portage/config/repos.conf" \
 | 
				
			||||||
		"$_optdest/etc/portage/repos.conf/gentoo.conf"
 | 
							"$_optdest/etc/portage/repos.conf/gentoo.conf"
 | 
				
			||||||
	# DNS
 | 
						# DNS
 | 
				
			||||||
 | 
						log "Configuring DNS"
 | 
				
			||||||
	cat <<-EOF > "$_optdest/etc/resolv.conf"
 | 
						cat <<-EOF > "$_optdest/etc/resolv.conf"
 | 
				
			||||||
	nameserver 8.8.8.8
 | 
						nameserver 8.8.8.8
 | 
				
			||||||
	nameserver 8.8.4.4
 | 
						nameserver 8.8.4.4
 | 
				
			||||||
	EOF
 | 
						EOF
 | 
				
			||||||
	# Hostname
 | 
						# Hostname
 | 
				
			||||||
	echo "$(hostname -s)" > "$_optdest/etc/conf.d/hostname"
 | 
						read -p "Enter system hostname: " hostname
 | 
				
			||||||
 | 
						echo "$hostname" > "$_optdest/etc/conf.d/hostname"
 | 
				
			||||||
	# hosts
 | 
						# hosts
 | 
				
			||||||
	echo "127.0.0.1 $(hostname -s)" > "$_optdest/etc/hosts"
 | 
						log "Configuring hosts"
 | 
				
			||||||
 | 
						cat <<-EOF > "$_optdest/etc/hosts"
 | 
				
			||||||
 | 
						127.0.0.1 $hostname
 | 
				
			||||||
 | 
						::1 $hostname
 | 
				
			||||||
 | 
						EOF
 | 
				
			||||||
	# Timezone
 | 
						# Timezone
 | 
				
			||||||
 | 
						log "Configuring timezone"
 | 
				
			||||||
	cp /etc/timezone "$_optdest/etc/timezone"
 | 
						cp /etc/timezone "$_optdest/etc/timezone"
 | 
				
			||||||
	# Locale
 | 
						# Locale
 | 
				
			||||||
 | 
						log "Configuring locale"
 | 
				
			||||||
	cat <<-EOF > "$_optdest/etc/locale.gen"
 | 
						cat <<-EOF > "$_optdest/etc/locale.gen"
 | 
				
			||||||
	en_US ISO-8859-1
 | 
						en_US ISO-8859-1
 | 
				
			||||||
	en_US.UTF-8 UTF-8
 | 
						en_US.UTF-8 UTF-8
 | 
				
			||||||
	EOF
 | 
						EOF
 | 
				
			||||||
	# fstab
 | 
						# fstab
 | 
				
			||||||
 | 
						log "Dropping to editor to configure fstab"
 | 
				
			||||||
	cat <<-EOF > "$_optdest/etc/fstab"
 | 
						cat <<-EOF > "$_optdest/etc/fstab"
 | 
				
			||||||
	# fstab - Filesystem table
 | 
						# fstab - Filesystem table
 | 
				
			||||||
	# See fstab(5) for syntax and configuration information
 | 
						# See fstab(5) for syntax and configuration information
 | 
				
			||||||
@@ -181,6 +193,7 @@ build-gentoo() {
 | 
				
			|||||||
	# Now we need to pivot into a chroot and finish configuration natively
 | 
						# Now we need to pivot into a chroot and finish configuration natively
 | 
				
			||||||
	# Buuuut... since we're using systemd, we get to just spawn a systemd-nspawn container
 | 
						# Buuuut... since we're using systemd, we get to just spawn a systemd-nspawn container
 | 
				
			||||||
	popd
 | 
						popd
 | 
				
			||||||
 | 
						log "Pivoting to container for more setup"
 | 
				
			||||||
	cp "$0" "$_optdest/gentoostrap.sh"
 | 
						cp "$0" "$_optdest/gentoostrap.sh"
 | 
				
			||||||
	sudo systemd-nspawn --directory="$_optdest" /gentoostrap.sh -c
 | 
						sudo systemd-nspawn --directory="$_optdest" /gentoostrap.sh -c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -256,9 +269,6 @@ build-gentoo-chroot() {
 | 
				
			|||||||
	* Install and configure grub
 | 
						* Install and configure grub
 | 
				
			||||||
	* Reboot and pray
 | 
						* Reboot and pray
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Other things you may want to do:
 | 
					 | 
				
			||||||
	* Change the system hostname
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	Dumping to a shell now. Have fun!
 | 
						Dumping to a shell now. Have fun!
 | 
				
			||||||
	EOF
 | 
						EOF
 | 
				
			||||||
	exec bash
 | 
						exec bash
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user