feat(shell): add init_conf and update makefile

This commit is contained in:
HuangJiaLuo 2021-10-04 11:21:02 +08:00
parent 96d5a9acc9
commit 99dd878bb3
2 changed files with 26 additions and 0 deletions

View File

@ -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

22
shell/init_conf.py Normal file
View File

@ -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()