Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifications to CentOS build #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build-centos
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ set -o xtrace

sudo virt-sysprep --no-selinux-relabel -a /var/lib/libvirt/images/$BUILD_NAME.img

sudo virt-sparsify --convert qcow2 --compress /var/lib/libvirt/images/$BUILD_NAME.img $BUILD_NAME.qcow2
sudo virt-sparsify --convert qcow2 /var/lib/libvirt/images/$BUILD_NAME.img $BUILD_NAME.qcow2

28 changes: 13 additions & 15 deletions centos-6-x86_64.ks
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This is a basic CentOS 6 spin designed to work in OpenStack and other
# virtualized environments. It's configured with cloud-init so it will
# take advantage of ec2-compatible metadata services for provisioning
# ssh keys and user data.
# ssh keys and user data.

# Basic kickstart bits
text
Expand Down Expand Up @@ -58,9 +58,9 @@ wget

epel-release
cloud-init
cloud-utils

# Some things from @core we can do without in a minimal install
-biosdevname
-NetworkManager
-sendmail

Expand Down Expand Up @@ -96,30 +96,28 @@ cat << EOF > 05-grow-root.sh
/bin/echo
/bin/echo Resizing root filesystem

/bin/echo "d
n
p
1


w
" | /sbin/fdisk -c -u /dev/vda
/sbin/e2fsck -f /dev/vda1
/sbin/resize2fs /dev/vda1
growpart --fudge 20480 -v /dev/vda 1
e2fsck -f /dev/vda1
resize2fs /dev/vda1
EOF

chmod +x 05-grow-root.sh

dracut --force --include 05-grow-root.sh /mount --install 'echo fdisk e2fsck resize2fs' /boot/"initramfs-grow_root-$(ls /boot/|grep initramfs|sed s/initramfs-//g)" $(ls /boot/|grep vmlinuz|sed s/vmlinuz-//g)
dracut --force --include 05-grow-root.sh /mount --install 'echo awk grep fdisk sfdisk growpart partx e2fsck resize2fs' "$(ls /boot/initramfs-*)" $(ls /boot/|grep vmlinuz|sed s/vmlinuz-//g)
rm -f 05-grow-root.sh

tail -4 /boot/grub/grub.conf | sed s/initramfs/initramfs-grow_root/g| sed s/CentOS/ResizePartition/g | sed s/crashkernel=auto/crashkernel=0@0/g >> /boot/grub/grub.conf
#tail -4 /boot/grub/grub.conf | sed s/initramfs/initramfs-grow_root/g| sed s/CentOS/ResizePartition/g | sed s/crashkernel=auto/crashkernel=0@0/g >> /boot/grub/grub.conf

# let's run the kernel & initramfs that expands the partition only once
echo "savedefault --default=1 --once" | grub --batch
#echo "savedefault --default=1 --once" | grub --batch


# Leave behind a build stamp
echo "build=$(date +%F.%T)" >/etc/.build

# Remove udev net entries
sed -i '/ENV{MATCHADDR}="$attr{address}"$/a\ENV{MATCHADDR}=="fa:16:3e:*", GOTO="persistent_net_generator_end"' /lib/udev/rules.d/75-persistent-net-generator.rules
sed -i '/HWADDR/d' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i '/UUID/d' /etc/sysconfig/network-scripts/ifcfg-eth0

%end