From b6d5c9e646d0aa18699a88d02ed9205380553b65 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Sat, 25 Apr 2009 18:28:24 +0100 Subject: [PATCH] Better generation of recipes page. --- Makefile.am | 30 +++---------------- make-recipes.sh | 73 ++++++++++++++++++++++++++++++++++++++++++++++ recipes/clone.html | 2 -- recipes/clone.title | 1 + recipes/editgrub.html | 2 -- recipes/editgrub.title | 1 + recipes/export2tar.html | 2 -- recipes/export2tar.title | 1 + recipes/show-devices.html | 2 -- recipes/show-devices.title | 1 + recipes/tar2vm.html | 2 -- recipes/tar2vm.title | 1 + 12 files changed, 82 insertions(+), 36 deletions(-) create mode 100755 make-recipes.sh create mode 100644 recipes/clone.title create mode 100644 recipes/editgrub.title create mode 100644 recipes/export2tar.title create mode 100644 recipes/show-devices.title create mode 100644 recipes/tar2vm.title diff --git a/Makefile.am b/Makefile.am index 40e7980..fb1d42b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -50,7 +50,8 @@ EXTRA_DIST = \ recipes/*.html \ recipes/*.sh \ recipes/*.example \ - html/recipes.css + html/recipes.css \ + make-recipes.sh # Build the root filesystem. # Currently this is arch-dependent, so it seems like putting it in @@ -142,32 +143,9 @@ html/guestfish.1.html: guestfish.pod guestfish-actions.pod --outfile $@ # Recipes web page. -html/recipes.html: $(wildcard recipes/*.sh) $(wildcard recipes/*.html) $(wildcard recipes/*.example) Makefile +html/recipes.html: $(wildcard recipes/*.sh) $(wildcard recipes/*.html) $(wildcard recipes/*.example) Makefile make-recipes.sh rm -f $@ $@-t - echo 'guestfish recipes' >> $@-t; \ - echo '' >> $@-t; \ - echo '' >> $@-t; \ - echo '

guestfish recipes

' >> $@-t; \ - echo '

You can also find these in the recipes/ subdirectory of the source.

' >> $@-t; \ - for f in recipes/*.sh; do \ - b=`basename $$f .sh`; \ - echo -n '' >> $@-t; \ - if [ -r recipes/$$b.html ]; then \ - cat recipes/$$b.html >> $@-t; \ - else \ - echo '

$$b

' >> $@-t; \ - fi; \ - echo '
' >> $@-t; \
-	  sed -e 's,&,\&,g' -e 's,<,\<,g' -e 's,>,\>,g' < $$f >> $@-t; \
-	  echo '
' >> $@-t; \ - if [ -r recipes/$$b.example ]; then \ - echo '

Example output

' >> $@-t; \ - echo '
' >> $@-t; \
-	    sed -e 's,&,\&,g' -e 's,<,\<,g' -e 's,>,\>,g' < recipes/$$b.example >> $@-t; \
-	    echo '
' >> $@-t; \ - fi; \ - done; \ - echo '' >> $@-t; \ + sh make-recipes.sh recipes/*.sh > $@-t mv $@-t $@ website: html/guestfs.3.html html/guestfish.1.html html/recipes.html diff --git a/make-recipes.sh b/make-recipes.sh new file mode 100755 index 0000000..2220bee --- /dev/null +++ b/make-recipes.sh @@ -0,0 +1,73 @@ +#!/bin/sh - +# libguestfs +# Copyright (C) 2009 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +cat < + + guestfish recipes + + + +

guestfish recipes

+

You can also find these in the + recipes/ + subdirectory of the source. + +

Table of recipes

+ ' +echo +echo + +for f in recipes/*.sh; do + b=`basename $f .sh` + echo -n '' + echo -n '

'$b'.sh' + if [ -r recipes/$b.title ]; then + echo -n ': ' + cat recipes/$b.title + fi + echo -n 'permalink' + echo '

' + if [ -r recipes/$b.html ]; then + cat recipes/$b.html + fi + echo '

'$b'.sh

' + echo '
'
+    sed -e 's,&,\&,g' -e 's,<,\<,g' -e 's,>,\>,g' < $f
+    echo '
' + if [ -r recipes/$b.example ]; then + echo '

Example output

' + echo '
'
+	sed -e 's,&,\&,g' -e 's,<,\<,g' -e 's,>,\>,g' < recipes/$b.example
+	echo '
' + fi +done + +echo '' diff --git a/recipes/clone.html b/recipes/clone.html index a9998e1..f87b4ad 100644 --- a/recipes/clone.html +++ b/recipes/clone.html @@ -1,5 +1,3 @@ -

Clone and edit a virtual machine

-

This script shows how you might have a library of premade virtual machines ready for cloning, but as a final step you diff --git a/recipes/clone.title b/recipes/clone.title new file mode 100644 index 0000000..68ea79c --- /dev/null +++ b/recipes/clone.title @@ -0,0 +1 @@ +Clone and edit a virtual machine \ No newline at end of file diff --git a/recipes/editgrub.html b/recipes/editgrub.html index 7d7a43b..a1b9bab 100644 --- a/recipes/editgrub.html +++ b/recipes/editgrub.html @@ -1,5 +1,3 @@ -

Fix an unbootable VM by editing /boot/grub/grub.conf

-

If you messed up your VM and made it unbootable, it's often useful to be able to go in and edit /boot/grub/grub.conf. diff --git a/recipes/editgrub.title b/recipes/editgrub.title new file mode 100644 index 0000000..2c93a0f --- /dev/null +++ b/recipes/editgrub.title @@ -0,0 +1 @@ +Fix an unbootable VM by editing /boot/grub/grub.conf \ No newline at end of file diff --git a/recipes/export2tar.html b/recipes/export2tar.html index 8dc07ca..f24be32 100644 --- a/recipes/export2tar.html +++ b/recipes/export2tar.html @@ -1,5 +1,3 @@ -

Export the /home directory from a virtual machine into a tarball

-

This script lets you export any directory you like from a virtual machine as a tarball. For example, to export /home diff --git a/recipes/export2tar.title b/recipes/export2tar.title new file mode 100644 index 0000000..98a9e91 --- /dev/null +++ b/recipes/export2tar.title @@ -0,0 +1 @@ +Export the /home directory from a virtual machine into a tarball \ No newline at end of file diff --git a/recipes/show-devices.html b/recipes/show-devices.html index f89a8ea..7bed5c7 100644 --- a/recipes/show-devices.html +++ b/recipes/show-devices.html @@ -1,5 +1,3 @@ -

Display the devices, partitions, LVs, VGs and PVs in a guest image

-

This very simple script shows how you can display an overview of what devices, partitions and LVM data are found in a diff --git a/recipes/show-devices.title b/recipes/show-devices.title new file mode 100644 index 0000000..cadb8ba --- /dev/null +++ b/recipes/show-devices.title @@ -0,0 +1 @@ +Display the devices, partitions, LVs, VGs and PVs in a guest image \ No newline at end of file diff --git a/recipes/tar2vm.html b/recipes/tar2vm.html index 6a063c6..a0ad29c 100644 --- a/recipes/tar2vm.html +++ b/recipes/tar2vm.html @@ -1,5 +1,3 @@ -

Make a virtual machine out of a tarball

-

This script shows how you might generate a whole virtual machine, or a disk image for a virtual machine, starting diff --git a/recipes/tar2vm.title b/recipes/tar2vm.title new file mode 100644 index 0000000..051f601 --- /dev/null +++ b/recipes/tar2vm.title @@ -0,0 +1 @@ +Make a virtual machine out of a tarball \ No newline at end of file -- 1.8.3.1