Refactor cleanup process by replacing clean script with a comprehensive clean_all script to enhance build artifact removal
This commit is contained in:
parent
3d89b1a12a
commit
8ff8e240fe
|
@ -0,0 +1,26 @@
|
|||
#!/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
|
||||
export SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
|
||||
|
||||
function clean_all() {
|
||||
# This clean function will clean up everything built
|
||||
echo "Cleaning up..."
|
||||
sudo umount ./src/new_building_os/sys || sudo umount -lf ./src/new_building_os/sys || true
|
||||
sudo umount ./src/new_building_os/proc || sudo umount -lf ./src/new_building_os/proc || true
|
||||
sudo umount ./src/new_building_os/dev || sudo umount -lf ./src/new_building_os/dev || true
|
||||
sudo umount ./src/new_building_os/run || sudo umount -lf ./src/new_building_os/run || true
|
||||
sudo rm -rf ./src/ew_building_os || true
|
||||
sudo rm -rf ./src/image || true
|
||||
sudo rm -rf ./src/dist || true
|
||||
}
|
||||
|
||||
# ============= main ================
|
||||
cd $SCRIPT_DIR
|
||||
|
||||
clean_all
|
2
makefile
2
makefile
|
@ -64,5 +64,5 @@ fast: bootstrap
|
|||
|
||||
clean:
|
||||
@echo "[MAKE] Cleaning build artifacts..."
|
||||
@cd $(SRC_DIR) && ./clean.sh
|
||||
@./clean_all.sh
|
||||
@echo "[MAKE] Clean complete."
|
||||
|
|
|
@ -17,6 +17,7 @@ function bind_signal() {
|
|||
}
|
||||
|
||||
function clean() {
|
||||
# This clean function is used to clean up the places where current build may touch and create
|
||||
print_ok "Cleaning up..."
|
||||
sudo umount new_building_os/sys || sudo umount -lf new_building_os/sys || true
|
||||
sudo umount new_building_os/proc || sudo umount -lf new_building_os/proc || true
|
||||
|
|
32
src/clean.sh
32
src/clean.sh
|
@ -1,32 +0,0 @@
|
|||
#!/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
|
||||
export SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
|
||||
source $SCRIPT_DIR/shared.sh
|
||||
source $SCRIPT_DIR/args.sh
|
||||
|
||||
function clean() {
|
||||
print_ok "Cleaning up..."
|
||||
sudo umount new_building_os/sys || sudo umount -lf new_building_os/sys || true
|
||||
sudo umount new_building_os/proc || sudo umount -lf new_building_os/proc || true
|
||||
sudo umount new_building_os/dev || sudo umount -lf new_building_os/dev || true
|
||||
sudo umount new_building_os/run || sudo umount -lf new_building_os/run || true
|
||||
sudo rm -rf new_building_os || true
|
||||
judge "Clean up rootfs"
|
||||
sudo rm -rf image || true
|
||||
judge "Clean up image"
|
||||
sudo rm -rf dist || true
|
||||
judge "Clean up dist"
|
||||
sudo rm -f $TARGET_NAME.iso || true
|
||||
judge "Clean up iso"
|
||||
}
|
||||
|
||||
# ============= main ================
|
||||
cd $SCRIPT_DIR
|
||||
|
||||
clean
|
Loading…
Reference in New Issue