forked from AiursoftWeb/AnduinOS-2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclean_all.sh
More file actions
executable file
·27 lines (23 loc) · 1.09 KB
/
Copy pathclean_all.sh
File metadata and controls
executable file
·27 lines (23 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
#==========================
# Set up the environment
#==========================
set -e # exit on error
set -o pipefail # exit on pipeline error
set -u # treat unset variable as error
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
export SCRIPT_DIR
function clean_all() {
echo "Cleaning up..."
sudo umount "$SCRIPT_DIR/new_building_os/sys" || sudo umount -lf "$SCRIPT_DIR/new_building_os/sys" || true
sudo umount "$SCRIPT_DIR/new_building_os/proc" || sudo umount -lf "$SCRIPT_DIR/new_building_os/proc" || true
sudo umount "$SCRIPT_DIR/new_building_os/dev" || sudo umount -lf "$SCRIPT_DIR/new_building_os/dev" || true
sudo umount "$SCRIPT_DIR/new_building_os/run" || sudo umount -lf "$SCRIPT_DIR/new_building_os/run" || true
sudo umount "$SCRIPT_DIR/image/isolinux/efi" || sudo umount -lf "$SCRIPT_DIR/image/isolinux/efi" || true
sudo rm -rf "$SCRIPT_DIR/new_building_os" || true
sudo rm -rf "$SCRIPT_DIR/image" || true
rm -f "$SCRIPT_DIR"/*.iso || true
}
# ============= main ================
cd "$SCRIPT_DIR"
clean_all