g2testvm: Add support for systemd-based machines
parent
03c46fee37
commit
ef6d435d8d
20
g2testvm.sh
20
g2testvm.sh
|
@ -30,7 +30,20 @@ set -e
|
||||||
vmsetup=$(mktemp)
|
vmsetup=$(mktemp)
|
||||||
trap 'rm -f ${vmsetup}' EXIT
|
trap 'rm -f ${vmsetup}' EXIT
|
||||||
cat > ${vmsetup} <<EOF
|
cat > ${vmsetup} <<EOF
|
||||||
#!/bin/sh
|
#!/bin/sh -ex
|
||||||
|
if [ -x /usr/lib/systemd/systemd ]; then
|
||||||
|
cat > /etc/systemd/network/90-dhcp.network <<-'EOF'
|
||||||
|
[Match]
|
||||||
|
Name=en*
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
DHCP=yes
|
||||||
|
EOF
|
||||||
|
systemctl enable systemd-networkd systemd-resolved sshd
|
||||||
|
timedatectl set-timezone America/Chicago
|
||||||
|
hostnamectl set-hostname ${hostname}
|
||||||
|
ln -snf /run/systemd/resolve/resolv.conf /etc/resolv.conf
|
||||||
|
else
|
||||||
ln -s net.lo /etc/init.d/net.eth0
|
ln -s net.lo /etc/init.d/net.eth0
|
||||||
ln -s /etc/init.d/net.eth0 /etc/runlevels/default/
|
ln -s /etc/init.d/net.eth0 /etc/runlevels/default/
|
||||||
ln -s /etc/init.d/sshd /etc/runlevels/default/
|
ln -s /etc/init.d/sshd /etc/runlevels/default/
|
||||||
|
@ -38,10 +51,11 @@ echo 'config_eth0="dhcp"' > /etc/conf.d/net
|
||||||
ln -snf /usr/share/zoneinfo/America/Chicago /etc/localtime
|
ln -snf /usr/share/zoneinfo/America/Chicago /etc/localtime
|
||||||
echo 'America/Chicago' > /etc/timezone
|
echo 'America/Chicago' > /etc/timezone
|
||||||
sed -i s/localhost/${hostname}/ /etc/conf.d/hostname
|
sed -i s/localhost/${hostname}/ /etc/conf.d/hostname
|
||||||
ssh-keygen -A
|
|
||||||
ln -snf /proc/self/mounts /etc/mtab
|
|
||||||
ln -snf /run/resolv.conf /etc/resolv.conf
|
ln -snf /run/resolv.conf /etc/resolv.conf
|
||||||
ln -snf /run/ntp.conf /etc/ntp.conf
|
ln -snf /run/ntp.conf /etc/ntp.conf
|
||||||
|
fi
|
||||||
|
ssh-keygen -A
|
||||||
|
ln -snf /proc/self/mounts /etc/mtab
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
pooldir=$(virsh pool-dumpxml ${POOL} | xml sel -t -v '//pool/target/path')
|
pooldir=$(virsh pool-dumpxml ${POOL} | xml sel -t -v '//pool/target/path')
|
||||||
|
|
Loading…
Reference in New Issue