diff --git a/Makefile b/Makefile index 809dcc6..d74a6ae 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ guestfish: deps: scripts/download-deps.sh + scripts/create-libguestfs-module.sh guestfish-deps: scripts/download-guestfish-deps.sh diff --git a/README.md b/README.md index 7b90a12..9861c7e 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ cloudbuild downloads, modifies and uploads VM templates for the CSC cloud ## Installing dependencies If you have root access, run ```sh -apt install golang-guestfs-dev +sudo apt install golang-guestfs-dev +scripts/create-libguestfs-module.sh ``` Otherwise, run @@ -20,7 +21,7 @@ for guestfs. If you have root access, run ```sh -apt install libguestfs-tools +sudo apt install libguestfs-tools ``` Otherwise, run diff --git a/scripts/create-libguestfs-module.sh b/scripts/create-libguestfs-module.sh new file mode 100755 index 0000000..cccdfe1 --- /dev/null +++ b/scripts/create-libguestfs-module.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -ex + +DEPS_DIR= +if ! [ -d /usr/share/gocode/src/libguestfs.org/guestfs ]; then + DEPS_DIR=guestfs/deps +fi +mkdir -p guestfs +cp $DEPS_DIR/usr/share/gocode/src/libguestfs.org/guestfs/guestfs.go guestfs/ +cp $DEPS_DIR/usr/include/guestfs.h guestfs/ +cd guestfs +rm -f go.mod +go mod init guestfs diff --git a/scripts/download-deps.sh b/scripts/download-deps.sh index 62373e5..1998ce8 100755 --- a/scripts/download-deps.sh +++ b/scripts/download-deps.sh @@ -62,7 +62,3 @@ for dep in "${dependencies[@]}"; do done set -x rm -f *.deb - -cp deps/usr/share/gocode/src/libguestfs.org/guestfs/guestfs.go . -cp deps/usr/include/guestfs.h . -go mod init guestfs