Skip to content

Commit 0a1e579

Browse files
committed
feat(bootc): Add support for new package managers
This goes hand in hand with the new modules created in blue-build/modules#523
1 parent 054baa8 commit 0a1e579

File tree

4 files changed

+73
-37
lines changed

4 files changed

+73
-37
lines changed

integration-tests/test-repo/recipes/common.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ modules:
7373
from: fedora-test
7474
src: /test.txt
7575
dest: /
76+
- type: copy
77+
from: arch-test
78+
src: /test.txt
79+
dest: /
80+
- type: copy
81+
from: suse-test
82+
src: /test.txt
83+
dest: /
7684

7785
# Testing secrets
7886
- type: script

integration-tests/test-repo/recipes/stages.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,55 @@ stages:
55
from: ubuntu
66
modules:
77
- from-file: stages.yml
8+
- type: apt
9+
source: ghcr.io/blue-build/modules/apt:pr-523
10+
install:
11+
packages:
12+
- git
813
- name: debian-test
914
from: debian
1015
modules:
1116
- from-file: stages.yml
17+
- type: apt
18+
source: ghcr.io/blue-build/modules/apt:pr-523
19+
install:
20+
packages:
21+
- git
1222
- name: fedora-test
1323
from: fedora
1424
modules:
1525
- from-file: stages.yml
26+
- type: dnf
27+
install:
28+
packages:
29+
- git
1630
- name: alpine-test
1731
from: alpine
1832
modules:
1933
- from-file: stages.yml
34+
- type: apk
35+
source: ghcr.io/blue-build/modules/apk:pr-523
36+
install:
37+
packages:
38+
- git
39+
- name: arch-test
40+
from: archlinux/archlinux
41+
modules:
42+
- from-file: stages.yml
43+
- type: pacman
44+
source: ghcr.io/blue-build/modules/pacman:pr-523
45+
install:
46+
packages:
47+
- git
48+
- name: suse-test
49+
from: opensuse/tumbleweed
50+
modules:
51+
- from-file: stages.yml
52+
- type: zypper
53+
source: ghcr.io/blue-build/modules/zypper:pr-523
54+
install:
55+
packages:
56+
- git
2057
modules:
2158
- type: files
2259
files:

scripts/pre_build.sh

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
#!/usr/bin/env bash
1+
#!/bin/sh
22

3-
set -euo pipefail
3+
set -eu
44

5-
if ! command -v jq > /dev/null; then
6-
if command -v rpm-ostree > /dev/null; then
7-
rpm-ostree install jq
8-
else
9-
dnf -y install jq
10-
fi
11-
fi
5+
/scripts/setup.sh
126

137
optfix_dir="/usr/lib/opt"
148

scripts/setup.sh

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
11
#!/bin/sh
22

3-
if [ -f /etc/os-release ]; then
4-
# Initialize variable to store the ID
5-
ID=""
6-
7-
# Read the /etc/os-release file line by line
8-
while IFS== read -r key value; do
9-
# Check if the key is 'ID'
10-
if [ "$key" = "ID" ]; then
11-
# Remove any quotes from the value and store it in id variable
12-
ID=$(echo "$value" | tr -d '"')
13-
break
14-
fi
15-
done < /etc/os-release
16-
17-
if [ "$ID" = "alpine" ]; then
18-
echo "Setting up Alpine based image to run BlueBuild modules"
19-
apk update
20-
apk add --no-cache bash curl coreutils wget grep jq
21-
elif [ "$ID" = "ubuntu" ] || [ "$ID" = "debian" ]; then
22-
echo "Setting up Ubuntu based image to run BlueBuild modules"
23-
export DEBIAN_FRONTEND=noninteractive
3+
# TODO: Remove once we're all POSIX https://github.com/blue-build/modules/issues/503
4+
if [ -x /usr/bin/dnf5 ] \
5+
|| [ -x /bin/dnf5 ] \
6+
|| [ -x /sbin/dnf5 ]; then
7+
dnf5 -y install bash curl wget coreutils jq grep
8+
elif [ -x /usr/bin/dnf4 ] \
9+
|| [ -x /bin/dnf4 ] \
10+
|| [ -x /sbin/dnf4 ]; then
11+
dnf4 -y install bash curl wget coreutils jq grep
12+
elif [ -x /usr/bin/zypper ] \
13+
|| [ -x /bin/zypper ] \
14+
|| [ -x /sbin/zypper ]; then
15+
zypper --non-interactive install --auto-agree-with-licenses bash curl wget coreutils jq grep find
16+
elif [ -x /usr/bin/pacman ] \
17+
|| [ -x /bin/pacman ] \
18+
|| [ -x /sbin/pacman ]; then
19+
pacman --sync --noconfirm --refresh --sysupgrade bash curl wget coreutils jq grep
20+
elif [ -x /usr/bin/apt-get ] \
21+
|| [ -x /bin/apt-get ] \
22+
|| [ -x /sbin/apt-get ]; then
2423
apt-get update
25-
apt-get install -y bash curl coreutils wget jq
26-
elif [ "$ID" = "fedora" ]; then
27-
echo "Settig up Fedora based image to run BlueBuild modules"
28-
dnf install -y --refresh bash curl wget coreutils jq
29-
else
30-
echo "OS not detected, proceeding without setup"
31-
fi
24+
DEBIAN_FRONTEND=noninteractive apt-get -y install bash curl wget coreutils jq grep
25+
elif [ -x /usr/bin/apk ] \
26+
|| [ -x /bin/apk ] \
27+
|| [ -x /sbin/apk ]; then
28+
apk add --no-cache bash curl coreutils wget grep jq
3229
fi

0 commit comments

Comments
 (0)