Commit a7bcd0ba by Heechul Kim

updated

parent 7b698eb4
......@@ -37,9 +37,17 @@ fi
mount -o bind /dev $target/dev
cat > $target/etc/default/grub <<-EOF
GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto net.ifnames=0 console=tty0 console=ttyS0,115200"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no"
GRUB_DISABLE_RECOVERY="true"
EOF
if [ -f $target/usr/sbin/grub2-install ]; then
# CentOS 7
$ROOTCMD grub2-install --no-floppy "$BOOT_DEVICE"
$ROOTCMD grub2-mkconfig --output=/boot/grub2/grub.cfg
......
......@@ -9,25 +9,37 @@ error=0 ; trap "error=$((error|1))" ERR
if [ $FAI_ACTION != "softupdate" ]
then
ainsl -v /etc/sysconfig/network "^GATEWAY=$GATEWAYS_1\$"
[ -n "$IPADDR" ] && cat > $target/etc/sysconfig/network-scripts/ifcfg-eth0 <<-EOF
[ -n "$IPADDR" ] && cat > $target/etc/sysconfig/network-scripts/ifcfg-$NIC1 <<-EOF
# generated by FAI
DEVICE=eth0
DEVICE=$NIC1
BOOTPROTO=static
ONBOOT=yes
HWADDR=`ip l sh dev eth0 | tail -1 | cut -d" " -f6`
HWADDR=`ip l sh dev $NIC1 | tail -1 | cut -d" " -f6`
IPADDR=$IPADDR
NETMASK=$NETMASK
GATEWAY=$GATEWAYS
EOF
# Kudzu for some reason won't write eth0 into /etc/sysconfig/hwconf
# from within the chroot. The following hack puts it in there
# so that Kudzu doesn't overwrite our config on first boot.
if [ -f $target/sbin/kudzu ]; then
grep eth0 $target/etc/sysconfig/hwconf || $ROOTCMD kudzu -c NETWORK -p \
grep eth1 $target/etc/sysconfig/hwconf || $ROOTCMD kudzu -c NETWORK -p \
>> $target/etc/sysconfig/hwconf
fi
fi
# Add service network interface
if [ -f $FAI/svc-interface ]
then
echo "Add service interface"
# Get NIC name
SVC_NIC=$(grep '^DEVICE=' $FAI/svc-interface|cut -d'=' -f2)
cp $FAI/svc-interface $target/etc/sysconfig/network-scripts/ifcfg-$SVC_NIC
else
echo "No svc-interface. So set gateway on NIC1."
echo "GATEWAY=$GATEWAYS" >> $target/etc/sysconfig/network-scripts/ifcfg-$NIC1
fi
# Set hostname
[ -n "$HOSTNAME" ] && echo $HOSTNAME > $target/etc/hostname
......
......@@ -2,16 +2,17 @@
error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
if ifclass DHCPC && [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ]
then
cat > $target/etc/network/interfaces <<-EOF
# generated by FAI
auto lo $NIC1
iface lo inet loopback
iface $NIC1 inet dhcp
EOF
elif [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ]
then
#if ifclass DHCPC && [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ]
#then
# cat > $target/etc/network/interfaces <<-EOF
# # generated by FAI
# auto lo $NIC1
# iface lo inet loopback
# iface $NIC1 inet dhcp
#EOF
#elif [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ]
#then
# PXE network config.
[ -n "$IPADDR" ] && cat > $target/etc/network/interfaces <<-EOF
# generated by FAI
auto lo $NIC1
......@@ -20,12 +21,21 @@ then
address $IPADDR
netmask $NETMASK
broadcast $BROADCAST
gateway $GATEWAYS
EOF
[ -n "$NETWORK" ] && echo "localnet $NETWORK" > $target/etc/networks
if [ ! -L $target/etc/resolv.conf -a -e /etc/resolv.conf ]; then
cp -p /etc/resolv.conf $target/etc
fi
#fi
# Add service network interface (fixed to 'eth1' for now)
if [ -f $FAI/svc-interface ]
then
echo "Add service interface"
cat $FAI/svc-interface >> $target/etc/network/interfaces
else
echo "No svc-interface. So set gateway on NIC1."
echo " gateway $GATEWAY" >> $target/etc/network/interfaces
fi
# here fcopy is mostly used, when installing a client for running in a
......
......@@ -11,7 +11,7 @@ error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
if [ -f $FAI/pubkeys/authorized_keys ]
then
# lock the root password
$ROOTCMD usermod -L root
#$ROOTCMD usermod -L root
mkdir -p $target/root/.ssh && chmod 700 $target/root/.ssh
cat $FAI/pubkeys/authorized_keys > $target/root/.ssh/authorized_keys
chmod 600 $target/root/.ssh/authorized_keys
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment