Direct path to wrapped fusermount

This commit is contained in:
zuckerberg 2021-10-02 17:23:42 -04:00
parent 544b090b58
commit b9b050fec1

View File

@ -90,13 +90,16 @@ def mountTorrent(magnet):
print("mounting torrent...") print("mounting torrent...")
umountTorrent() umountTorrent()
os.mkdir(fuseTorrentLocation) os.mkdir(fuseTorrentLocation)
env = dict(os.environ)
env["PATH"] = "/run/wrappers/bin:" + env["PATH"]
o = subprocess.Popen([ o = subprocess.Popen([
"btfs", "btfs",
"-o", "auto_unmount", # unmount if process is killed "-o", "auto_unmount", # unmount if process is killed
"-o", "allow_other",
"--data-directory=" + btfsDataLocation, "--data-directory=" + btfsDataLocation,
magnet, magnet,
fuseTorrentLocation fuseTorrentLocation,
env=env
]) ])
o.communicate() # wait for it to finish o.communicate() # wait for it to finish
sleep(5) # uhhh I guess I need to sleep? sleep(5) # uhhh I guess I need to sleep?
@ -104,9 +107,12 @@ def mountTorrent(magnet):
def umountTorrent(): def umountTorrent():
print("unmounting torrent...") print("unmounting torrent...")
if os.path.isdir(fuseTorrentLocation): if os.path.isdir(fuseTorrentLocation):
env = dict(os.environ)
env["PATH"] = "/run/wrappers/bin:" + env["PATH"]
o = subprocess.Popen([ o = subprocess.Popen([
"fusermount", "fusermount",
"-u", fuseTorrentLocation "-u", fuseTorrentLocation,
env=env
]) ])
o.communicate() # wait for it to finish o.communicate() # wait for it to finish
os.rmdir(fuseTorrentLocation) os.rmdir(fuseTorrentLocation)