Deploying an ISO to Nextcloud

SergeantBiggs

system administrationlinuxarchlinuxcicddrone

348 Words

2022-06-20 09:10 +0000


I recently wrote an article on building a custom ArchLinux-based live distro with Drone. This setup has worked quite well for me, and it saved me a lot of time in the long run. There’s just one thing that bothers me about it: after it is built, the ISO is copied to an open directory. I can then download the ISO from there and flash it onto a USB. I wanted to make sure that the ISO is actually “deployed” on all of my devices after it’s built, so I don’t have to download it manually. This also removes the possibility of there being multiple versions on multiple machines, and saves me the hassle of always having to remember to download it.

I decided the best way of doing this would be via NextCloud. I have a NextCloud server, which syncs important files between my devices. This would be the perfect tool for “deploying” the new ISO to all of the devices that it is needed on.

Nextcloud has an API for their WebDAV implementation. This allows us to use WebDav operations to download, upload, and change files on the server. This is pretty much ideal for our use case. Since WebDAV is an extension of HTTP, I can use my favourite API client (curl + bash).

#!/usr/bin/env bash
USERNAME="clouduser"
FILE="spart.iso"

curl -u "${USERNAME}:${PASSWORD}" \
    https://cloud.example.com/remote.php/dav/files/clouduser/ISO/"$FILE" \
    -T "$BUILD_DIR/out/$FILE"

Our client will need a password. To provide this, we can create an Application Password in NextCloud. After generating it, we will use Drone to provide the password to our script. We don’t want to store our password in plain text, so we can use drones secret management. Secrets are defined per repository under settings -> secrets. After adding our secret, we can use it in our pipeline.

kind: pipeline
type: exec
name: default

steps:
- name: upload iso to nextcloud
  commands:
    - ./extra/upload/upload-to-nextcloud.sh
  environment:
    BUILD_DIR: /media/fast/cryptset/builds/spart
    PASSWORD:
        from_secret: nc_password

trigger:
  branch:
  - main

Drone continues to be a very useful tool, and I look forward to doing more stuff with it. I hope you enjoyed reading this article!

Articles from blogs I read

Final Fantasy 14 on macOS with a 36 key keyboard

Saving Eorzea with as few keys as possible

via Xe Iaso's blog August 24, 2025

Embedding Wren in Hare

I’ve been on the lookout for a scripting language which can be neatly embedded into Hare programs. Perhaps the obvious candidate is Lua – but I’m not particularly enthusiastic about it. When I was evaluating the landscape of tools which are “like Lua, but no…

via Drew DeVault's blog August 20, 2025

What is HDR, really?

HDR is about having more details in shadows and highlights. A higher dynamic range is one piece of the puzzle, but not all of it.

via Ξ July 18, 2025

ASG! 2025 CfP Closes Tomorrow!

The All Systems Go! 2025 Call for Participation Closes Tomorrow! The Call for Participation (CFP) for All Systems Go! 2025 will close tomorrow, on 13th of June! We’d like to invite you to submit your proposals for consideration to the CFP submission site quick…

via Pid Eins June 12, 2025

Generated by openring