61 lines
1.4 KiB
Python
61 lines
1.4 KiB
Python
|
#!/usr/bin/python
|
||
|
import sys
|
||
|
import os
|
||
|
|
||
|
def main():
|
||
|
if len(sys.argv) < 3:
|
||
|
print("Usage: script.py <output_path> <game_title>")
|
||
|
sys.exit(1)
|
||
|
|
||
|
out_path = sys.argv[1]
|
||
|
game_title = sys.argv[2]
|
||
|
game_desc = input("Enter game description: ")
|
||
|
|
||
|
safe_game_title = game_title.replace(" ", ".").lower()
|
||
|
|
||
|
print("Creating pkg structure")
|
||
|
root = os.path.join(out_path, "root")
|
||
|
os.makedirs(root, exist_ok=True)
|
||
|
|
||
|
os.makedirs(
|
||
|
os.path.join(root, "games", safe_game_title)
|
||
|
,
|
||
|
exist_ok=True
|
||
|
)
|
||
|
os.makedirs(
|
||
|
os.path.join(root, "usr", "share", "icons", safe_game_title)
|
||
|
,
|
||
|
exist_ok=True
|
||
|
)
|
||
|
|
||
|
os.makedirs(
|
||
|
os.path.join(root, "usr", "share", "applications")
|
||
|
,
|
||
|
exist_ok=True
|
||
|
)
|
||
|
|
||
|
open(
|
||
|
os.path.join(root, "usr", "share", "applications", f"{game_title}.desktop"),
|
||
|
"w"
|
||
|
).write(
|
||
|
open("./examples/wine/root/usr/share/applications/Game Title.desktop").read()
|
||
|
.replace("<GAME_TITLE>", game_title)
|
||
|
.replace("<GAME_DESC>", game_desc)
|
||
|
.replace("game.title", safe_game_title)
|
||
|
)
|
||
|
|
||
|
open(
|
||
|
os.path.join(out_path, "PKGBUILD"),
|
||
|
"w"
|
||
|
).write(
|
||
|
open("./examples/wine/PKGBUILD").read()
|
||
|
.replace("<GAME_DESC>", game_desc)
|
||
|
.replace("game.title", safe_game_title)
|
||
|
)
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
main()
|