11#! /usr/bin/env bash
22
3+ # # DEFAULTS ##
4+ # default user config. This is can be overridden in /etc/cloud/init.arch.conf
5+
6+ # Name of kernel package
7+ KERNEL=" linux-image"
8+
9+ # Name of bootloader. As of now, only extlinux is supported
10+ # BOOTLOADER="grub"??
11+ BOOTLOADER=" extlinux"
12+
13+ # # /DEFAULTS ##
14+
15+ # # BASE INSTALL ##
16+ # Hardcoded always install packages
17+ local_config=" /init.conf"
18+ # packages that need to be installed
19+ system_packages=" "
20+ # systemd services that need to be enabled
21+ system_services=" sshd cloud-init-local cloud-init cloud-config cloud-final"
22+ # kernel modules that get added with dracut
23+ dracut_modules=" ixgbevf virtio"
24+ # grub2-modules
25+ grub2_modules=" biosdisk part_msdos ext2 xfs configfile normal multiboot"
26+ # block device parition with root fs, minus the /dev/ part
27+ root_part=" vda1"
28+ # # /BASE INSTALL ##
29+
330help_and_exit () {
431 cat 1>&2 << EOF
532init.sh - Redhat-Based
2754 exit 4
2855}
2956
57+
3058message (){
3159 echo " init.sh: ${@ } "
3260}
@@ -44,4 +72,35 @@ warn(){
4472 echo 1>&2 " init.sh: WARN: ${@ } "
4573}
4674
75+ gen_fstab (){
76+ submsg " Generating /etc/fstab"
77+
78+ local
79+ cat > /etc/fstab >> EOF
80+ /dev/${root_part} / xfs defaults,noatime 1 1
81+ none /dev/pts devpts gid=5,mode=620 0 0
82+ none /proc proc defaults 0 0
83+ none /sys sysfs defaults 0 0
84+ EOF
85+ }
86+
87+ install_grub (){
88+ local root_dev=$( df / | tail -1 | cut -d " " -f 1)
89+ cat > /etc/default/grub << EOF
90+ GRUB_TIMEOUT=1
91+ GRUB_DISTRIBUTOR="$( sed ' s, release .*$,,g' /etc/system-release) "
92+ GRUB_DEFAULT=saved
93+ GRUB_DISABLE_SUBMENU=true
94+ GRUB_TERMINAL="serial console"
95+ GRUB_SERIAL_COMMAND="serial --speed=115200"
96+ GRUB_CMDLINE_LINUX="console=ttyS0,115200 console=tty0 vconsole.font=latarcyrheb-sun16 crashkernel=auto vconsole.keymap=us plymouth.enable=0 net.ifnames=0 biosdevname=0"
97+ GRUB_DISABLE_RECOVERY="true"
98+ EOF
99+ mkdir /boot/grub2
100+ echo " (hd0) ${root_dev} " > /boot/grub2/device.map
101+ dracut --force --add-drivers " ${dracut_modules} " --kver $AMI_KERNEL_VER
102+ grub2-install --no-floppy --modules=" ${grub2_modules} " ${root_dev}
103+ grub2-mkconfig -o /boot/grub2/grub.cfg
104+ }
105+
47106exit_with_error 10 " Redhat support is incomplete, will not run at this time"
0 commit comments