diff --git a/makefile b/makefile index b61609a..3eda314 100644 --- a/makefile +++ b/makefile @@ -31,3 +31,7 @@ gen-protobuf: .PHONY: gen-middleware gen-middleware: @python3 ./shell/gen_middleware.py + +.PHONY: init-conf +init-conf: + @sudo python3 ./shell/init_conf.py diff --git a/shell/init_conf.py b/shell/init_conf.py new file mode 100644 index 0000000..9058dc2 --- /dev/null +++ b/shell/init_conf.py @@ -0,0 +1,22 @@ +import os +from pathlib import Path +import shutil + +sysPath = os.getcwd() +confInPath = f"{sysPath}/conf/wheat-cache.yaml" +confOutPath = "/etc/wheat-cache" + + +def check_and_make_conf_dir(): + conf_dir = Path(confOutPath) + if not conf_dir.is_dir(): + os.makedirs(confOutPath) + + +def copy_conf(): + shutil.copy(confInPath, confOutPath) + + +if __name__ == '__main__': + check_and_make_conf_dir() + copy_conf()