forked from p93542168/wheat-cache
feat(shell): add init_conf and update makefile
This commit is contained in:
parent
96d5a9acc9
commit
99dd878bb3
4
makefile
4
makefile
|
@ -31,3 +31,7 @@ gen-protobuf:
|
||||||
.PHONY: gen-middleware
|
.PHONY: gen-middleware
|
||||||
gen-middleware:
|
gen-middleware:
|
||||||
@python3 ./shell/gen_middleware.py
|
@python3 ./shell/gen_middleware.py
|
||||||
|
|
||||||
|
.PHONY: init-conf
|
||||||
|
init-conf:
|
||||||
|
@sudo python3 ./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()
|
Loading…
Reference in New Issue