From b83bc2820aaa86d0a61e66fb57314bdae0fb49db Mon Sep 17 00:00:00 2001 From: b Date: Sun, 4 Dec 2022 16:41:49 +0000 Subject: [PATCH] Safety against misconfig rm -rf /* --- makefile | 6 +++++- makefile.1.mak | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/makefile b/makefile index 4eb8fd0..5c071c6 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,7 @@ # OTT mirror # Copyright (C) 2022 Balthasar Szczepański # "makefile" is automatically generated from "makefile.1.mak" -# 29.09.2022 +# 04.12.2022 # This file is part of OTT mirror. # @@ -244,9 +244,11 @@ mktree: $(MKDIR) -p $(DIR) $(CHMOD) g-r,g-w,g-x,o-r,o-w,o-x $(HIDDEN_DIR) +ifdef BIN_PATH cp_bin: $(BIN) setuid | mktree $(RM) -rf $(BIN_PATH)/* $(CP) -p $(BIN) $(BIN_PATH) +endif cp_conf: ottmirror.conf $(CP) ottmirror.conf $(CONF) @@ -254,9 +256,11 @@ cp_conf: ottmirror.conf cp_cron: ottmirror.cron $(SUDO) $(CP) ottmirror.cron $(CRON) +ifdef WWW_SRC_PATH cp_src: $(SRC) | mktree $(RM) -rf $(WWW_SRC_PATH)/* $(CP) -r $(SRC) $(WWW_SRC_PATH) +endif cp_www: | mktree $(CP) -r www/ott/* $(WWW_PATH) diff --git a/makefile.1.mak b/makefile.1.mak index 6b9bd55..2b5f71c 100644 --- a/makefile.1.mak +++ b/makefile.1.mak @@ -1,7 +1,7 @@ # OTT mirror # Copyright (C) 2022 Balthasar Szczepański # "makefile" is automatically generated from "makefile.1.mak" -# 29.09.2022 +# 04.12.2022 # This file is part of OTT mirror. # @@ -35,7 +35,7 @@ CONFIGFILE = settings-$(TARGET).txt settings.txt ###MAKE_PERL: PERL = perl ###MAKE_MKDIR: MKDIR = mkdir -###MAKE_CP: CP = rm +###MAKE_CP: CP = cp ###MAKE_RM: RM = rm ###MAKE_CHMOD: CHMOD = chmod ###MAKE_SUDO: SUDO = sudo @@ -244,9 +244,11 @@ mktree: $(MKDIR) -p $(DIR) $(CHMOD) g-r,g-w,g-x,o-r,o-w,o-x $(HIDDEN_DIR) +ifdef BIN_PATH cp_bin: $(BIN) setuid | mktree $(RM) -rf $(BIN_PATH)/* $(CP) -p $(BIN) $(BIN_PATH) +endif cp_conf: ottmirror.conf $(CP) ottmirror.conf $(CONF) @@ -254,9 +256,11 @@ cp_conf: ottmirror.conf cp_cron: ottmirror.cron $(SUDO) $(CP) ottmirror.cron $(CRON) +ifdef WWW_SRC_PATH cp_src: $(SRC) | mktree $(RM) -rf $(WWW_SRC_PATH)/* $(CP) -r $(SRC) $(WWW_SRC_PATH) +endif cp_www: | mktree $(CP) -r www/ott/* $(WWW_PATH) -- 2.30.2