Skip to content

Commit

Permalink
[pull] main from ublue-os:main (#49)
Browse files Browse the repository at this point in the history
* feat: Switch to much smaller nerd-fonts package (ublue-os#837)

* feat: Switch to topgrade powered ublue-update (ublue-os#835)

* feat(ci): Introduce a testing tag (ublue-os#838)

* feat: Add default config for Pods flatpak (ublue-os#839)

* fix: Correct skel.d error in installer

* feat: add user-motd banner (ublue-os#840)

* chore: doens't -> doesn't (ublue-os#841)

* feat: Initial Container wireup (ublue-os#844)

* fix(just): correct the arg order for AssembleList when making mlbox (ublue-os#845)

* fix: quadlet locations (ublue-os#846)

* feat: Add dynamic MOTD tips and image info (ublue-os#847)

* fix: Correct motd syntax

* fix: Correct skel path for dx files

* fix: small adjustments to motd (ublue-os#848)

Co-authored-by: Kyle Gospodnetich <me@kylegospodneti.ch>

* feat: jazz up the motd (ublue-os#849)

* fix: Add nerd fonts to all images

* chore: Remove nerd font repo once it's no longer needed

* fix(motd): minor text fix (ublue-os#851)

* fix: add more tips

* fix: update motd generation (ublue-os#853)

Co-authored-by: Kyle Gospodnetich <me@kylegospodneti.ch>

* feat(just): remove things we don't use from the justfile (ublue-os#852)

---------

Co-authored-by: Kyle Gospodnetich <me@kylegospodneti.ch>
Co-authored-by: RJ Trujillo <rjtrujillo@protonmail.ch>
Co-authored-by: Benjamin Sherman <benjamin@holyarmy.org>
Co-authored-by: Justin Plock <jplock@users.noreply.github.com>
Co-authored-by: m2Giles <69128853+m2Giles@users.noreply.github.com>
Co-authored-by: HikariKnight <2557889+HikariKnight@users.noreply.github.com>
Co-authored-by: Jorge O. Castro <jorge.castro@gmail.com>
  • Loading branch information
8 people authored Jan 29, 2024
1 parent 61f1fa1 commit d2635ec
Show file tree
Hide file tree
Showing 20 changed files with 170 additions and 98 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ on:
pull_request:
branches:
- main
- testing
paths-ignore:
- '**.md'
push:
branches:
- main
- testing
paths-ignore:
- '**.md'
workflow_dispatch:
Expand Down Expand Up @@ -99,8 +106,16 @@ jobs:
BUILD_TAGS=("${MAJOR_VERSION}" "${MAJOR_VERSION}-${TIMESTAMP}")
if [[ "${{ matrix.is_latest_version }}" == "true" ]] && \
[[ "${{ matrix.is_stable_version }}" == "true" ]]; then
if [[ ${{ github.ref_name }} == "testing" ]]; then
BUILD_TAGS=("${MAJOR_VERSION}-testing" "${MAJOR_VERSION}-testing-${TIMESTAMP}")
if [[ "${{ matrix.is_latest_version }}" == "true" ]] && \
[[ "${{ matrix.is_stable_version }}" == "true" ]]; then
BUILD_TAGS+=("testing")
elif [[ "${{ matrix.is_gts_version }}" == "true" ]]; then
BUILD_TAGS+=("gts-testing")
fi
elif [[ "${{ matrix.is_latest_version }}" == "true" ]] && \
[[ "${{ matrix.is_stable_version }}" == "true" ]]; then
BUILD_TAGS+=("latest")
elif [[ "${{ matrix.is_gts_version }}" == "true" ]]; then
BUILD_TAGS+=("gts")
Expand Down
15 changes: 10 additions & 5 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,28 +54,33 @@ RUN sed -i 's@enabled=0@enabled=1@g' /etc/yum.repos.d/_copr_ublue-os-akmods.repo
/tmp/akmods-rpms/kmods/*v4l2loopback*.rpm \
/tmp/akmods-rpms/kmods/*wl*.rpm \
; fi && \
# Don't install evdi on asus because of conflicts
if grep -qv "asus" <<< "${AKMODS_FLAVOR}"; then \
rpm-ostree install \
/tmp/akmods-rpms/kmods/*evdi*.rpm \
; fi && \
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/negativo17-fedora-multimedia.repo
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/negativo17-fedora-multimedia.repo && \
wget https://copr.fedorainfracloud.org/coprs/che/nerd-fonts/repo/fedora-"${FEDORA_MAJOR_VERSION}"/che-nerd-fonts-fedora-"${FEDORA_MAJOR_VERSION}".repo -O /etc/yum.repos.d/_copr_che-nerd-fonts-"${FEDORA_MAJOR_VERSION}".repo

# Starship Shell Prompt
RUN curl -Lo /tmp/starship.tar.gz "https://github.com/starship/starship/releases/latest/download/starship-x86_64-unknown-linux-gnu.tar.gz" && \
tar -xzf /tmp/starship.tar.gz -C /tmp && \
install -c -m 0755 /tmp/starship /usr/bin && \
echo 'eval "$(starship init bash)"' >> /etc/bashrc

RUN wget https://copr.fedorainfracloud.org/coprs/ublue-os/bling/repo/fedora-$(rpm -E %fedora)/ublue-os-bling-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_ublue-os-bling.repo && \
wget https://copr.fedorainfracloud.org/coprs/ublue-os/staging/repo/fedora-"${FEDORA_MAJOR_VERSION}"/ublue-os-staging-fedora-"${FEDORA_MAJOR_VERSION}".repo -O /etc/yum.repos.d/ublue-os-staging-fedora-"${FEDORA_MAJOR_VERSION}".repo && \
RUN wget https://copr.fedorainfracloud.org/coprs/ublue-os/staging/repo/fedora-"${FEDORA_MAJOR_VERSION}"/ublue-os-staging-fedora-"${FEDORA_MAJOR_VERSION}".repo -O /etc/yum.repos.d/ublue-os-staging-fedora-"${FEDORA_MAJOR_VERSION}".repo && \
/tmp/build.sh && \
/tmp/image-info.sh && \
pip install --prefix=/usr yafti && \
pip install --prefix=/usr topgrade && \
rpm-ostree install ublue-update && \
mkdir -p /usr/etc/flatpak/remotes.d && \
wget -q https://dl.flathub.org/repo/flathub.flatpakrepo -P /usr/etc/flatpak/remotes.d && \
cp /tmp/ublue-update.toml /usr/etc/ublue-update/ublue-update.toml && \
mkdir -p /usr/etc/containers/systemd/users && \
wget -q https://raw.githubusercontent.com/ublue-os/toolboxes/main/quadlets/bluefin-cli/bluefin-cli.container -P /usr/etc/containers/systemd/users && \
printf "\n\n[Install]\nWantedBy=bluefin-cli.target" >> /usr/etc/containers/systemd/users/bluefin-cli.container && \
sed -i '/AutoUpdate.*/ s/^#*/#/' /usr/etc/containers/systemd/users/bluefin-cli.container && \
sed -i 's/ContainerName=bluefin/ContainerName=bluefin-cli/' /usr/etc/containers/systemd/users/bluefin-cli.container && \
systemctl enable rpm-ostree-countme.service && \
systemctl enable tailscaled.service && \
systemctl enable dconf-update.service && \
Expand All @@ -89,12 +94,12 @@ RUN wget https://copr.fedorainfracloud.org/coprs/ublue-os/bling/repo/fedora-$(rp
find /tmp/just -iname '*.just' -exec printf "\n\n" \; -exec cat {} \; >> /usr/share/ublue-os/just/60-custom.just && \
rm -f /etc/yum.repos.d/tailscale.repo && \
rm -f /etc/yum.repos.d/charm.repo && \
rm -f /etc/yum.repos.d/_copr_ublue-os-bling.repo && \
rm -f /etc/yum.repos.d/ublue-os-staging-fedora-"${FEDORA_MAJOR_VERSION}".repo && \
echo "Hidden=true" >> /usr/share/applications/fish.desktop && \
echo "Hidden=true" >> /usr/share/applications/htop.desktop && \
echo "Hidden=true" >> /usr/share/applications/nvtop.desktop && \
echo "Hidden=true" >> /usr/share/applications/gnome-system-monitor.desktop && \
rm -f /etc/yum.repos.d/_copr_che-nerd-fonts-"${FEDORA_MAJOR_VERSION}".repo && \
sed -i 's/#DefaultTimeoutStopSec.*/DefaultTimeoutStopSec=15s/' /etc/systemd/user.conf && \
sed -i 's/#DefaultTimeoutStopSec.*/DefaultTimeoutStopSec=15s/' /etc/systemd/system.conf && \
sed -i '/^PRETTY_NAME/s/Silverblue/Bluefin/' /usr/lib/os-release && \
Expand Down
2 changes: 1 addition & 1 deletion dx/usr/etc/profile.d/vscode-bluefin-profile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ if test "$(id -u)" -gt "0" && test -d "$HOME"; then
# Add default settings when there are no settings
if test ! -e "$HOME"/.config/Code/User/settings.json; then
mkdir -p "$HOME"/.config/Code/User
cp -f /etc/skel.d/.config/Code/User/settings.json "$HOME"/.config/Code/User/settings.json
cp -f /etc/skel/.config/Code/User/settings.json "$HOME"/.config/Code/User/settings.json
fi
fi
4 changes: 2 additions & 2 deletions dx/usr/lib/systemd/system/swtpm-workaround.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ After=local-fs.target

[Service]
Type=oneshot
# Copy if it doens't exist
# Copy if it doesn't exist
ExecStartPre=/usr/bin/bash -c "[ -x /usr/local/bin/.swtpm ] || /usr/bin/cp /usr/bin/swtpm /usr/local/bin/.swtpm"
# This is faster than using .mount unit. Also allows for the previous line/cleanup
ExecStartPre=/usr/bin/mount --bind /usr/local/bin/.swtpm /usr/bin/swtpm
Expand All @@ -17,4 +17,4 @@ ExecStop=/usr/bin/rm /usr/local/bin/.swtpm
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target
129 changes: 59 additions & 70 deletions just/custom.just
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,65 @@ benchmark:
echo 'Running a 1 minute benchmark ...'
stress-ng --matrix 0 -t 1m --times

# Install aqua | https://aquaproj.github.io
aqua:
#!/usr/bin/env bash
printf '\n=>Installing aqua ...\n\n'
pushd "$(mktemp -d)"
curl -sSfL -O https://raw.githubusercontent.com/aquaproj/aqua-installer/v2.1.1/aqua-installer
echo "c2af02bdd15da6794f9c98db40332c804224930212f553a805425441f8331665 aqua-installer" | sha256sum -c
chmod +x aqua-installer
./aqua-installer
printf '\n=> Make sure the ${AQUA_ROOT_DIR}/bin environment variable is added to your PATH (.bashrc/.zshrc):\n'
printf '\n export PATH="${AQUA_ROOT_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/aquaproj-aqua}/bin:$PATH"\n'
printf '\n=> see https://aquaproj.github.io/docs/tutorial for more info\n'

# Configure bluefin-cli Terminal Experience
bluefin-cli:
#!/usr/bin/env bash
distrobox-create --nvidia --image ghcr.io/ublue-os/bluefin-cli:latest -n bluefin
echo "Entering bluefin-cli"
distrobox enter -n bluefin
#!/usr/bin/bash
source /usr/lib/ujust/ujust.sh
printf "Set Up bluefin-cli\n"
printf "Would you like to use Host Terminal or Container as default Terminal?\n"
TERMINAL_CHOICE=$(Choose Host Container)
if test "$TERMINAL_CHOICE" = "Container"; then
printf "You have chosen Container.\nWould you like to use quadlets to manage your container?\n"
MANAGEMENT_CHOICE=$(Choose Quadlet Distrobox)
else
printf "You have chosen to use Host Terminal. Would you like to setup Bluefin-cli container?\n"
MANAGEMENT_CHOICE=$(Choose Quadlet Distrobox No)
fi
if /usr/bin/systemctl is-enabled --quiet bluefin-cli.target; then
printf "Bluefin quadlet is already enabled, would you like to disable it?\n"
DISABLE=$(Choose Yes No)
if test "$DISABLE" = "No"; then
printf "Not Disabling existing container quadlet.\n"
printf "Finished Bluefin-CLI setup, rerun with ujust bluefin-cli to reconfigure\n"
printf "Exiting...\n"
exit 0
elif test "$DISABLE" = "Yes"; then
printf "Disabling Bluefin-CLI\n"
/usr/bin/systemctl --user disable --now bluefin-cli.target
/usr/bin/systemctl --user stop bluefin-cli.service
fi
fi
if /usr/bin/env DBX_CONTAINER_MANAGER="podman" /usr/bin/distrobox-list | grep -qE "^| bluefin-cli .*"; then
printf "You already have a container named bluefin-cli. Would you like to destroy it?\n"
REBUILD=$(Choose Yes No)
if test "$REBUILD" = "No"; then
printf "Not replacing existing container.\n"
printf "Finished Bluefin-CLI setup, rerun with ujust bluefin-cli to reconfigure\n"
printf "Exiting...\n"
exit 0
elif test "$REBUILD" = "Yes"; then
printf "Destroying existing bluefin-cli container\n"
/usr/bin/env DBX_CONTAINER_MANAGER="podman" /usr/bin/distrobox-rm -f bluefin-cli
fi
fi
if test "$MANAGEMENT_CHOICE" = "Quadlet"; then
/usr/bin/systemctl --user enable --now bluefin-cli.target
/usr/bin/systemctl --user start bluefin-cli.service
elif test "$MANAGEMENT_CHOICE" = "Distrobox"; then
/usr/bin/env DBX_CONTAINER_MANAGER="podman" /usr/bin/distrobox-create --nvidia Y --image ghcr.io/ublue-os/bluefin-cli:latest -n bluefin-cli --no-entry --pull
/usr/bin/env DBX_CONTAINER_MANAGER="podman" /usr/bin/distrobox-enter bluefin-cli -- bash -l -c "exit"
else
printf "You have chosen none.\n"
printf "Finished Bluefin-CLI setup, rerun with ujust bluefin-cli to reconfigure\n"
printf "Exiting...\n"
exit 0
fi
if test "$TERMINAL_CHOICE" = "Container"; then
printf "Setting first terminal be Container for bash using ~/.bashrc.d\n"
printf "Enter into container using prompt's menu after first entry\n"
ln -sf /usr/share/ublue-os/bluefin-cli/bluefin-cli.sh ~/.bashrc.d/zz-container.sh
fi
printf "Finished Bluefin-CLI setup, rerun with ujust bluefin-cli to reconfigure\n"

# Enable Cockpit for web-based system management | https://cockpit-project.org/
cockpit:
Expand Down Expand Up @@ -86,7 +127,7 @@ distrobox-mlbox:
#!/usr/bin/bash
source /usr/lib/ujust/ujust.sh
echo 'Assembling pytorch-nvidia mlbox distrobox ...'
AssembleList create "/usr/share/ublue-os/distrobox/pytorch-nvidia.ini" "mlbox"
AssembleList "/usr/share/ublue-os/distrobox/pytorch-nvidia.ini" create "mlbox"

# Create a Wolfi OS container | https://github.com/wolfi-dev
distrobox-wolfi:
Expand All @@ -110,7 +151,6 @@ fish:
# Install recommended GNOME extensions
gnome-extensions:
pip install --upgrade gnome-extensions-cli
gext install tailscale-status@maxgallup.github.com
gext install nightthemeswitcher@romainvigier.fr
gext install pano@elhan.io
gext install weatheroclock@CleoMenezesJr.github.io
Expand Down Expand Up @@ -216,48 +256,6 @@ nix-devbox-global:
echo 'run "devbox global run install-hook-zsh" to configure zsh shell'
echo 'run "devbox global run" to see other available configuration commands'

# Enable podmansh as user shell (EXPERIMENTAL)
podmansh:
sudo mkdir -p /etc/containers/systemd/users/${UID}
sudo cp /usr/share/ublue-os/quadlets/podmansh.container /etc/containers/systemd/users/${UID}/podmansh.container
sudo usermod $USER --shell /usr/bin/podmansh
printf "${USER}'s shell is now %s." "$(cat /etc/passwd | grep ":$UID:" | cut '-d:' '-f7')"
systemctl --user start podman.socket
loginctl enable-linger $(whoami)

podman pull ghcr.io/ublue-os/ubuntu-toolbox:latest

systemctl --user daemon-reload
systemctl --user stop podmansh.service
systemctl --user start podmansh.service

@echo "Shell now switched to podmansh. Spawn a new terminal to get going!"
@echo "By default, the shell will be Bash. To override it, create ~/.profile with your preferred shell"
@echo "Note: That shell must exist in the toolbox!"
@echo "To ensure a smooth experience within VSCode, please add the following to your settings.json:"
@echo "---"
@echo "\"terminal.integrated.profiles.linux\": {"
@echo " \"podmansh zsh\": {"
@echo " \"path\": \"podmansh\","
@echo " \"args\": [\"-c\", \"cd \${workspaceFolder}; exec zsh\"]"
@echo " }"
@echo "}"
@echo "---"
@echo "Please make sure you have the following environment variable set WITHIN the container:"
@echo "---"
@echo "export DOCKER_HOST=unix:///var/run/podman/podman.sock"
@echo "---"
@echo "Happy Podmansh'ing!"

# Switch podmansh to another image (EXPERIMENTAL)
podmansh-switch IMAGE:
sudo sed -i "/Image\=.*$/c Image\={{ IMAGE }}" /etc/containers/systemd/users/${UID}/podmansh.container
podman pull {{ IMAGE }}
podman rm -f podmansh
systemctl --user daemon-reload
systemctl --user start podmansh.service
echo "Image now switched to {{ IMAGE }}"

# Run pytorch
pytorch:
echo 'Follow the prompts and check the tutorial: https://docs.anaconda.com/free/anaconda/jupyter-notebooks/'
Expand All @@ -279,15 +277,6 @@ touch:
gext install improvedosk@nick-shmyrev.dev
gext install gestureImprovements@gestures

# A preview of what the update system would look like in the future
update-ng:
echo 'Upgrading system...'
sudo bootc upgrade
echo 'Upgrading flatpaks...'
flatpak update -y
echo 'Assembling and replacing distroboxes ...'
distrobox assemble create --replace --file /etc/distrobox/distrobox.ini

# Upgrade Distrobox to the latest git version
distrobox-git:
echo 'Installing latest git snapshot of Distrobox'
Expand Down
7 changes: 2 additions & 5 deletions packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"make",
"mesa-libGLU",
"nautilus-gsconnect",
"nerd-fonts",
"playerctl",
"pulseaudio-utils",
"python3-pip",
Expand All @@ -37,7 +38,6 @@
"stress-ng",
"tailscale",
"tmux",
"ublue-update",
"usbmuxd",
"wireguard-tools",
"xprop",
Expand All @@ -47,7 +47,6 @@
],
"bluefin-dx": [
"adobe-source-code-pro-fonts",
"cascadiacode-nerd-fonts",
"cockpit-machines",
"cockpit-networkmanager",
"cockpit-ostree",
Expand All @@ -59,7 +58,7 @@
"code",
"containerd.io",
"dbus-x11",
"devpod",
"devpod",
"distrobuilder",
"docker-ce",
"docker-ce-cli",
Expand Down Expand Up @@ -98,8 +97,6 @@
"qemu-user-binfmt",
"qemu-user-static",
"qemu",
"ubuntu-nerd-fonts",
"ubuntumono-nerd-fonts",
"virt-manager",
"virt-viewer"
]
Expand Down
2 changes: 1 addition & 1 deletion usr/etc/profile.d/bluefin-firstboot.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
if test "$(id -u)" -gt "0" && test -d "$HOME"; then
if test ! -e "$HOME"/.config/autostart/bluefin-firstboot.desktop; then
mkdir -p "$HOME"/.config/autostart
cp -f /etc/skel.d/.config/autostart/bluefin-firstboot.desktop "$HOME"/.config/autostart
cp -f /etc/skel/.config/autostart/bluefin-firstboot.desktop "$HOME"/.config/autostart
fi
fi
7 changes: 7 additions & 0 deletions usr/etc/profile.d/user-motd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if test -d "$HOME"; then
if test ! -e "$HOME"/.config/no-show-user-motd; then
if test -x "/usr/libexec/ublue-motd"; then
/usr/libexec/ublue-motd
fi
fi
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"32218213-d8cf-444e-84c7-7f67b9765acd": {
"uuid": "32218213-d8cf-444e-84c7-7f67b9765acd",
"name": "System",
"url": "unix:///run/user/1000/podman/podman.sock",
"rgb": null
}
}
2 changes: 1 addition & 1 deletion usr/etc/ublue-update/ublue-update.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[checks]
min_battery_percent = 0.0
min_battery_percent = 20.0
max_cpu_load_percent = 50.0
max_mem_percent = 90.0
[notify]
Expand Down
7 changes: 7 additions & 0 deletions usr/lib/systemd/user/bluefin-cli-update.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Unit]
Description=Restart bluefin-cli.service to rebuild container

[Service]
Type=oneshot
ExecStart=-/usr/bin/podman pull ghcr.io/ublue-os/bluefin-cli:latest
ExecStart=-/usr/bin/systemctl --user restart bluefin-cli.service
5 changes: 5 additions & 0 deletions usr/lib/systemd/user/bluefin-cli.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[Unit]
Description=Bluefin-CLI target for bluefin-cli quadlet

[Install]
WantedBy=default.target
16 changes: 16 additions & 0 deletions usr/libexec/ublue-motd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/bash
escape() {
sed 's/[&/\]/\\&/g' <<< "$1"
}

TIP_FILE=$(ls "/usr/share/ublue-os/motd/tips/"*".md" | shuf -n 1)
if [[ -f "$TIP_FILE" ]]; then
IMAGE_INFO="/usr/share/ublue-os/image-info.json"
IMAGE_NAME=$(jq -r '."image-name"' < $IMAGE_INFO)
IMAGE_NAME_ESCAPED=$(escape "$IMAGE_NAME")
IMAGE_TAG=$(jq -r '."image-tag"' < $IMAGE_INFO)
IMAGE_TAG_ESCAPED=$(escape "$IMAGE_TAG")
TIP=$(shuf -n 1 "$TIP_FILE")
TIP_ESCAPED=$(escape "$TIP")
sed -e "s/%IMAGE_NAME%/$IMAGE_NAME_ESCAPED/g" -e "s/%IMAGE_TAG%/$IMAGE_TAG_ESCAPED/g" -e "s/%TIP%/$TIP_ESCAPED/g" /usr/share/ublue-os/motd/bluefin.md | /usr/bin/glow -s auto -
fi
6 changes: 6 additions & 0 deletions usr/share/ublue-os/bluefin-cli/bluefin-cli.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

if test ! -f "/run/user/${UID}/container-entry" && test -n "$PS1"; then
touch "/run/user/${UID}/container-entry"
exec /usr/bin/distrobox-enter bluefin-cli
fi
Loading

0 comments on commit d2635ec

Please sign in to comment.