xblax / flashforge_ad5m_klipper_mod

Unoffical mod for Flashforge Adventurer 5M (Pro) 3D printers to run Moonraker, custom Klipper, Mainsail & Fluidd
GNU General Public License v3.0
180 stars 15 forks source link

Add Klipper-Backup to image #51

Open jtenniswood opened 8 months ago

jtenniswood commented 8 months ago

Just wondering if it's possible to include Klipper Backup, as I've found it's really valuable in case of issue to have your config backed up to git. https://staubgeborener.github.io/klipper-backup/

I've tried installing it but the script won't work, I'm sure it's something simple and unique about this environment that I can't figure out. Thanks!

KaruroChori commented 8 months ago

To fit within the limitations of the SOC, we cannot run a full debian-based system, so you will find most of the arbitrary software you might want to run will not, even if compiled for this platform. Unless you are statically compiling a self-contained piece of software, using standard posix features at best, incompatibility is the likely outcome.

The distribution provided in this mod is extremely limited compared to a more typical desktop linux environment. In order to support that tool there are probably some services and dependencies missing.

consp commented 8 months ago

It only uses git and bash, I suspect the latter is the problem. I'll have a look.

It's definately bash. The script uses some bash magic which is not available in ash (the shell). You'd have to rewrite it to be ash compatible. I also suspect it won't work in zsh but haven't tried it.

Maybe you can ask the original author if it would be possible to create a shell independent script (so only sh-compatible and test) or go wild and create a fork.

xblax commented 8 months ago

I think that these kind of features are probably to use-case specific to integrate them directly into the mod, because they could never be active as default. As was written above, the mod does not have Bash, Apt, Systemd etc due to being an embedded Linux.

But in theory, the mod already includes all the necessary tools to implement such a feature (especially Git) and the G-Code shell extension could be useful as well. It should not be too difficult to build something around that and ideally maintain that in separate Github repo. We can maybe create a list of separately maintained mod extensions, that can be installed if needed.

jtenniswood commented 8 months ago

I ended up working with ChatGPT to write this script...

REDACTED

I used the existing tools the original script creates for making the ability to start a script and setup a macro. I'm VERY far from being a developer, so this is just to help anyone else that might want to do something similar in the future (or if the team want to integrate something similar into a release).

Never mind, I removed the upload folder and it didn't work from a fresh setup, must have been dumb luck the first time!

consp commented 8 months ago

If it works, it works :)

<rant>

You are not a developer so don't take this the wrong way but ...

Script will probably work for you. Though I have a distinct hate for ChatGPT created bloat since it is never does anything properly and regurgitates bad behaviour from whatever trained it (garbadge in, garbage out, or gpl violations, that's also possible).

git --git-dir="$GIT_DIR" --work-tree="$UPLOAD_DIR" init > /dev/null

Will error after the first time, doing output redirection to devnull is not desirable fault tollerance behaviour since everything else depends on this working. Should exit 1.

git --git-dir="$GIT_DIR" --work-tree="$UPLOAD_DIR" remote add origin "$REMOTE_REPO_URL" > /dev/null

Will not detect invalid repo's and error every time after it has been done once.

git --git-dir="$GIT_DIR" --work-tree="$UPLOAD_DIR" remote set-url origin "$REMOTE_REPO_URL" > /dev/null

Why on earth did it add, and then set again. It's simply ignoring errors and hoping for the best.

git --git-dir="$GIT_DIR" --work-tree="$UPLOAD_DIR" push -f origin master

Why on earth should it force push.

This script should have a setup phase and an upload phase. The first one should be triggered only once.

</rant>

jtenniswood commented 8 months ago

Lol, spot on! Let's hope it channels enough anger for someone to fix it. I found it funny that it just apologizes for every problem, it's like dealing with a useless waiter.

On Sun, 17 Mar 2024, 11:56 Tristan, @.***> wrote:

Script will probably work for you, but I have a distinct hate for ChatGPT created bloat since it is never done properly and regurgitates bad behaviour. git --git-dir="$GIT_DIR" --work-tree="$UPLOAD_DIR" init > /dev/null Will error after the first time, doing output redirection to devnull is not desirable fault tollerance behaviour since everything else depends on this working. Should exit 1. git --git-dir="$GIT_DIR" --work-tree="$UPLOAD_DIR" remote add origin "$REMOTE_REPO_URL" > /dev/null Will not detect invalid repo's and error every time after it has been done once. git --git-dir="$GIT_DIR" --work-tree="$UPLOAD_DIR" remote set-url origin "$REMOTE_REPO_URL" > /dev/null Why on earth did it add, and then set again. It's simply ignoring errors and hoping for the best. git --git-dir="$GIT_DIR" --work-tree="$UPLOAD_DIR" push -f origin master Why on earth should it force push. This script should have a setup phase and an upload phase. The first one should be triggered only once.

— Reply to this email directly, view it on GitHub https://github.com/xblax/flashforge_adm5_klipper_mod/issues/51#issuecomment-2002429041, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACTAUBK2BMMG25W6NDK5FGDYYWAHTAVCNFSM6AAAAABESB52LGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBSGQZDSMBUGE . You are receiving this because you authored the thread.Message ID: @.***>