-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Old-style single zfs-autobackup executable #83
Comments
Thats indeed a nice tool. I'll try to figure out if i can generate it automatically for each release via github, so we can have a direct-download link in the github release-page. |
Note: We've been using PyInstaller for similar reasons; it builds a single executable with no external dependencies as PyInstaller also packages the Python interpreter and all its libraries into a single file.
I'm running zfs-autobackup in a SmartOS global zone where Python is not available, thus having a single binary works great here: I build Since SmartOS is listed in the README already and by default it doesn't have Python available in it's global zone (which is often where While it's possible to distribute these binaries, since these are platform-specific (different from the |
@DvdGiessen yes i think its a good idea to add documentation for that. However this is different from the zipapp method mentioned above: pyinstaller will actually create a binary which can only be used on the platform it was created on. So indeed we can not generate that automaticly via a github action. I myself actually went the lazy way and just installed python in the global zone:
|
@lciti i get this:
|
If i change some stuff and remove all the "zfs_autobackup." prefixes from the imports it works, but then it wont function as a proper python module anymore..sigh.. If somebody knows how to do this properly let me know. |
I think its this problem: https://bugs.python.org/issue26277 |
I wasted several hours on this. If someone wants to fix it, create a PR. I cant get it so that zfs_autobackup is both a standaard python 2 and 3 module, AND functions in zipapp. (without ugly hacks like a search/replace over the sourcecode or something like that) |
Hi psy0rz |
I tried your changes to no avail:
I'll try upgrading and on another system. Maybe its something local. |
I've made the wrong assumption that the directory structure would be temp/.py |
There's also Nuitka |
Any news on this ? I don't have (and don't want to install) pip or easy_install on the host where I use zfs-autobackup (as it's a minimal OS with only LXD container doing the real jobs), for now I use the version 3.0 but I'd like to update at some point. |
Sorry no news yet, first have to finish zfs-autoverify/zfs-check, after that i'll look into it. @neodc what if you create a venv outside the container and use that inside the container? |
@neodc Have you tried my instructions in the first post? It's manual process (rather than automatically triggered after each git update) but should do what you need and it's literally 4 instructions (after you have downloaded and unzipped the repo). |
First, sorry for the (huge) delay. I'm starting to get warning and error since I updated to Ubuntu 22.04 so I tried to use your recommendations to update. @psy0rz From what I can see the venv hard code the path of where it was generated, so that would not work I think. @lciti The zipapp command give me a not functional bin, when I run it (the created bin) I get an error (see all the command I used bellow). I suppose the
|
@neodc The code has been slightly restructured from the time when I wrote my initial post. The instructions required are now:
|
Looks like it's working with this (at least I get the version string even after scp it to to destination server), but then I was on version 3.2-beta1, I don't like the idea of using beta version for my backup so I checkout the v3.1.3 tag and could "compile" using the original version. Thanks for the help |
3.2-beta1 will be released soon, its safe to use. :) Edwin |
I set it up this weekend on 3.1.3 and it work perfectly now, so I don't see any reason to rush to a beta version =) |
yep, no if it works then keep it that way :) |
Please be aware that the main branch can be broken at times. It is safer to checkout the newest tag with: git clone --branch <tag_name> 'https://github.com/psy0rz/zfs_autobackup.git' |
Until recently,
zfs-autobackup
was a single python script that could be easily moved around, e.g. copied into/usr/local/bin
and executed from there. The code has now been reorganised and split into several python files. This makes the code easier to understand, maintain, and reuse. The normal way to install the tool is now to usepip
oreasy_install
, which install it in the standard python modules folders. However, in some cases one may prefer the old-style single-file approach. This can still be easily obtained thanks to the zipapp module.One only needs to
cd
into the root folder of this repository (either obtained usinggit
or downloaded as a zip file) and run the following:This produces a
zfs-autobackup
file that can be executed directly from the shell (as./zfs-autobackup
or aszfs-autobackup
if installed in aPATH
folder such as/usr/local/bin
).If @psy0rz and the other users find this useful, it can be added to the
script
folder or to the documentation.Edit Sept 2022: The zfs_autobackup code has been slight restructured since I wrote this post and the
cli
function is now underzfs_autobackup.ZfsAutobackup
. See my comment below for updated instructions.The text was updated successfully, but these errors were encountered: