feat(cgen): plist and entitlement merging

This commit is contained in:
zx
2024-11-26 22:21:13 -05:00
parent e09351287b
commit 86e45cc186
4 changed files with 26 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ you can open an issue to request a feature :D !! also see my [recommended flags]
- remove watch app
- change the app icon
- fakesign the output ipa/tipa/app
- merge a plist into the app's existing Info.plist
- add custom entitlements to the main executable
- thin all binaries to arm64, it can LARGELY reduce app size sometimes!
- remove all app extensions (or just encrypted ones!)

View File

@@ -42,6 +42,14 @@ def main() -> None:
"-k", metavar="icon",
help="modify the app's icon"
)
parser.add_argument(
"-l", metavar="plist",
help="a plist to merge with the app's Info.plist"
)
parser.add_argument(
"-x", metavar="entitlements",
help="add or modify entitlements to the main binary"
)
parser.add_argument(
"-u", "--remove-supported-devices", action="store_true",
@@ -83,6 +91,10 @@ def generate_cyan(parser: argparse.ArgumentParser) -> None:
parser.error(f"invalid minimum OS version: {args.m}")
if args.k is not None and not os.path.isfile(args.k):
parser.error(f"{args.k} does not exist")
if args.l is not None and not os.path.isfile(args.l):
parser.error(f"{args.l} does not exist")
if args.x is not None and not os.path.isfile(args.x):
parser.error(f"{args.x} does not exist")
if args.f is not None:
fake = [f for f in args.f if not os.path.exists(f)]
@@ -107,7 +119,7 @@ def generate_cyan(parser: argparse.ArgumentParser) -> None:
real_args = {k: v for k, v in dict(vars(args)).items() if v}
del real_args["output"]
for key in "fk": # these need files
for key in "fkxl": # these need files
if key in real_args:
real_args[key] = True
@@ -136,6 +148,12 @@ def generate_cyan(parser: argparse.ArgumentParser) -> None:
if args.k is not None:
zf.write(args.k, "icon.idk")
if args.l:
zf.write(args.l, "merge.plist")
if args.x:
zf.write(args.x, "new.entitlements")
if __name__ == "__main__":
main()

View File

@@ -253,6 +253,12 @@ def parse_cyan(args: dict[str, Any], tmpdir: str) -> None:
if "k" in config:
args["k"] = zf.extract("icon.idk", DOT_PATH)
del config["k"]
if "l" in config:
args["l"] = zf.extract("merge.plist", DOT_PATH)
del config["l"]
if "x" in config:
args["x"] = zf.extract("new.entitlements", DOT_PATH)
del config["x"]
for k, v in config.items():
args[k] = v

BIN
nogamemode.cyan Normal file

Binary file not shown.