@@ -1746,10 +1746,12 @@ def compose_systemd(compose, args):
17461746 later you can add a compose stack by running `podman-compose -a register`
17471747 then you can start/stop your stack with `systemctl --user start podman-compose@<PROJ>`
17481748 """
1749- stacks_dir = ".config/containers/compose/projects"
1749+ config_home = os .environ .get ("XDG_CONFIG_HOME" , "~/.config" )
1750+ config_home = os .path .expanduser (config_home )
1751+ stacks_dir = "containers/compose/projects"
17501752 if args .action == "register" :
17511753 proj_name = compose .project_name
1752- fn = os . path . expanduser ( f"~ /{ stacks_dir } /{ proj_name } .env")
1754+ fn = f" { config_home } /{ stacks_dir } /{ proj_name } .env"
17531755 os .makedirs (os .path .dirname (fn ), exist_ok = True )
17541756 print (f"writing [{ fn } ]: ..." )
17551757 with open (fn , "w" , encoding = "utf-8" ) as f :
@@ -1783,7 +1785,7 @@ def compose_systemd(compose, args):
17831785"""
17841786 )
17851787 elif args .action in ("list" , "ls" ):
1786- ls = glob .glob (os . path . expanduser ( f"~ /{ stacks_dir } /*.env") )
1788+ ls = glob .glob (f" { config_home } /{ stacks_dir } /*.env" )
17871789 for i in ls :
17881790 print (os .path .basename (i [:- 4 ]))
17891791 elif args .action == "create-unit" :
@@ -1796,7 +1798,7 @@ def compose_systemd(compose, args):
17961798
17971799[Service]
17981800Type=simple
1799- EnvironmentFile=%h /{ stacks_dir } /%i.env
1801+ EnvironmentFile=%E /{ stacks_dir } /%i.env
18001802ExecStartPre=-{ script } up --no-start
18011803ExecStartPre=/usr/bin/podman pod start pod_%i
18021804ExecStart={ script } wait
0 commit comments