Compare commits
No commits in common. "83cc578d14a9abb13f863adfe13873262837478f" and "bafd045a5f0217b5624e450b810263121845bb4c" have entirely different histories.
83cc578d14
...
bafd045a5f
|
|
@ -1,15 +0,0 @@
|
||||||
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,22 +1,9 @@
|
||||||
#IMPORT
|
#IMPORT
|
||||||
import os
|
import os, sys
|
||||||
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
|
#FILE_READ
|
||||||
with open("../nginx-site-template.conf", "r") as f:
|
with open("../nginx-site-template.conf", "r") as f:
|
||||||
template = f.read().replace("#serverNameVar", f"{args.domain}").replace("#http://127.0.0.1:8080/", f"#ip_address")
|
template = f.read().replace("#serverNameVar", f"{sys.argv[1]}").replace("#http://127.0.0.1:8080/", f"#ip_address")
|
||||||
#ADDITIONAL_REPLACE
|
#ADDITIONAL_REPLACE
|
||||||
|
|
||||||
#FILE_WRITE
|
#FILE_WRITE
|
||||||
|
|
@ -24,7 +11,7 @@ with open("/etc/nginx/sites-available/#service.conf", "w") as f:
|
||||||
f.write(template)
|
f.write(template)
|
||||||
|
|
||||||
#GET_CERT
|
#GET_CERT
|
||||||
os.system(f"sh ../getcert.sh {args.domain} {args.email}")
|
os.system(f"sh ../getcert.sh {sys.argv[1]} {sys.argv[2]}")
|
||||||
|
|
||||||
#GENERATE_NGINX
|
#GENERATE_NGINX
|
||||||
# depreceated, TODO: replace with os.subprocess
|
# depreceated, TODO: replace with os.subprocess
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue