Only modify hostname and fstab if we need to still
This commit is contained in:
parent
479cc5a705
commit
9f91f0afdc
@ -168,8 +168,13 @@ configure-gentoo() {
|
|||||||
nameserver 8.8.4.4
|
nameserver 8.8.4.4
|
||||||
EOF
|
EOF
|
||||||
# Hostname
|
# Hostname
|
||||||
|
if [ -f "$_optdest/etc/conf.d/hostname" ]; then
|
||||||
|
hostname="$(<"$_optdest/etc/conf.d/hostname")"
|
||||||
|
log "Detected hostname $hostname"
|
||||||
|
else
|
||||||
read -p "Enter system hostname: " hostname
|
read -p "Enter system hostname: " hostname
|
||||||
echo "$hostname" > "$_optdest/etc/conf.d/hostname"
|
echo "$hostname" > "$_optdest/etc/conf.d/hostname"
|
||||||
|
fi
|
||||||
# hosts
|
# hosts
|
||||||
log "Configuring hosts"
|
log "Configuring hosts"
|
||||||
cat <<-EOF > "$_optdest/etc/hosts"
|
cat <<-EOF > "$_optdest/etc/hosts"
|
||||||
@ -186,6 +191,9 @@ configure-gentoo() {
|
|||||||
en_US.UTF-8 UTF-8
|
en_US.UTF-8 UTF-8
|
||||||
EOF
|
EOF
|
||||||
# fstab
|
# fstab
|
||||||
|
if grep "$_optdest/etc/fstab" -ie '^[[:blank:]]*[^[:blank:]#]' > /dev/null 2>&1; then
|
||||||
|
log "Configured fstab detected"
|
||||||
|
else
|
||||||
log "Dropping to editor to configure fstab"
|
log "Dropping to editor to configure fstab"
|
||||||
cat <<-EOF > "$_optdest/etc/fstab"
|
cat <<-EOF > "$_optdest/etc/fstab"
|
||||||
# fstab - Filesystem table
|
# fstab - Filesystem table
|
||||||
@ -194,6 +202,7 @@ configure-gentoo() {
|
|||||||
#LABEL=gentoo / ext4 defaults,noatime,errors=remount-ro 0 1
|
#LABEL=gentoo / ext4 defaults,noatime,errors=remount-ro 0 1
|
||||||
EOF
|
EOF
|
||||||
"${EDITOR:-vim}" "$_optdest/etc/fstab"
|
"${EDITOR:-vim}" "$_optdest/etc/fstab"
|
||||||
|
fi
|
||||||
|
|
||||||
# Now we need to pivot into a chroot and finish configuration natively
|
# Now we need to pivot into a chroot and finish configuration natively
|
||||||
popd > /dev/null 2>&1
|
popd > /dev/null 2>&1
|
||||||
|
Loading…
Reference in New Issue
Block a user