Skip to content
Snippets Groups Projects
Commit b1a4614b authored by Lucendio's avatar Lucendio
Browse files

Add a confirmation failsafe before deleting files

The function `dir`, used to determine MKFILE_DIR can take multiple
parameters. As a result, if this repository is located in a path
that contains a white space, the result of `abspath` is interpreted
as multiple parameters, because Make uses white spaces as separator
or delimiter. Quoting does not help. Spaces as such only work in
shell commands within target bodies.

So, the chosen workaround is to add a failsafe to ask the user for
confirmation to give them a chance to double check what is actually
being deleted.

* added a warning at the top of the readme to raise awareness
parent aeaccdfa
No related branches found
No related tags found
No related merge requests found
...@@ -32,7 +32,9 @@ $(LOCAL_DIR)/%/: ...@@ -32,7 +32,9 @@ $(LOCAL_DIR)/%/:
.PHONY: clean .PHONY: clean
clean: clean:
rm -rf \ echo "DELETING: $(APP_NODE_MODULE_DIRS) $(TEMP_DIR) $(LOCAL_DIR)/dist" | tr ' ' '\n'
read -p "OK? [N,y] " input; [[ "$${input}" == "y" ]] \
&& rm -rf \
$(APP_NODE_MODULE_DIRS) \ $(APP_NODE_MODULE_DIRS) \
$(TEMP_DIR) \ $(TEMP_DIR) \
$(LOCAL_DIR)/dist $(LOCAL_DIR)/dist
...@@ -43,7 +45,9 @@ clean: ...@@ -43,7 +45,9 @@ clean:
build: SERVER_PUBLIC_URL ?= http://127.0.0.1:3001 build: SERVER_PUBLIC_URL ?= http://127.0.0.1:3001
build: APP_BUILD_PATH ?= $(TEMP_DIR) build: APP_BUILD_PATH ?= $(TEMP_DIR)
build: build:
rm -rf $(APP_BUILD_PATH) echo "DELETING: $(APP_BUILD_PATH)" | tr ' ' '\n'
read -p "OK? [N,y] " input; [[ "$${input}" == "y" ]] \
&& rm -rf $(APP_BUILD_PATH)
cp -r $(MKFILE_DIR)/app/server/src $(APP_BUILD_PATH) cp -r $(MKFILE_DIR)/app/server/src $(APP_BUILD_PATH)
cp $(MKFILE_DIR)/app/server/package* $(APP_BUILD_PATH)/ cp $(MKFILE_DIR)/app/server/package* $(APP_BUILD_PATH)/
......
Lecture: DevOps - Application Lecture: DevOps - Application
============================= =============================
> :warning: __Invoking `make` in a path containing white spaces may lead to unforeseen side effects like DATA LOSS !__
This repository contains the [application](./app/README.md) that is supposed be used as *deployable workload* in the This repository contains the [application](./app/README.md) that is supposed be used as *deployable workload* in the
[project assignment](https://github.com/lucendio/lecture-devops-material/blob/master/assignments/project-work.md) [project assignment](https://github.com/lucendio/lecture-devops-material/blob/master/assignments/project-work.md)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment