Allow relaunch-docker to be run in any directory

pull/4/head
drunkendog 2023-08-25 22:51:17 +01:00
parent bf71600bec
commit 72bbffede2
1 changed files with 1 additions and 0 deletions

View File

@ -33,6 +33,7 @@ for directory in directories:
if replacement[0] == "#service":
with open(f"{directory}/relaunch-docker.sh", "w") as f:
f.write("#!/bin/sh\n")
f.write("cd \"${0%/*}\"\n")
f.write(f"docker pull $(docker inspect {replacement[1].strip()} | jq -r '.[0].Config.Image')\n")
f.write(f"docker stop {replacement[1].strip()}\n")
f.write(f"docker rm {replacement[1].strip()}\n")