Automatically make deb
This commit is contained in:
parent
0ed43582b2
commit
7407adf7c1
@ -2,17 +2,39 @@
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import subprocess
|
||||||
|
import pathlib
|
||||||
|
|
||||||
updir = "CustomUploaders"
|
updir = "CustomUploaders"
|
||||||
|
control_format = """Package: dev.somnium.{0}-uploadconfig
|
||||||
|
Name: {1} Config
|
||||||
|
Depends: dev.somnium.notatio
|
||||||
|
Version: 1.0.0
|
||||||
|
Architecture: iphoneos-arm
|
||||||
|
Description: {2} upload config for the Notatio upload tweak.
|
||||||
|
Maintainer: Somnium Tweaks
|
||||||
|
Author: Somnium Tweaks
|
||||||
|
Section: Notatio Uploaders
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
files = [f for f in os.listdir(updir) if os.path.isfile("{0}/{1}".format(updir, f))]
|
files = [f for f in os.listdir(updir) if os.path.isfile("{0}/{1}".format(updir, f))]
|
||||||
|
|
||||||
files2 = [f for f in files if f.endswith(".sxcu")]
|
files2 = [f for f in files if f.endswith(".sxcu")]
|
||||||
|
|
||||||
for fname in files2:
|
for fname in files2:
|
||||||
|
dns = fname[:-5]
|
||||||
|
print("Forward DNS: " + dns)
|
||||||
|
revdns1 = dns.split('.')
|
||||||
|
revdns1.reverse()
|
||||||
|
revdns = '.'.join(revdns1)
|
||||||
|
print("Reverse DNS: " + revdns)
|
||||||
|
|
||||||
with open("{0}/{1}".format(updir, fname), "r", encoding="utf-8-sig") as f:
|
with open("{0}/{1}".format(updir, fname), "r", encoding="utf-8-sig") as f:
|
||||||
rawjson = f.read()
|
rawjson = f.read()
|
||||||
|
|
||||||
conv = json.loads(rawjson)
|
conv = json.loads(rawjson)
|
||||||
|
print("Loaded json")
|
||||||
|
|
||||||
if "FileFormName" in conv.keys():
|
if "FileFormName" in conv.keys():
|
||||||
try:
|
try:
|
||||||
@ -30,8 +52,23 @@ for fname in files2:
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
with open("{0}/{1}".format(updir + "-converted", fname), "w+") as f:
|
pathlib.Path("pkgs/{0}-uploadconfig/DEBIAN".format(revdns)).mkdir(parents=True, exist_ok=True)
|
||||||
|
pathlib.Path("pkgs/{0}-uploadconfig/Library/Application Support/Notatio".format(revdns)).mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
with open("pkgs/{0}-uploadconfig/DEBIAN/control".format(revdns), "w+") as f:
|
||||||
|
f.write(control_format.format(revdns, dns, dns))
|
||||||
|
print("Created DEBIAN/control")
|
||||||
|
|
||||||
|
with open("/tmp/{0}".format(revdns), "w+") as f:
|
||||||
f.write(json.dumps(conv))
|
f.write(json.dumps(conv))
|
||||||
|
print("Dumped json to /tmp/{0}".format(revdns))
|
||||||
|
|
||||||
|
subprocess.check_call(['json2plist', '-i', '/tmp/{0}'.format(revdns), '-o', 'pkgs/{0}-uploadconfig/Library/Application Support/Notatio/{1}.plist'.format(revdns, dns)])
|
||||||
|
print("Called json2plist")
|
||||||
|
|
||||||
|
subprocess.check_call(['dpkg-deb', '-b', 'pkgs/{0}-uploadconfig'])
|
||||||
|
print("Called dpkg-deb")
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("Skipped {0}".format(fname))
|
print("Skipped {0}".format(fname))
|
||||||
|
Loading…
Reference in New Issue
Block a user