Compare commits
4 Commits
bafd045a5f
...
83cc578d14
| Author | SHA1 | Date |
|---|---|---|
|
|
83cc578d14 | |
|
|
2d4fc83f80 | |
|
|
15de644813 | |
|
|
33dd18c792 |
|
|
@ -0,0 +1,15 @@
|
|||
import sys
|
||||
import glob
|
||||
import os
|
||||
|
||||
directories = sys.argv[1:]
|
||||
|
||||
for directory in directories:
|
||||
if not glob.glob(f"{directory}/manifest.dat"):
|
||||
raise FileNotFoundError
|
||||
with open(f"{directory}/manifest.dat", "r") as f:
|
||||
manifest_info = [line_info.split("\n@ ")[1:] for line_info in f.read().split("%")[1:]]
|
||||
for replacement in manifest_info:
|
||||
if replacement[0] == "#service":
|
||||
os.system(f". /opt/quick-recover/{replacement[1]}.conf; python3 {directory}/setup.py $DOMAIN $EMAIL")
|
||||
break
|
||||
|
|
@ -1,9 +1,22 @@
|
|||
#IMPORT
|
||||
import os, sys
|
||||
import os
|
||||
import argparse
|
||||
|
||||
#PARSE_ARGS
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("domain")
|
||||
parser.add_argument("email")
|
||||
args = parser.parse_args()
|
||||
|
||||
#QUICK_RECOVER
|
||||
os.makedirs(os.path.dirname("/opt/quick-recover/"), exist_ok=True)
|
||||
with open("/opt/quick-recover/#service.conf", "w") as f:
|
||||
f.writeline(f"export DOMAIN='{parser.domain}'")
|
||||
f.writeline(f"export EMAIL='{parser.email}'")
|
||||
|
||||
#FILE_READ
|
||||
with open("../nginx-site-template.conf", "r") as f:
|
||||
template = f.read().replace("#serverNameVar", f"{sys.argv[1]}").replace("#http://127.0.0.1:8080/", f"#ip_address")
|
||||
template = f.read().replace("#serverNameVar", f"{args.domain}").replace("#http://127.0.0.1:8080/", f"#ip_address")
|
||||
#ADDITIONAL_REPLACE
|
||||
|
||||
#FILE_WRITE
|
||||
|
|
@ -11,7 +24,7 @@ with open("/etc/nginx/sites-available/#service.conf", "w") as f:
|
|||
f.write(template)
|
||||
|
||||
#GET_CERT
|
||||
os.system(f"sh ../getcert.sh {sys.argv[1]} {sys.argv[2]}")
|
||||
os.system(f"sh ../getcert.sh {args.domain} {args.email}")
|
||||
|
||||
#GENERATE_NGINX
|
||||
# depreceated, TODO: replace with os.subprocess
|
||||
|
|
|
|||
Loading…
Reference in New Issue