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

What's up with FUTO?

Some time ago, I noticed some new organization called FUTO popping up here and there. I’m always interested in seeing new organizations that fund open source popping up, and seeing as they claim several notable projects on their roster, I explored their webs…

via Drew DeVault's blog October 22, 2025

First look at the DGX Spark

A local supercomputer between the size of a Mac mini and a Mac mini.

via Xe Iaso's blog October 14, 2025

How to Sandbox a Terminal

I often pull code from remote repositories and execute it for testing. This is an area where sandboxing would be extremely beneficial.

via Ξ October 11, 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