Skip to content

Commit

Permalink
feat: install packages from ublue-os/main (#8)
Browse files Browse the repository at this point in the history
* feat: install packages from ublue-os/main

* fix: update script desktop flag

* fix: add rpmfusion and oversteer repos

* fix: ignore updates-archive repo

* fix: escape variables in 002-repos.sh

* fix: add and cleanup ublue-os/staging repo

* fix: install packages with dnf

* fix: specify -y when installing packages with dnf
  • Loading branch information
p5 authored Aug 18, 2024
1 parent ae3787a commit c95299d
Show file tree
Hide file tree
Showing 7 changed files with 363 additions and 22 deletions.
5 changes: 3 additions & 2 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ ARG FEDORA_VERSION
ARG FEDORA_EDITION

COPY scripts/ /tmp/scripts
COPY packages.json /tmp/packages.json

RUN chmod +x /tmp/scripts/*.sh /tmp/scripts/_${FEDORA_EDITION}/*.sh && \
/tmp/scripts/setup.sh --version ${FEDORA_VERSION} --base ${FEDORA_EDITION} && \
/tmp/scripts/cleanup.sh --version ${FEDORA_VERSION} --base ${FEDORA_EDITION}
/tmp/scripts/setup.sh --version ${FEDORA_VERSION} --desktop ${FEDORA_EDITION} && \
/tmp/scripts/cleanup.sh --version ${FEDORA_VERSION} --desktop ${FEDORA_EDITION}
231 changes: 231 additions & 0 deletions packages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
{
"all": {
"include": {
"all": [
"alsa-firmware",
"android-udev-rules",
"apr",
"apr-util",
"distrobox",
"ffmpeg",
"ffmpeg-libs",
"ffmpegthumbnailer",
"flatpak-spawn",
"fzf",
"google-noto-sans-balinese-fonts",
"google-noto-sans-cjk-fonts",
"google-noto-sans-javanese-fonts",
"google-noto-sans-sundanese-fonts",
"grub2-tools-extra",
"heif-pixbuf-loader",
"htop",
"intel-media-driver",
"just",
"kernel-tools",
"libcamera",
"libcamera-tools",
"libcamera-gstreamer",
"libcamera-ipa",
"libheif-freeworld",
"libheif-tools",
"libratbag-ratbagd",
"libva-intel-driver",
"libva-utils",
"lshw",
"mesa-va-drivers-freeworld.x86_64",
"net-tools",
"nvme-cli",
"nvtop",
"openrgb-udev-rules",
"openssl",
"oversteer-udev",
"pam-u2f",
"pam_yubico",
"pamu2fcfg",
"pipewire-codec-aptx",
"pipewire-plugin-libcamera",
"powerstat",
"smartmontools",
"solaar-udev",
"squashfs-tools",
"symlinks",
"tcpdump",
"tmux",
"traceroute",
"vim",
"wireguard-tools",
"zstd"
],
"silverblue": [
"adw-gtk3-theme",
"gnome-epub-thumbnailer",
"gnome-tweaks",
"gvfs-nfs"
],
"kinoite": [
"icoutils",
"kate",
"kcron",
"kio-admin",
"ksshaskpass"
],
"mate": [
"NetworkManager-adsl",
"NetworkManager-openconnect-gnome",
"NetworkManager-openvpn-gnome",
"NetworkManager-ppp",
"NetworkManager-pptp-gnome",
"NetworkManager-ssh-gnome",
"NetworkManager-vpnc-gnome",
"NetworkManager-wwan",
"atril",
"atril-caja",
"atril-thumbnailer",
"blueman",
"caja",
"caja-actions",
"caja-image-converter",
"caja-open-terminal",
"caja-sendto",
"caja-wallpaper",
"caja-xattr-tags",
"dconf-editor",
"engrampa",
"eom",
"fedora-release-matecompiz",
"firefox",
"firewall-config",
"gnome-epub-thumbnailer",
"gnome-themes-extra",
"gstreamer1-plugins-ugly-free",
"gtk2-engines",
"gucharmap",
"gvfs-afc",
"gvfs-afp",
"gvfs-archive",
"gvfs-fuse",
"gvfs-gphoto2",
"gvfs-mtp",
"gvfs-nfs",
"gvfs-smb",
"initial-setup-gui",
"libmatekbd",
"libmatemixer",
"libmateweather",
"libsecret",
"lightdm",
"lm_sensors",
"marco",
"mate-applets",
"mate-backgrounds",
"mate-calc",
"mate-control-center",
"mate-desktop-configs",
"mate-dictionary",
"mate-disk-usage-analyzer",
"mate-icon-theme",
"mate-media",
"mate-menus",
"mate-menus-preferences-category-menu",
"mate-notification-daemon",
"mate-panel",
"mate-polkit",
"mate-power-manager",
"mate-screensaver",
"mate-screenshot",
"mate-search-tool",
"mate-session-manager",
"mate-settings-daemon",
"mate-system-log",
"mate-system-monitor",
"mate-terminal",
"mate-themes",
"mate-user-admin",
"mate-user-guide",
"mozo",
"network-manager-applet",
"nm-connection-editor",
"orca",
"parole",
"pavucontrol",
"pipewire-alsa",
"pipewire-pulseaudio",
"pluma",
"seahorse",
"seahorse-caja",
"setroubleshoot",
"slick-greeter-mate",
"system-config-language",
"system-config-printer",
"system-config-printer-applet",
"usermode-gtk",
"xdg-desktop-portal-gtk",
"xdg-user-dirs-gtk",
"xmodmap",
"xrdb"
],
"sericea": [
"clipman",
"gvfs-mtp",
"thunar-volman",
"tumbler"
],
"vauxite": [
"xfce4-clipman-plugin",
"xfce4-whiskermenu-plugin"
]
},
"exclude": {
"all": [
"ffmpeg-free",
"google-noto-sans-cjk-vf-fonts",
"libavcodec-free",
"libavdevice-free",
"libavfilter-free",
"libavformat-free",
"libavutil-free",
"libpostproc-free",
"libswresample-free",
"libswscale-free",
"mesa-va-drivers"
],
"kinoite": [
"ffmpegthumbnailer",
"plasma-discover-rpm-ostree"
],
"mate": [
"python3-unbound",
"systemd-oomd-defaults"
]
}
},
"39": {
"include": {
"all": [
"bootc"
],
"kinoite": [
"xwaylandvideobridge"
]
},
"exclude": {
"all": [
"default-fonts-cjk-sans"
]
}
},
"40": {
"include": {
"all": [],
"kinoite": [
"kf6-kimageformats",
"qt6-qtimageformats"
]
},
"exclude": {
"all": [
"default-fonts-cjk-sans"
]
}
}
}
12 changes: 0 additions & 12 deletions scripts/_base/002-ostree.sh

This file was deleted.

42 changes: 42 additions & 0 deletions scripts/_base/002-repos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash

set -euox pipefail

# Setup RPMFusion repositories
rpm-ostree install \
https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

rpm-ostree install \
rpmfusion-nonfree-release \
rpmfusion-free-release \
--uninstall=rpmfusion-free-release-$(rpm -E %fedora)-1.noarch \
--uninstall=rpmfusion-nonfree-release-$(rpm -E %fedora)-1.noarch

sed -i 's@enabled=0@enabled=1@g' /etc/yum.repos.d/fedora-cisco-openh264.repo

cat << EOF > /etc/yum.repos.d/kylegospo-oversteer.repo
[copr:copr.fedorainfracloud.org:kylegospo:oversteer]
name=Copr repo for oversteer owned by kylegospo
baseurl=https://download.copr.fedorainfracloud.org/results/kylegospo/oversteer/fedora-\$releasever-\$basearch/
type=rpm-md
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://download.copr.fedorainfracloud.org/results/kylegospo/oversteer/pubkey.gpg
repo_gpgcheck=0
enabled=1
enabled_metadata=1
EOF

cat << EOF > /etc/yum.repos.d/ublue-os-staging.repo
[copr:copr.fedorainfracloud.org:ublue-os:staging]
name=Copr repo for staging owned by ublue-os
baseurl=https://download.copr.fedorainfracloud.org/results/ublue-os/staging/fedora-\$releasever-\$basearch/
type=rpm-md
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://download.copr.fedorainfracloud.org/results/ublue-os/staging/pubkey.gpg
repo_gpgcheck=0
enabled=1
enabled_metadata=1
EOF
72 changes: 72 additions & 0 deletions scripts/_base/003-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env bash

set -euox pipefail

DESKTOP_ENVIRONMENT=""
FEDORA_VERSION=""

while [[ $# -gt 0 ]]; do
case "$1" in
--desktop)
DESKTOP_ENVIRONMENT="$2"
shift 2
;;
--version)
FEDORA_VERSION="$2"
shift 2
;;
*)
echo "Unknown argument: $1"
exit 1
;;
esac
done

if [[ -z "$DESKTOP_ENVIRONMENT" ]]; then
echo "--desktop flag is required"
exit 1
fi

if [[ -z "$FEDORA_VERSION" ]]; then
echo "--version flag is required"
exit 1
fi

# build list of all packages requested for inclusion
INCLUDED_PACKAGES=($(jq -r "[(.all.include | (.all, select(.\"$DESKTOP_ENVIRONMENT\" != null).\"$DESKTOP_ENVIRONMENT\")[]), \
(select(.\"$FEDORA_VERSION\" != null).\"$FEDORA_VERSION\".include | (.all, select(.\"$DESKTOP_ENVIRONMENT\" != null).\"$DESKTOP_ENVIRONMENT\")[])] \
| sort | unique[]" /tmp/packages.json))

# build list of all packages requested for exclusion
EXCLUDED_PACKAGES=($(jq -r "[(.all.exclude | (.all, select(.\"$DESKTOP_ENVIRONMENT\" != null).\"$DESKTOP_ENVIRONMENT\")[]), \
(select(.\"$FEDORA_VERSION\" != null).\"$FEDORA_VERSION\".exclude | (.all, select(.\"$DESKTOP_ENVIRONMENT\" != null).\"$DESKTOP_ENVIRONMENT\")[])] \
| sort | unique[]" /tmp/packages.json))


# ensure exclusion list only contains packages already present on image
if [[ "${#EXCLUDED_PACKAGES[@]}" -gt 0 ]]; then
EXCLUDED_PACKAGES=($(rpm -qa --queryformat='%{NAME} ' ${EXCLUDED_PACKAGES[@]}))
fi

if [[ "${#EXCLUDED_PACKAGES[@]}" -gt 0 ]]; then
dnf remove -y ${EXCLUDED_PACKAGES[@]}
fi

if [[ "${#INCLUDED_PACKAGES[@]}" -gt 0 ]]; then
dnf install -y ${INCLUDED_PACKAGES[@]}
fi

# check if any excluded packages are still present
# (this can happen if an included package pulls in a dependency)
EXCLUDED_PACKAGES=($(jq -r "[(.all.exclude | (.all, select(.\"$DESKTOP_ENVIRONMENT\" != null).\"$DESKTOP_ENVIRONMENT\")[]), \
(select(.\"$FEDORA_VERSION\" != null).\"$FEDORA_VERSION\".exclude | (.all, select(.\"$DESKTOP_ENVIRONMENT\" != null).\"$DESKTOP_ENVIRONMENT\")[])] \
| sort | unique[]" /tmp/packages.json))

if [[ "${#EXCLUDED_PACKAGES[@]}" -gt 0 ]]; then
EXCLUDED_PACKAGES=($(rpm -qa --queryformat='%{NAME} ' ${EXCLUDED_PACKAGES[@]}))
fi

# remove any excluded packages which are still present on image
if [[ "${#EXCLUDED_PACKAGES[@]}" -gt 0 ]]; then
dnf remove -y ${EXCLUDED_PACKAGES[@]}
fi
7 changes: 7 additions & 0 deletions scripts/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

set -euox pipefail

# Clear directories
rm -rf /tmp/*

# Cleanup DNF
dnf clean all

Expand All @@ -10,3 +13,7 @@ mkdir -p /var/tmp
KERNEL_SUFFIX=""
QUALIFIED_KERNEL="$(rpm -qa | grep -P 'kernel-(|'"$KERNEL_SUFFIX"'-)(\d+\.\d+\.\d+)' | sed -E 's/kernel-(|'"$KERNEL_SUFFIX"'-)//')"
dracut --kver "$QUALIFIED_KERNEL" --reproducible -vf "/lib/modules/$QUALIFIED_KERNEL/initramfs.img"

# Disable RPM repos
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/rpmfusion-{free,nonfree}{,-updates,-updates-testing}.repo
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/{kylegospo-oversteer,ublue-os-staging}.repo
Loading

0 comments on commit c95299d

Please sign in to comment.