g2testvm: Add support for systemd-based machines
parent
03c46fee37
commit
ef6d435d8d
34
g2testvm.sh
34
g2testvm.sh
|
@ -30,18 +30,32 @@ set -e
|
|||
vmsetup=$(mktemp)
|
||||
trap 'rm -f ${vmsetup}' EXIT
|
||||
cat > ${vmsetup} <<EOF
|
||||
#!/bin/sh
|
||||
ln -s net.lo /etc/init.d/net.eth0
|
||||
ln -s /etc/init.d/net.eth0 /etc/runlevels/default/
|
||||
ln -s /etc/init.d/sshd /etc/runlevels/default/
|
||||
echo 'config_eth0="dhcp"' > /etc/conf.d/net
|
||||
ln -snf /usr/share/zoneinfo/America/Chicago /etc/localtime
|
||||
echo 'America/Chicago' > /etc/timezone
|
||||
sed -i s/localhost/${hostname}/ /etc/conf.d/hostname
|
||||
#!/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 /etc/init.d/net.eth0 /etc/runlevels/default/
|
||||
ln -s /etc/init.d/sshd /etc/runlevels/default/
|
||||
echo 'config_eth0="dhcp"' > /etc/conf.d/net
|
||||
ln -snf /usr/share/zoneinfo/America/Chicago /etc/localtime
|
||||
echo 'America/Chicago' > /etc/timezone
|
||||
sed -i s/localhost/${hostname}/ /etc/conf.d/hostname
|
||||
ln -snf /run/resolv.conf /etc/resolv.conf
|
||||
ln -snf /run/ntp.conf /etc/ntp.conf
|
||||
fi
|
||||
ssh-keygen -A
|
||||
ln -snf /proc/self/mounts /etc/mtab
|
||||
ln -snf /run/resolv.conf /etc/resolv.conf
|
||||
ln -snf /run/ntp.conf /etc/ntp.conf
|
||||
EOF
|
||||
|
||||
pooldir=$(virsh pool-dumpxml ${POOL} | xml sel -t -v '//pool/target/path')
|
||||
|
|
Loading…
Reference in New Issue