diff options
author | jandob | 2016-02-09 13:47:10 +0100 |
---|---|---|
committer | jandob | 2016-02-09 13:47:10 +0100 |
commit | 232b24fd94cea08e8fcd165c0a4e5b85bf62fbab (patch) | |
tree | d5cd129766d50945724bf1e0ef7dd70d893793cf | |
parent | fix submodule checkout (diff) | |
parent | Adding cleanup routines. (diff) | |
download | systemd-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-x | builder/build-initramfs.sh | 15 |
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 |