-
Notifications
You must be signed in to change notification settings - Fork 2
/
branding.sh
executable file
·63 lines (56 loc) · 1.96 KB
/
branding.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/bash
set ${SET_X:+-x} -eou pipefail
if [[ "${IMAGE}" =~ cosmic|ucore ]]; then
tee /usr/share/ublue-os/image-info.json <<'EOF'
{
"image-name": "",
"image-flavor": "",
"image-vendor": "m2giles",
"image-ref": "ostree-image-signed:docker://ghcr.io/m2giles/m2os",
"image-tag": "",
"base-image-name": "",
"fedora-version": ""
}
EOF
fi
case "${IMAGE}" in
"bazzite"*|"bluefin"*)
base_image="silverblue"
;;
"aurora"*)
base_image="kinoite"
;;
"cosmic"*)
base_image="${BASE_IMAGE}"
;;
"ucore"*)
base_image="${BASE_IMAGE}"
;;
esac
image_flavor="main"
if [[ "$IMAGE" =~ nvidia ]]; then
image_flavor="nvidia"
fi
# Branding
cat <<<"$(jq ".\"image-name\" |= \"m2os\" |
.\"image-flavor\" |= \"${image_flavor}\" |
.\"image-vendor\" |= \"m2giles\" |
.\"image-ref\" |= \"ostree-image-signed:docker://ghcr.io/m2giles/m2os\" |
.\"image-tag\" |= \"${IMAGE}${BETA:-}\" |
.\"base-image-name\" |= \"${base_image}\" |
.\"fedora-version\" |= \"$(rpm -E %fedora)\"" \
</usr/share/ublue-os/image-info.json)" \
>/tmp/image-info.json
cp /tmp/image-info.json /usr/share/ublue-os/image-info.json
if [[ "$IMAGE" =~ bazzite ]]; then
sed -i 's/image-branch/image-tag/' /usr/libexec/bazzite-fetch-image
fi
# OS Release File for Cosmic
if [[ "$IMAGE" =~ cosmic ]]; then
sed -i "s/^VARIANT_ID=.*/VARIANT_ID=cosmic/" /usr/lib/os-release
sed -i "s/^PRETTY_NAME=.*/PRETTY_NAME=\"Cosmic-Atomic $(rpm -E %fedora) (FROM Fedora ${BASE_IMAGE^})\"/" /usr/lib/os-release
sed -i "s/^NAME=.*/NAME=\"Cosmic Atomic\"/" /usr/lib/os-release
sed -i "s/^DEFAULT_HOSTNAME=.*/DEFAULT_HOSTNAME=\"cosmic-atomic\"/" /usr/lib/os-release
sed -i "s/^ID=fedora/ID=cosmic-atomic\nID_LIKE=\"fedora\"/" /usr/lib/os-release
sed -i "/^REDHAT_BUGZILLA_PRODUCT=/d; /^REDHAT_BUGZILLA_PRODUCT_VERSION=/d; /^REDHAT_SUPPORT_PRODUCT=/d; /^REDHAT_SUPPORT_PRODUCT_VERSION=/d" /usr/lib/os-release
fi