cfgfoo

git clone https://orangeshoelaces.net/git/cfgfoo.git

1b5caef6fdba4e35afd5cd8044063568ef817c3b

Author: Vasilii Kolobkov on 12/22/2018

Committer: Vasilii Kolobkov on 12/22/2018

Check whether file is available and create one if not

Stats

aliases         | 3 ++-
steps/fs/checkf | 9 ++++++++
2 files changed, 11 insertions(+), 1 deletion(-)

Patch

diff --git a/aliases b/aliases
index 136f186..b05e10d 100644
--- a/aliases
+++ b/aliases
@@ -8,8 +8,9 @@ alias crontab_add="cfgfoo ${CFGFOOPATH}/steps/crontab/add "
 alias edit_appendfln="cfgfoo ${CFGFOOPATH}/steps/edit/appendfln -s "
 alias edit_overrideln="cfgfoo ${CFGFOOPATH}/steps/edit/overrideln -s "
 
-alias fs_mkdir="cfgfoo ${CFGFOOPATH}/steps/fs/mkdir "
+alias fs_checkf="cfgfoo ${CFGFOOPATH}/steps/fs/checkf "
 alias fs_install="cfgfoo ${CFGFOOPATH}/steps/fs/install -s "
+alias fs_mkdir="cfgfoo ${CFGFOOPATH}/steps/fs/mkdir "
 
 alias pf_check="cfgfoo ${CFGFOOPATH}/steps/pf/check -s "
 alias pf_load="cfgfoo ${CFGFOOPATH}/steps/pf/load -s "
diff --git a/steps/fs/checkf b/steps/fs/checkf
new file mode 100644
index 0000000..0b5567a
--- /dev/null
+++ b/steps/fs/checkf
@@ -0,0 +1,9 @@
+step_taken() {
+	[ -f "$1" ]
+}
+
+take_step() {
+	: > "$1"
+	chown "${2:-root}:${3:-wheel}" "$1"
+	chmod "${4:-0640}" "$1"
+}