summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjandob2016-02-09 13:47:10 +0100
committerjandob2016-02-09 13:47:10 +0100
commit232b24fd94cea08e8fcd165c0a4e5b85bf62fbab (patch)
treed5cd129766d50945724bf1e0ef7dd70d893793cf
parentfix submodule checkout (diff)
parentAdding cleanup routines. (diff)
downloadsystemd-init-232b24fd94cea08e8fcd165c0a4e5b85bf62fbab.tar.gz
systemd-init-232b24fd94cea08e8fcd165c0a4e5b85bf62fbab.tar.xz
systemd-init-232b24fd94cea08e8fcd165c0a4e5b85bf62fbab.zip
Merge branch 'master' of git.openslx.org:openslx-ng/systemd-init
-rwxr-xr-xbuilder/build-initramfs.sh15
1 files changed, 11 insertions, 4 deletions
diff --git a/builder/build-initramfs.sh b/builder/build-initramfs.sh
index 2b0f9765..669e6a28 100755
--- a/builder/build-initramfs.sh
+++ b/builder/build-initramfs.sh
@@ -373,13 +373,11 @@ if [[ "$target" != '' ]]; then
if [[ -f "$target" ]]; then
_target="$(mktemp --directory)"
_xmount_mountpoint_target="$(mktemp --directory)"
- xmount --in qemu "$target" --out raw \
- "$_xmount_mountpoint_target"
+ xmount --in qemu "$target" --out raw "$_xmount_mountpoint_target"
_xmount_device_target="$(losetup --find)"
losetup "$_xmount_device_target" loopdev \
"${_xmount_mountpoint_target}/"*.dd
- mount "$_xmount_device_target" \
- "$_target"
+ mount "$_xmount_device_target" "$_target"
fi
if [[ -d "$_target" ]]; then
_temporary_working_directory="$(chroot "$_target" mktemp --directory)"
@@ -414,6 +412,15 @@ if [[ "$target" != '' ]]; then
"${_temporary_working_directory}/${BASH_SOURCE[0]}" \
${_parameter_to_forward[*]}
mv "${_target}/$file_path" "$file_path"
+ # Do cleanup procedures.
+ umount "${_target}${_temporary_working_directory}"
+ rm --recursive --force "${_target}${_temporary_working_directory}"
+ if [[ -f "$target" ]]; then
+ umount "$_target"
+ losetup --detach "$_xmount_device_target"
+ umount "$_xmount_mountpoint_target"
+ rm --recursive --force "$_target" "$_xmount_mountpoint_target"
+ fi
fi
exit 0
fi