allow running in-tree
This commit is contained in:
parent
906535e29d
commit
4d0d8914eb
0
src/pvm2tarball.sh
Normal file → Executable file
0
src/pvm2tarball.sh
Normal file → Executable file
0
src/pvmboot.sh
Normal file → Executable file
0
src/pvmboot.sh
Normal file → Executable file
19
src/pvmbootstrap.sh
Normal file → Executable file
19
src/pvmbootstrap.sh
Normal file → Executable file
@ -23,9 +23,14 @@
|
|||||||
source "$(librelib messages)"
|
source "$(librelib messages)"
|
||||||
|
|
||||||
|
|
||||||
|
# defaults
|
||||||
readonly DEF_MIRROR="https://repo.parabola.nu/\$repo/os/\$arch"
|
readonly DEF_MIRROR="https://repo.parabola.nu/\$repo/os/\$arch"
|
||||||
readonly DEF_IMG_GB=64
|
readonly DEF_IMG_GB=64
|
||||||
|
|
||||||
|
# misc
|
||||||
|
readonly THIS_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
|
||||||
|
# options
|
||||||
Hooks=()
|
Hooks=()
|
||||||
Mirror=$DEF_MIRROR
|
Mirror=$DEF_MIRROR
|
||||||
ImgSizeGb=$DEF_IMG_GB
|
ImgSizeGb=$DEF_IMG_GB
|
||||||
@ -354,9 +359,9 @@ EOF
|
|||||||
# boot the machine to run the pre-init hooks
|
# boot the machine to run the pre-init hooks
|
||||||
local pvmboot_cmd
|
local pvmboot_cmd
|
||||||
local qemu_flags=(-no-reboot)
|
local qemu_flags=(-no-reboot)
|
||||||
if [ -f "./src/pvmboot.sh" ]; then
|
if [ -f "$THIS_DIR/pvmboot.sh" ]; then # in-tree
|
||||||
pvmboot_cmd=(bash ./src/pvmboot.sh)
|
pvmboot_cmd=("$THIS_DIR/pvmboot.sh")
|
||||||
elif type -p pvmboot &>/dev/null; then
|
elif type -p pvmboot &>/dev/null; then # installed
|
||||||
pvmboot_cmd=('pvmboot')
|
pvmboot_cmd=('pvmboot')
|
||||||
else
|
else
|
||||||
error "pvmboot not available -- unable to run hooks"
|
error "pvmboot not available -- unable to run hooks"
|
||||||
@ -399,10 +404,10 @@ main() {
|
|||||||
while getopts 'hOs:M:H:' arg; do
|
while getopts 'hOs:M:H:' arg; do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
h) usage; return "$EXIT_SUCCESS";;
|
h) usage; return "$EXIT_SUCCESS";;
|
||||||
H) if [ -e "/usr/lib/libretools/pvmbootstrap/hook-$OPTARG.sh" ]; then
|
H) if [ -e "$THIS_DIR/hooks/hook-$OPTARG.sh" ]; then # in-tree
|
||||||
hooks+=("/usr/lib/libretools/pvmbootstrap/hook-$OPTARG.sh")
|
Hooks+=("$THIS_DIR/hooks/hook-$OPTARG.sh")
|
||||||
elif [ -e "./src/hooks/hook-$OPTARG.sh" ]; then
|
elif [ -e "/usr/lib/libretools/pvmbootstrap/hook-$OPTARG.sh" ]; then # installed
|
||||||
hooks+=("./src/hooks/hook-$OPTARG.sh")
|
Hooks+=("/usr/lib/libretools/pvmbootstrap/hook-$OPTARG.sh")
|
||||||
elif [ -e "$OPTARG" ]; then
|
elif [ -e "$OPTARG" ]; then
|
||||||
Hooks+=("$OPTARG")
|
Hooks+=("$OPTARG")
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user