image: registry.opensuse.org/opensuse/leap:15.4


prelude:
- zypper in -y wget cpio

steps:
{{if eq .Values.name "odroid-c2"}}
- mkdir -p /data/boot
- wget https://download.opensuse.org/repositories/devel:/ARM:/Factory:/Contrib:/OdroidC2/standard/aarch64/odroidc2-firmware-{{.Values.version}}.aarch64.rpm
- rpm2cpio odroidc2-firmware-{{.Values.version}}.aarch64.rpm | cpio -idmv
- mv boot/* /data/boot
package_dir: "/data/boot"
{{end}}

{{if eq .Values.name "u-boot-rpi64"}}
- mkdir -p /data/{boot,usr}
- PACKAGE_VERSION=${PACKAGE_VERSION%\+*} && wget https://download.opensuse.org/ports/aarch64/tumbleweed/repo/oss/aarch64/u-boot-rpiarm64-$PACKAGE_VERSION.aarch64.rpm
- PACKAGE_VERSION=${PACKAGE_VERSION%\+*} && rpm2cpio u-boot-rpiarm64-$PACKAGE_VERSION.aarch64.rpm | cpio -idmv
- mv usr/share/doc /data
- mv usr/share/licenses /data
- mv usr/* /data
- mv boot/vc/* /data
- rm -rf /data/boot
- rm -rf /data/usr
- rm -rf /data/share
package_dir: "/data"
{{end}}

{{if or (eq .Values.name "raspberrypi-firmware") (eq .Values.name
"raspberrypi-firmware-config") (eq .Values.name "raspberrypi-firmware-dt")}}
- mkdir -p /data/boot
- mkdir -p /data/usr
- PACKAGE_VERSION=${PACKAGE_VERSION%\+*} && wget -c https://download.opensuse.org/ports/aarch64/tumbleweed/repo/oss/noarch/{{.Values.name}}-$PACKAGE_VERSION.noarch.rpm
- PACKAGE_VERSION=${PACKAGE_VERSION%\+*} && rpm2cpio {{.Values.name}}-$PACKAGE_VERSION.noarch.rpm | cpio -idmv
{{if or (eq .Values.name "raspberrypi-firmware")}}
- mv usr/* /data
- rm -rfv /data/lib
{{end}}
- mv boot/vc/* /data
- rm -rfv /data/boot
- rm -rfv /data/usr
package_dir: "/data"
{{end}}
