diff --git a/README.md b/README.md index 8cd3662d..145b8c9e 100644 --- a/README.md +++ b/README.md @@ -57,10 +57,13 @@ currently there are two self-contained binaries: * `copyparty-sfx.sh` for unix (linux and osx) -- smaller, more robust * `copyparty-sfx.py` for windows (unix too) -- crossplatform, beta -launch either of them and it'll unpack and run copyparty, assuming you have python installed of course +launch either of them (**use sfx.py on systemd**) and it'll unpack and run copyparty, assuming you have python installed of course pls note that `copyparty-sfx.sh` will fail if you rename `copyparty-sfx.py` to `copyparty.py` and keep it in the same folder because `sys.path` is funky + +## sfx repack + if you don't need all the features you can repack the sfx and save a bunch of space; all you need is an sfx and a copy of this repo (nothing else to download or build, except for either msys2 or WSL if you're on windows) * `724K` original size as of v0.4.0 * `256K` after `./scripts/make-sfx.sh re no-ogv` diff --git a/docs/notes.sh b/docs/notes.sh index ba66ff2e..9a62fc17 100644 --- a/docs/notes.sh +++ b/docs/notes.sh @@ -113,3 +113,12 @@ function convert_markdown(md_text, dest_dom) { var end = tsh.slice(-2); console.log("render", end.pop() - end.pop(), (tsh[tsh.length - 1] - tsh[0]) / (tsh.length - 1)); } + + +## +## tmpfiles.d meme + +mk() { rm -rf /tmp/foo; sudo -u ed bash -c 'mkdir /tmp/foo; echo hi > /tmp/foo/bar'; } +mk && t0="$(date)" && while true; do date -s "$(date '+ 1 hour')"; systemd-tmpfiles --clean; ls -1 /tmp | grep foo || break; done; echo "$t0" +mk && sudo -u ed flock /tmp/foo sleep 40 & sleep 1; ps aux | grep -E 'sleep 40$' && t0="$(date)" && for n in {1..40}; do date -s "$(date '+ 1 day')"; systemd-tmpfiles --clean; ls -1 /tmp | grep foo || break; done; echo "$t0" +mk && t0="$(date)" && for n in {1..40}; do date -s "$(date '+ 1 day')"; systemd-tmpfiles --clean; ls -1 /tmp | grep foo || break; tar -cf/dev/null /tmp/foo; done; echo "$t0" diff --git a/scripts/sfx.py b/scripts/sfx.py index e5a3647e..9ed1fe32 100644 --- a/scripts/sfx.py +++ b/scripts/sfx.py @@ -426,6 +426,16 @@ def run(tmp, py): msg("will use:", py) msg("bound to:", tmp) + # "systemd-tmpfiles-clean.timer"?? HOW do you even come up with this shit + try: + import fcntl + + fd = os.open(tmp, os.O_RDONLY) + fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB) + tmp = os.readlink(tmp) # can't flock a symlink, even with O_NOFOLLOW + except: + pass + fp_py = os.path.join(tmp, "py") with open(fp_py, "wb") as f: f.write(py.encode("utf-8") + b"\n")