mirror of
https://github.com/kevinveenbirkenbach/linux-image-manager.git
synced 2024-11-12 18:51:04 +01:00
Refactored destructor
This commit is contained in:
parent
aa2eb62e77
commit
a8d099144e
@ -51,15 +51,19 @@ mount_partitions(){
|
||||
}
|
||||
|
||||
umount_everything(){
|
||||
info "Unmounting everything..." &&
|
||||
(umount -lv "$chroot_dev_pts_mount_path" || warning "Umounting $chroot_dev_pts_mount_path failed!") &&
|
||||
(umount -lv "$chroot_dev_mount_path" || warning "Umounting $chroot_dev_mount_path failed!" ) &&
|
||||
(umount -v "$chroot_proc_mount_path" || warning "Umounting $chroot_proc_mount_path failed!" ) &&
|
||||
(umount -v "$chroot_sys_mount_path" || warning "Umounting $chroot_sys_mount_path failed!") &&
|
||||
(umount -v "$root_mount_path""boot/" || warning "Umounting $root_mount_path""boot/ failed!") &&
|
||||
(umount -v "$root_mount_path" || warning "Umounting $root_mount_path failed!") &&
|
||||
(umount -v "$boot_mount_path" || warning "Umounting $boot_mount_path failed!") ||
|
||||
warning "Failed."
|
||||
info "Cleaning up..."
|
||||
info "Unmounting everything..."
|
||||
umount -lv "$chroot_dev_pts_mount_path" || warning "Umounting $chroot_dev_pts_mount_path failed!"
|
||||
umount -lv "$chroot_dev_mount_path" || warning "Umounting $chroot_dev_mount_path failed!"
|
||||
umount -v "$chroot_proc_mount_path" || warning "Umounting $chroot_proc_mount_path failed!"
|
||||
umount -v "$chroot_sys_mount_path" || warning "Umounting $chroot_sys_mount_path failed!"
|
||||
umount -v "$root_mount_path""boot/" || warning "Umounting $root_mount_path""boot/ failed!"
|
||||
umount -v "$root_mount_path" || warning "Umounting $root_mount_path failed!"
|
||||
umount -v "$boot_mount_path" || warning "Umounting $boot_mount_path failed!"
|
||||
info "Deleting mount folders..."
|
||||
rmdir -v "$root_mount_path" || warning "Removing $root_mount_path failed!"
|
||||
rmdir -v "$boot_mount_path" || warning "Removing $boot_mount_path failed!"
|
||||
rmdir -v "$working_folder_path" || warning "Removing $working_folder_path failed!"
|
||||
}
|
||||
|
||||
mount_chroot_binds(){
|
||||
|
@ -4,10 +4,6 @@
|
||||
# shellcheck disable=SC2154 # Deactivate not referenced link
|
||||
source "$(dirname "$(readlink -f "${0}")")/base.sh" || (echo "Loading base.sh failed." && exit 1)
|
||||
|
||||
destructor(){
|
||||
umount_everything
|
||||
}
|
||||
|
||||
info "Starting chroot..."
|
||||
|
||||
set_device_path
|
||||
|
@ -7,15 +7,6 @@ source "$(dirname "$(readlink -f "${0}")")/base.sh" || (echo "Loading base.sh fa
|
||||
|
||||
info "Setupscript for images started..."
|
||||
|
||||
info "Define functions..."
|
||||
destructor(){
|
||||
info "Cleaning up..."
|
||||
umount_everything
|
||||
rmdir -v "$root_mount_path" || warning "Removing $root_mount_path failed!"
|
||||
rmdir -v "$boot_mount_path" || warning "Removing $boot_mount_path failed!"
|
||||
rmdir -v "$working_folder_path" || warning "Removing $working_folder_path failed!"
|
||||
}
|
||||
|
||||
info "Checking if root..."
|
||||
if [ "$(id -u)" != "0" ];then
|
||||
error "This script must be executed as root!"
|
||||
|
Loading…
Reference in New Issue
Block a user