From bd259fb46d536be10a3d15210676f7b122427fa7 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 8 Jan 2020 13:11:23 +0100 Subject: [PATCH] Rework demo scripts Merge prep.sh and cleanup.sh into demo.sh that does everything. Add "bots" and "download" make targets, and let demo.sh run the VMs --- .gitignore | 2 + Makefile | 9 ++++- cleanup.sh | 4 -- cockpit-auth-anywhere.md | 2 - demo.sh | 87 ++++++++++++++++++++++++++++++++++++++++ prep.sh | 32 --------------- 6 files changed, 97 insertions(+), 39 deletions(-) delete mode 100755 cleanup.sh create mode 100755 demo.sh delete mode 100755 prep.sh diff --git a/.gitignore b/.gitignore index 5a7ecf6..1e91a7f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ cockpit-auth-anywhere.pdf +bots +tmp diff --git a/Makefile b/Makefile index 9e28467..9b0ef6d 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,13 @@ clean: # install the necessary tools to build this presentation deps: - sudo dnf install -y pandoc texlive-beamer texlive-latex-bin texlive-collection-fontsrecommended texlive-hyphen-german texlive-hyphen-english texlive-dehyph texlive-fancyhdr texlive-dinbrief texlive-german texlive-a4wide + which pandoc || sudo dnf install -y pandoc texlive-beamer texlive-latex-bin texlive-collection-fontsrecommended texlive-hyphen-german texlive-hyphen-english texlive-dehyph texlive-fancyhdr texlive-dinbrief texlive-german texlive-a4wide + +bots: + git clone --depth=1 https://github.com/cockpit-project/bots + +# download test VMs +download: bots + bots/image-download rhel-7-8 windows-10 .PHONY: deps clean diff --git a/cleanup.sh b/cleanup.sh deleted file mode 100755 index e329830..0000000 --- a/cleanup.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -x -sudo vgremove -f vg0 -sudo rmmod scsi_debug -sudo rm -f /etc/cockpit.cockpit.conf /etc/cockpit/machines.d/* /etc/ssh/ssh_known_hosts diff --git a/cockpit-auth-anywhere.md b/cockpit-auth-anywhere.md index e633e2b..05298e2 100644 --- a/cockpit-auth-anywhere.md +++ b/cockpit-auth-anywhere.md @@ -48,7 +48,6 @@ resize2fs /dev/vg0/data1 - Zero configuration :::notes -- TODO: check out bots in "make deps", add ./vm-run windows-10 to prep.sh - Switch to Windows virt-viewer, open Edge, show Cockpit - Quit virt-viewer - Zero configuration so far, other than possibly installing cockpit pkg and enabling cockpit.socket @@ -107,7 +106,6 @@ resize2fs /dev/vg0/data1 nothing Cockpit specific running outside of the user session :::notes -- TODO: start rhel7 VM in prep.sh, set hostname - ws and the login session don't need to run on the same machine - cockpit-session is meant to be customizable for your purposes - most obvious replacement is to let ssh start a session; that already does the diff --git a/demo.sh b/demo.sh new file mode 100755 index 0000000..b63f4d9 --- /dev/null +++ b/demo.sh @@ -0,0 +1,87 @@ +#!/bin/sh +# Run this script before starting the presention/demo. +# Before you must run "make download". +set -ex + +# specific for Martin Pitt +VM_PREFIX="toolbox run -c devel" + +printf '[Session]\nIdleTimeout=0\n' | sudo tee /etc/cockpit.cockpit.conf +sudo systemctl stop cockpit + +echo '127.0.0.2 cockpit.dev' | sudo tee -a /etc/hosts + +# LV resizing demo +sudo modprobe scsi_debug dev_size_mb=512 +# sanity check +m=$(cat /sys/block/sdb/device/model) +[ "${m%% *}" = scsi_debug ] + +cat < /tmp/r7vm & +echo $! > /tmp/r7vm.pid + +read ssh_cmd < /tmp/r7vm +echo "ssh command: $ssh_cmd" +read _ < /tmp/r7vm # URL, uninteresting +read running < /tmp/r7vm +[ "${running#RUNNING}" != "$running" ] # sanity check +rm /tmp/r7vm + +$ssh_cmd hostnamectl set-hostname server1 +sleep infinity +' & +R7VM_PID=$! + +sleep 20 # let the above VM initialize + +# Windows demo +xhost +local: # allow X in toolbox +cat <