summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjandob2016-01-28 12:35:01 +0100
committerjandob2016-01-28 12:35:01 +0100
commitab65304f7e4a4e39fed6c79c1dd1bc5d3029529a (patch)
treec2f44909d788a339cca0d19bfe1c8ccba841216c
parentautomatic xmount building (diff)
downloadsystemd-init-ab65304f7e4a4e39fed6c79c1dd1bc5d3029529a.tar.gz
systemd-init-ab65304f7e4a4e39fed6c79c1dd1bc5d3029529a.tar.xz
systemd-init-ab65304f7e4a4e39fed6c79c1dd1bc5d3029529a.zip
fix
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/prepare-root-partition.sh10
-rw-r--r--builder/dnbd3-rootfs/scripts/build.sh14
2 files changed, 16 insertions, 8 deletions
diff --git a/builder/dnbd3-rootfs/hooks/prepare-root-partition.sh b/builder/dnbd3-rootfs/hooks/prepare-root-partition.sh
index a9407287..c05ebffb 100755
--- a/builder/dnbd3-rootfs/hooks/prepare-root-partition.sh
+++ b/builder/dnbd3-rootfs/hooks/prepare-root-partition.sh
@@ -38,18 +38,18 @@ fi
# endregion
# region scan partitions
read_only_device=""
-if ! qemu-img info --output json "$SLX_DNBD3_DEVICE" | grep '"format": "raw"'
+if qemu-img info --output json "$SLX_DNBD3_DEVICE" | grep '"format": "raw"'
then
- read_only_device="$(container-unpack-xmount $SLX_DNBD3_DEVICE)"
-else
# workaround to detect partitions on raw disks
# can be omited when the dnbd3 kernel module supports it (like the nbd
# kernel module with parameter 'max_part')
loop_device="$(losetup -f)"
+ losetup "$loop_device" "$SLX_DNBD3_DEVICE" --partscan
+ read_only_device="$loop_device"
touch $read_only_device
- losetup "$loop_device" "$read_only_device" --partscan
udevadm settle
- read_only_device="$loop_device"
+else
+ read_only_device="$(container-unpack-xmount $SLX_DNBD3_DEVICE)"
fi
# endregion
diff --git a/builder/dnbd3-rootfs/scripts/build.sh b/builder/dnbd3-rootfs/scripts/build.sh
index b150de58..e2e44034 100644
--- a/builder/dnbd3-rootfs/scripts/build.sh
+++ b/builder/dnbd3-rootfs/scripts/build.sh
@@ -10,6 +10,7 @@ build_compile_qemu_xmount() {
# "$1/libxmount_input_qemu.so"
pushd "$1"
local xmount_installation="../xmount/trunk/build/release_build"
+ [ ! -z "$2" ] && xmount_installation="$2"
./configure --enable-xmount-input --python=$(which python2) \
--extra-cflags="-fPIC" \
--extra-cflags="-I${xmount_installation}/include" \
@@ -32,11 +33,18 @@ build_compile_xmount() {
# Provides the xmount installation under:
# "$1/trunk/build/release_build/"
pushd "$1"
+
+ local destination_directory="./release_build"
+ [ ! -z "$2" ] && destination_directory="$2"
+ local install_prefix="/"
+ [ ! -z "$3" ] && install_prefix="$3"
+
mkdir -p trunk/build
cd trunk/build
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/ ..
+ cmake -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_INSTALL_PREFIX="$install_prefix" ..
make
- make install DESTDIR=./release_build
+ make install DESTDIR="$destination_directory"
local ret=$?
popd
return $ret
@@ -46,7 +54,7 @@ build_clean_xmount() {
}
build_clean_qemu_nbd() {
pushd "$1"
- make clean # TODO use git clean -f -x
+ git clean -f -x || make clean
popd
return $?
}