Skip to content

Commit

Permalink
模板: 优化
Browse files Browse the repository at this point in the history
  • Loading branch information
hugcabbage committed Nov 10, 2022
1 parent db3f2dd commit 6a660b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion templet/produce.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def routine_cmd(clone: str, config: str):
subprocess.run(cmd, shell=True)


if __name__ == '__main__':
def main():
destdir = (rp1 := os.getenv('REPO_PATH').rstrip('/')) + '/' + (dd1 := os.getenv('DEPLOYDIR').rstrip('/'))
ba1 = f'{destdir}/backups'
he1 = f'{destdir}/headers'
Expand Down Expand Up @@ -257,3 +257,7 @@ def routine_cmd(clone: str, config: str):
subprocess.run(f"sed -i 's/name: xxxxxx/name: device {serial}/' {by1}", shell=True)
subprocess.run(f"sed -i 's/SERIAL_NU: xxxxxx/SERIAL_NU: {serial}/' {by1}", shell=True)
subprocess.run(f"sed -i 's/DEPLOYDIR: xxxxxx/DEPLOYDIR: {dd1}/' {by1}", shell=True)


if __name__ == '__main__':
main()
6 changes: 4 additions & 2 deletions templet/refresh.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
filedir = os.getenv('FILEDIR').strip().rstrip('/')
fconfig = os.getenv('FILE').strip()
fclone = fconfig.split('.')[0] + '.clone.sh'
produce.routine_cmd(f'{filedir}/{fclone}', c1 := f'{filedir}/{fconfig}')
produce.simplify_config(c1)
if not os.path.exists(fc1 := f'{filedir}/{fclone}'):
fc1 = f'{filedir}/1.clone.sh'
produce.routine_cmd(fc1, fc2 := f'{filedir}/{fconfig}')
produce.simplify_config(fc2)

0 comments on commit 6a660b1

Please sign in to comment.