mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-22 01:22:00 +00:00
Refactor genesis to have addons.cpio
This makes an easier division between pure CentOS contributions and 'genesis-scripts' type output. Do so in a manner consistent with how 'real' operating systems get this added.
This commit is contained in:
parent
31dcea46af
commit
644433fa5d
@ -25,7 +25,7 @@ cd utils
|
||||
make all
|
||||
cp copernicus clortho autocons ../opt/confluent/bin
|
||||
cd ..
|
||||
for os in rhvh4 el7 el8 suse15 ubuntu20.04; do
|
||||
for os in rhvh4 el7 genesis el8 suse15 ubuntu20.04; do
|
||||
mkdir ${os}out
|
||||
cd ${os}out
|
||||
cp -a ../opt .
|
||||
@ -48,7 +48,7 @@ cp -a esxi7out esxi6out
|
||||
cp -a esxi7 esxi6
|
||||
|
||||
%install
|
||||
for os in rhvh4 el7 el8 suse15 ubuntu20.04 esxi6 esxi7; do
|
||||
for os in rhvh4 el7 el8 genesis suse15 ubuntu20.04 esxi6 esxi7; do
|
||||
mkdir -p %{buildroot}/opt/confluent/lib/osdeploy/$os/initramfs
|
||||
mkdir -p %{buildroot}/opt/confluent/lib/osdeploy/$os/profiles
|
||||
cp ${os}out/addons.* %{buildroot}/opt/confluent/lib/osdeploy/$os/initramfs
|
||||
|
83
confluent_osdeploy/genesis/initramfs/bin/rungenesis
Normal file
83
confluent_osdeploy/genesis/initramfs/bin/rungenesis
Normal file
@ -0,0 +1,83 @@
|
||||
#!/bin/bash
|
||||
mkdir -p /etc/confluent
|
||||
/usr/lib/systemd/systemd-udevd --daemon
|
||||
udevadm trigger
|
||||
udevadm trigger --type=devices --action=add
|
||||
udevadm settle
|
||||
cat > /etc/ssh/sshd_config << EOF
|
||||
HostKey /etc/ssh/ssh_host_rsa_key
|
||||
HostKey /etc/ssh/ssh_host_ecdsa_key
|
||||
HostKey /etc/ssh/ssh_host_ed25519_key
|
||||
PermitRootLogin yes
|
||||
AuthorizedKeysFile .ssh/authorized_keys
|
||||
EOF
|
||||
if ! grep console= /proc/cmdline >& /dev/null; then
|
||||
autocons=$(/opt/confluent/bin/autocons)
|
||||
echo console=$autocons |sed -e 's!/dev/!!' >> /tmp/01-autocons.conf
|
||||
autocons=${autocons%,*}
|
||||
echo $autocons > /tmp/01-autocons.devnode
|
||||
if [ ! -z "$autocons" ]; then
|
||||
echo "Using console $(cat /tmp/01-autocons.conf)"
|
||||
tmux a <> $autocons >&0 2>&1 &
|
||||
fi
|
||||
else
|
||||
tmux a <> /dev/tty1 >&0 2>&1 &
|
||||
fi
|
||||
(ssh-keygen -A; /usr/sbin/sshd) &
|
||||
TRIES=0
|
||||
while ! grep ^EXTMGRINFO: /etc/confluent/confluent.info | awk -F'|' '{print $3}' | grep 1 >& /dev/null && [ "$TRIES" -lt 15 ]; do
|
||||
TRIES=$((TRIES + 1))
|
||||
cd /sys/class/net
|
||||
for i in *; do
|
||||
ip link set $i up
|
||||
done
|
||||
/opt/confluent/bin/copernicus -t > /etc/confluent/confuent.info
|
||||
done
|
||||
ip addr|grep inet |awk '{print $2}' | sed -e 's!/.*!!'
|
||||
nodename=$(grep ^NODENAME /etc/confluent/confluent.info|awk '{print $2}')
|
||||
hostname $nodename
|
||||
cat /tls/*.pem > /etc/confluent/ca.pem
|
||||
cat /tls/*.0 >> /etc/pki/tls/certs/ca-bundle.crt
|
||||
/usr/libexec/platform-python /opt/confluent/bin/apiclient /confluent-api/self/deploycfg > /etc/confluent/confluent.deploycfg
|
||||
ifidx=$(cat /tmp/confluent.ifidx)
|
||||
ifname=$(ip link |grep ^$ifidx:|awk '{print $2}')
|
||||
ifname=${ifname%:}
|
||||
if [ "$autoconfigmethod" = "dhcp" ]; then
|
||||
echo -n "Attempting to use dhcp to bring up $ifname..."
|
||||
dhclient $ifname
|
||||
echo "Complete:"
|
||||
ip addr show dev $ifname
|
||||
else
|
||||
v4addr=$(grep ^ipv4_address: /etc/confluent/confluent.deploycfg)
|
||||
v4addr=${v4addr#ipv4_address: }
|
||||
v4gw=$(grep ^ipv4_gateway: /etc/confluent/confluent.deploycfg)
|
||||
v4gw=${v4gw#ipv4_gateway: }
|
||||
if [ "$v4gw" = "null" ]; then
|
||||
v4gw=""
|
||||
fi
|
||||
v4nm=$(grep ^prefix: /etc/confluent/confluent.deploycfg)
|
||||
v4nm=${v4nm#prefix: }
|
||||
echo "Setting up $ifname as static at $v4addr/$v4nm"
|
||||
ip addr add dev $ifname/$v4nm
|
||||
if [ ! -z "$v4gw" ]; then
|
||||
ip route add default via $v4gw
|
||||
fi
|
||||
fi
|
||||
for pubkey in /etc/ssh/ssh_host*key.pub; do
|
||||
certfile=${pubkey/.pub/-cert.pub}
|
||||
/usr/libexec/platform-python /opt/confluent/bin/apiclient /confluent-api/self/sshcert $pubkey > $certfile
|
||||
echo HostCertificate $certfile >> /etc/ssh/sshd_config
|
||||
done
|
||||
killall sshd
|
||||
/usr/sbin/sshd
|
||||
while :; do
|
||||
bash
|
||||
done
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
cd -
|
||||
|
@ -0,0 +1,13 @@
|
||||
root=1
|
||||
rootok=1
|
||||
netroot=genesis
|
||||
clear
|
||||
echo PS1="'"'[genesis running on \H \w]$ '"'" >> ~/.bashrc
|
||||
echo PS1="'"'[genesis running on \H \w]$ '"'" >> ~/.bash_profile
|
||||
mkdir -p /etc/ssh
|
||||
mkdir -p /var/tmp/
|
||||
mkdir -p /var/empty/sshd
|
||||
sed -i '/^root:x/d' /etc/passwd
|
||||
echo root:x:0:0::/:/bin/bash >> /etc/passwd
|
||||
echo sshd:x:30:30:SSH User:/var/empty/sshd:/sbin/nologin >> /etc/passwd
|
||||
tmux -L console new-sessiod /bin/rungenesis
|
@ -16,7 +16,7 @@ dracut_install chmod ifconfig whoami route head tail basename /etc/redhat-releas
|
||||
dracut_install dmidecode /usr/lib64/libstdc++.so.6
|
||||
dracut_install ps free find
|
||||
inst /bin/bash /bin/sh
|
||||
inst_hook cmdline 10 $moddir/cmdline.sh
|
||||
#inst_hook cmdline 10 $moddir/cmdline.sh # moved to addons.cpio
|
||||
dracut_install killall chown chroot dd expr kill parted rsync shutdown sort blockdev findfs insmod lvm pivot_root
|
||||
dracut_install /etc/udev/hwdb.bin
|
||||
dracut_install /usr/share/hwdata/pci.ids
|
||||
|
@ -8,5 +8,11 @@ dracut --xz -N -m "genesis base" -f boot/initramfs/distribution $(uname -r)
|
||||
cp -f /boot/vmlinuz-$(uname -r) boot/kernel
|
||||
cp /boot/efi/EFI/BOOT/BOOTX64.EFI boot/efi/boot
|
||||
cp /boot/efi/EFI/centos/grubx64.efi boot/efi/boot/grubx64.efi
|
||||
tar cf ~/rpmbuild/SOURCES/confluent-genesis.tar boot
|
||||
rpmbuild -bb confluent-genesis.spec
|
||||
rm -rf /usr/lib/dracut/modules.d/97genesis
|
||||
cd -
|
||||
# getting src rpms would be nice, but centos isn't consistent..
|
||||
# skipcpio | xzcat | cpio -dumiv
|
||||
# dnf download --source $(rpm -qf $(find . -type f | sed -e 's/^.//') |sort -u|grep -v 'not owned')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user