diff --git a/README.md b/README.md index 29520b0..181cc38 100644 --- a/README.md +++ b/README.md @@ -8,33 +8,37 @@ Requirements + RHEL/CentOS/Scientific -xexecscript(*.sh) ------------------ - -Run SCRIPT after distro installation finishes. -Script will be called with the guest's chroot as first argument, so you can use `chroot $1 ` to run code in the virtual machine. +Usage +----- -copy.txt/postcopy.txt ---------------------- +``` +$ add-book.sh +``` -Read `source dest` lines from FILE, copying source files from host to dest in the guest's file system. +``` +$ run-book.sh ... +$ CHROOT_DIR=/ run-book.sh +$ CHROOT_DIR=/path/to/chroot run-book.sh +``` Getting Started --------------- -Add a new book. +### 1: Add a book ``` $ ./add-book.sh untitled generated => untitled untitled -untitled/xexecscript.d -untitled/xexecscript.d/untitled.sh untitled/copy.txt untitled/guestroot +untitled/xexecscript.d +untitled/xexecscript.d/untitled.sh ``` -`untitled/xexecscript.d/untitled.sh` is a sample execscript. +`untitled/xexecscript.d/untitled.sh`: + +Script will be called with the guest's chroot as first argument, so you can use `chroot $1 ` to run code in the virtual machine. ``` #!/bin/bash @@ -52,6 +56,28 @@ chroot $1 $SHELL -ex <<'EOS' EOS ``` +`untitled/copy.txt`: + +Reading `source dest` lines from FILE, copying source files from host to dest in the guest's file system before running execscript. + +``` +guestroot/etc/hostname /etc/hostname +``` + +### 2: Run the book + +Run the book in `CHROOT_DIR`(default is `/`). + +``` +$ sudo CHROOT_DIR=/path/to/chroot ./run-book.sh untitled +``` + +If you want to run the book on a host, you can set '/' to `CHROOT_DIR` like this. + +``` +$ sudo CHROOT_DIR= ./run-book.sh untitled +``` + Contributing ------------ diff --git a/add-book.sh b/add-book.sh index 9129bdb..240b5db 100755 --- a/add-book.sh +++ b/add-book.sh @@ -3,6 +3,9 @@ # requires: # bash # +# usage: +# # add-book.sh +# set -e set -o pipefail diff --git a/run-book.sh b/run-book.sh index 22e50b8..8e8e247 100755 --- a/run-book.sh +++ b/run-book.sh @@ -4,11 +4,11 @@ # bash # # usage: -# # run-book.sh -# # run-book.sh ... +# # run-book.sh +# # run-book.sh ... # -# # CHROOT_DIR=/ run-book.sh -# # CHROOT_DIR=/path/to/chroot run-book.sh +# # CHROOT_DIR=/ run-book.sh +# # CHROOT_DIR=/path/to/chroot run-book.sh # ### functions