summaryrefslogtreecommitdiffstats
path: root/builder/dnbd3-rootfs/scripts
diff options
context:
space:
mode:
authorjandob2016-01-21 17:41:00 +0100
committerjandob2016-01-21 17:41:00 +0100
commit9b89d1346861065516ed8e2129156e24dca67fff (patch)
tree33a2f7a3af03adb1af2c21a51564d72b80b2906b /builder/dnbd3-rootfs/scripts
parentset qemu submodule to libxmount_input branch (diff)
downloadsystemd-init-9b89d1346861065516ed8e2129156e24dca67fff.tar.gz
systemd-init-9b89d1346861065516ed8e2129156e24dca67fff.tar.xz
systemd-init-9b89d1346861065516ed8e2129156e24dca67fff.zip
bugfixes
Diffstat (limited to 'builder/dnbd3-rootfs/scripts')
-rw-r--r--builder/dnbd3-rootfs/scripts/build.sh81
1 files changed, 43 insertions, 38 deletions
diff --git a/builder/dnbd3-rootfs/scripts/build.sh b/builder/dnbd3-rootfs/scripts/build.sh
index 186bdef4..1aa835ab 100644
--- a/builder/dnbd3-rootfs/scripts/build.sh
+++ b/builder/dnbd3-rootfs/scripts/build.sh
@@ -1,10 +1,49 @@
source "$(dirname "${BASH_SOURCE[0]}")/rebash/core.sh"
core.import logging
-build_clean_qemu_nbd() {
- # removes qemu-nbd.
+build_compile_qemu_xmount() {
+ # Downloads and compiles qemu libxmount.
#
- rm --recursive --force "$1/*"
+ # Provides the following file:
+ # "$1/libxmount_input_qemu.so"
+
+ pushd "$1"
+ ./configure --enable-xmount-input --extra-cflags=-fPIC \
+ --python=$(which python2)
+ make libxmount_input_qemu.so
+ local ret=$?
+ popd
+ return $ret
+}
+build_clean_qemu_xmount() {
+ pushd "$1"
+ make clean
+ popd
+ return $?
+}
+build_compile_xmount() {
+ # Downloads and compiles xmount
+ #
+ # Provides the following files:
+ # "$1/trunk/build/libxmount_input/libxmount_input_raw/libxmount_input_raw.so"
+ # "$1/trunk/build/src/xmount"
+ pushd "$1"
+ mkdir -p trunk/build
+ cd trunk/build
+ cmake -DCMAKE_BUILD_TYPE=Release ..
+ make
+ local ret=$?
+ popd
+ return $ret
+}
+build_clean_xmount() {
+ rm -rf "$1/trunk/build"
+}
+build_clean_qemu_nbd() {
+ pushd "$1"
+ make clean
+ popd
+ return $?
}
build_compile_qemu_nbd() {
# Downloads and compiles qemu-nbd.
@@ -23,8 +62,6 @@ build_compile_qemu_nbd() {
#yaourt --noconfirm -S glib2-static glibc-static pcre-static
#exit
pushd "$(dirname $1)"
- [ ! -e qemu ] && git clone git://git.qemu.org/qemu.git qemu
- cd qemu
# TODO check what other features can be disabled
# --static
./configure --target-list=x86_64-linux-user \
@@ -75,10 +112,7 @@ build_compile_dnbd3() {
# ...
# Provides the following file:
# "$1/build/dnbd3.ko"
- pushd "$1/.."
- rm --recursive --force "$1"
- git clone git://git.openslx.org/dnbd3.git
- cd dnbd3
+ pushd "$1"
./build.sh
popd
return $?
@@ -117,32 +151,3 @@ build_clean_systemd_preserve_process_marker() {
popd
return $?
}
-build_mount_partition() {
- # Mounts a partition at given offset.
- #
- # Examples:
- #
- # >>> build_mount_partition /dev/DEVICE_NAME PARTITION_IDENTIFIER
- # ...
- local device="$1"
- local partition_identifier="$2"
- local loop_device="$(losetup --find)"
-
- local sector_size="$(blockdev --getbsz "$device")"
- local partition_info="(partx --raw --noheadings --output START,NAME,UUID \
- "$device" 2>/dev/null| grep part)"
- local offset_sectors="$(echo "$partition_identifier" | \
- cut --delimiter=' ' --fields=1)"
- if [ -z "$offset_sectors" ]; then
- logging.warn "could not find partition with identifier \"$partition_identifier\" on device $device"
- return 1
- fi
- # NOTE: Could overflow on 32bit systems
- # logging.warn "$(("$offset_sectors"*512))"
- local offset_bytes="$(echo | awk -v x="$offset_sectors" -v y="$sector_size" '{print x * y}')"
-
- # NOTE: Test if mount works directly (problem with btrfs device id).
- # mount --verbose --options loop,offset="$offset_bytes" "$device" "$mount_point"
- losetup --verbose --offset "$offset_bytes" "$loop_device" "$device"
- echo "$loop_device"
-}