autorestic icon indicating copy to clipboard operation
autorestic copied to clipboard

Build for Windows

Open chrisx8 opened this issue 3 years ago • 20 comments

Hi there! I noticed restic has a Windows binary but autorestic doesn't, so I thought I'd modify the build script to build Windows (32 and 64-bit) binaries. Here are some things I changed:

  • Add Windows (32 and 64-bit) to build targets
  • File names of Windows binaries has the required exe extension
  • Use zip compression for Windows, as Windows systems can't decompress bzip2 archives without 3rd-party programs. Code is heavily inspired by restic's build script :)
  • Configure the GitHub Actions workflow to only release bzip2 and zip files.

Releases are still created the same way with the Actions workflow, and now include Windows binaries.

Edit: I did some basic testing (local backup/restore a test directory) on my Windows machine (running Windows 10 20H2, 64bit) and it seems to work well.

chrisx8 avatar Apr 29 '21 18:04 chrisx8

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/cupcakearmy/autorestic/F3PL2GemunCGxGXfTFhTe8qUJZz9
✅ Preview: https://autorestic-git-fork-chrisx8-master-cupcakearmy.vercel.app

vercel[bot] avatar Apr 29 '21 18:04 vercel[bot]

Thank you very much! I'll need to test some stuff out, like all the path stuff https://github.com/cupcakearmy/autorestic/blob/c9f425ef643f7bc363a890482f41639a83eb1430/internal/bins/bins.go#L21 but would be great to have support for that.

cupcakearmy avatar Apr 30 '21 08:04 cupcakearmy

Also the install script would need some love.

cupcakearmy avatar Apr 30 '21 08:04 cupcakearmy

Local backup seems to work fine. In the config file (.autorestic.yml), just specify paths like one usually do on Windows (like D:\backup\restic1) would work. I haven't tested any remote backup targets though.

The self-upgrade function probably would be broken in many ways. I'll take a look when I have some more time.

chrisx8 avatar Apr 30 '21 14:04 chrisx8

If you want you can work on it, otherwise I can do that too, but not before tuesday as I have quite some stuff to do :)

cupcakearmy avatar Apr 30 '21 15:04 cupcakearmy

Hi,

Thanks for your hard work, is there any ETA for when this become avaliable officially?

arabcoders avatar Dec 05 '21 09:12 arabcoders

Hi,

Thanks for your hard work, is there any ETA for when this become avaliable officially?

I don't have much time to mantain another OS unfortunately :/ So at least for now no official meta. But you could use the docker image.

cupcakearmy avatar Dec 06 '21 16:12 cupcakearmy

This looks very promising! I glanced at the changed files and there's little change to autorestic itself. Could we summarize a list of potentially broken functions in Windows?

cqjjjzr avatar Dec 20 '21 16:12 cqjjjzr

As far as I know, everything except install and upgrade should be working just fine. Seems like install and upgrade assume a UNIX-like environment.

Edit: @cqjjjzr, I have compiled Windows binaries available in my fork. Feel free to try it out and tell us what you find!

chrisx8 avatar Dec 20 '21 22:12 chrisx8

As far as I know, everything except install and upgrade should be working just fine. Seems like install and upgrade assume a UNIX-like environment.

Edit: @cqjjjzr, I have compiled Windows binaries available in my fork. Feel free to try it out and tell us what you find!

it seems to be working fine so far haven't noticed any bugs

arabcoders avatar Dec 21 '21 11:12 arabcoders

@ArabCoders @chrisx8 Super cool, would give it a try once my backends are ready!

cqjjjzr avatar Dec 21 '21 15:12 cqjjjzr

Nice that a lot of people are interessed! About https://github.com/cupcakearmy/autorestic/pull/68/files#diff-7fdd319c657fbde54b83a5dfa233c5c2c417b291739ff75c05dc5d83ee7a9d24R68 : is zip preinstalled on windows?

Also we would need to figure out upgrade and install scripts

cupcakearmy avatar Dec 22 '21 09:12 cupcakearmy

is zip preinstalled on windows

Not really. However, we have tar.exe and Compress-Archive Powershell cmdlet. How about these?

cqjjjzr avatar Dec 22 '21 10:12 cqjjjzr

One more question, I'm planning to test out if Ctrl+C works normally on Windows. Ideally, it should send SIGINT to the underlying restic process so it can clean up and exit gracefully, so I need to do some tests.

More Information: https://docs.microsoft.com/en-us/windows/console/ctrl-c-and-ctrl-break-signals

cqjjjzr avatar Dec 22 '21 10:12 cqjjjzr

is zip preinstalled on windows?

Windows File Explorer can open and create zip archives. There's also Expand-Archive in PowerShell. Both options are built in to Windows, which is why I packaged Windows releases as zip.

chrisx8 avatar Dec 22 '21 14:12 chrisx8

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
autorestic ✅ Ready (Inspect) Visit Preview May 3, 2022 at 2:09AM (UTC)

vercel[bot] avatar May 03 '22 02:05 vercel[bot]

@cupcakearmy any chance of getting this merged into main build?

arabcoders avatar Aug 07 '22 17:08 arabcoders

Hi, I'd love to see this get merged as well!

shahvirb avatar Feb 25 '23 15:02 shahvirb

Still no windows build?

bluewalk avatar Jul 12 '23 05:07 bluewalk

Hooks probably need a little work to support Windows as the default shell and its flags should be probably at least manually configurable via config, if not auto detected. That change should benefit other OS' as well.

ljani avatar Jul 13 '23 06:07 ljani