feat: detach fetching from containerfile + add rpms and fonts
Although it may not help that much with the "curl" issue, cloning git repositories is a bunch better than raw curl-ing fixes: [fonts] can we repackage Nerdfonts #3 Include fonts through git modules #6 [nix] install and uninstall scripts #2
This commit is contained in:
parent
1acccb0240
commit
4df7667c35
4 changed files with 32 additions and 92 deletions
|
|
@ -3,16 +3,15 @@ FROM registry.fedoraproject.org/fedora:latest AS builder
|
|||
RUN dnf update -y && dnf install --disablerepo='*' --enablerepo='fedora,updates' --setopt install_weak_deps=0 --nodocs --assumeyes wget && dnf clean all
|
||||
|
||||
RUN mkdir -p /tmp/ublue-os/files/{etc,usr}
|
||||
|
||||
COPY usr /tmp/ublue-os/files/usr
|
||||
COPY etc /tmp/ublue-os/files/etc
|
||||
ADD fetch.sh /tmp/fetch.sh
|
||||
|
||||
RUN wget "https://github.com/loft-sh/devpod/releases/latest/download/devpod-linux-amd64" -O /tmp/devpod && \
|
||||
install -c -m 0755 /tmp/devpod /tmp/ublue-os/files/usr/bin && \
|
||||
wget "https://terra.fyralabs.com/terra.repo" -O /tmp/ublue-os/files/etc/yum.repos.d/terra.repo && \
|
||||
curl -s "https://raw.githubusercontent.com/dnkmmr69420/nix-installer-scripts/main/installer-scripts/silverblue-nix-installer.sh" >> /tmp/ublue-nix-install && \
|
||||
install -c -m 0755 /tmp/ublue-nix-install /tmp/ublue-os/files/usr/bin
|
||||
RUN chmod +x /tmp/fetch.sh && \
|
||||
/tmp/fetch.sh
|
||||
|
||||
FROM scratch
|
||||
|
||||
COPY --from=builder /tmp/ublue-os/files /files
|
||||
|
||||
COPY --from=builder /tmp/ublue-os/rpms /rpms
|
||||
|
|
|
|||
11
etc/yum.repos.d/terra.repo
Normal file
11
etc/yum.repos.d/terra.repo
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[terra]
|
||||
name=Terra $releasever
|
||||
baseurl=https://repos.fyralabs.com/terra$releasever
|
||||
type=rpm
|
||||
skip_if_unavailable=True
|
||||
gpgcheck=1
|
||||
repo_gpgcheck=1
|
||||
gpgkey=https://repos.fyralabs.com/terra$releasever/key.asc
|
||||
enabled=1
|
||||
enabled_metadata=1
|
||||
metadata_expire=4h
|
||||
16
fetch.sh
Normal file
16
fetch.sh
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
set -euo pipefail
|
||||
FILES_ROOT="/tmp/ublue-os/files"
|
||||
|
||||
git clone 'https://github.com/ryanoasis/nerd-fonts' /tmp/nerdfonts
|
||||
mv /tmp/nerdfonts/patched-fonts/* "$FILES_ROOT/usr/share/fonts"
|
||||
|
||||
git clone 'https://github.com/dnkmmr69420/nix-installer-scripts' /tmp/nix-installer-scripts
|
||||
mv /tmp/nix-installers-scripts/installer-scripts/silverblue-nix-installer.sh "$FILES_ROOT/usr/bin/ublue-nix-install"
|
||||
mv /tmp/nix-installers-scripts/uninstaller-scripts/silverblue-nix-uninstaller.sh "$FILES_ROOT/usr/bin/ublue-nix-uninstall"
|
||||
|
||||
wget -O /tmp/devpod "https://github.com/loft-sh/devpod/releases/latest/download/devpod-linux-amd64"
|
||||
install -c -m 0755 /tmp/devpod "$FILES_ROOT/usr/bin"
|
||||
|
||||
wget -O /tmp/devpod.rpm https://github.com/loft-sh/devpod/releases/latest/download/DevPod_linux_x86_64.rpm
|
||||
mv /tmp/devpod.rpm /tmp/ublue-os/rpms
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
#!/bin/bash
|
||||
VERBOSITY="${VERBOSITY:-0}"
|
||||
SUDO_PROGRAM="${SUDO_PROGRAM:-sudo}"
|
||||
USER_WARNING="${USER_WARNING:-1}"
|
||||
[ "$VERBOSITY" = "1" ] && set -x
|
||||
set -uo pipefail
|
||||
|
||||
function log {
|
||||
LEVEL=$1
|
||||
shift
|
||||
echo "[${LEVEL}]" $@ >&2
|
||||
}
|
||||
|
||||
if [ "$EUID" = 0 ] ; then
|
||||
log WARNING "Do not run this command as root, as it won't delete proper files in your system"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$USER_WARNING" = 1 ] ; then
|
||||
cat <<EOF
|
||||
This is a destructive operation, it will delete the following:
|
||||
|
||||
Services:
|
||||
|
||||
- nix-daemon.service
|
||||
- nix-daemon.socket
|
||||
- nix.mount
|
||||
- mkdir-rootfs@.service
|
||||
|
||||
Files & Directories:
|
||||
|
||||
- $HOME/{.nix-channels,.nix-defexpr,.nix-profile,.config/nixpkgs}
|
||||
- /etc/profile.d/nix-app-icons.sh
|
||||
- /etc/profile.d/nix.sh
|
||||
- /etc/nix
|
||||
- /etc/tmpfiles.d/nix-daemon.conf
|
||||
- ~root/.nix-channels
|
||||
- ~root/.nix-defexpr
|
||||
- ~root/.nix-profile
|
||||
|
||||
Users & Groups:
|
||||
|
||||
- nixbld[0-32]
|
||||
|
||||
If you are unsure about everything that will be done, make sure to read the source code of this script by running "cat $(realpath $0)" on your terminal.
|
||||
|
||||
EOF
|
||||
|
||||
read -r -p "Are you sure you want to proceed? [y/N] " response
|
||||
case "$response" in
|
||||
[yY][eE][sS]|[yY])
|
||||
;;
|
||||
*)
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
log TASK 'Removing nix configuration from "\$HOME"'
|
||||
log TASK 'To finish removing everything, make sure to remove the '. "$HOME/.nix-profile/etc/profile.d/nix.sh"' line in your ~/.profile or ~/.bash_profile'
|
||||
|
||||
rm -rf $HOME/{.nix-channels,.nix-defexpr,.nix-profile,.config/nixpkgs,.local/state/nix,.cache/nix}
|
||||
|
||||
log TASK 'Deleting nix system users'
|
||||
for i in $(seq 1 32); do
|
||||
"$SUDO_PROGRAM" userdel "nixbld$i"
|
||||
done
|
||||
"$SUDO_PROGRAM" groupdel 'nixbld'
|
||||
|
||||
log TASK 'Removing nix systemd services'
|
||||
"$SUDO_PROGRAM" systemctl disable --now nix-daemon.service nix-daemon.socket nix.mount mkdir-rootfs@.service
|
||||
"$SUDO_PROGRAM" rm -rf '/etc/systemd/system/mkdir-rootfs@.service' '/etc/systemd/system/nix.mount' /etc/systemd/system/nix-daemon.{service,socket} '/etc/systemd/system/nix-daemon.service.d/'
|
||||
"$SUDO_PROGRAM" systemctl daemon-reload
|
||||
|
||||
log TASK 'Removing remaining nix system configuration'
|
||||
"$SUDO_PROGRAM" rm -rf '/etc/profile.d/nix-app-icons.sh' '/etc/nix' '/etc/profile.d/nix.sh' '/etc/tmpfiles.d/nix-daemon.conf' ~root/.nix-channels ~root/.nix-defexpr ~root/.nix-profile
|
||||
"$SUDO_PROGRAM" cp -f '/etc/bashrc.backup-before-nix' '/etc/bashrc'
|
||||
|
||||
log TASK 'Removing /var/lib/nix'
|
||||
"$SUDO_PROGRAM" restorecon -RF '/var/lib/nix'
|
||||
"$SUDO_PROGRAM" restorecon -RF '/nix'
|
||||
"$SUDO_PROGRAM" rm -rf '/var/lib/nix'
|
||||
|
||||
log INFO 'Make sure to remove residual configurations from the following files:' "/etc/bash.bashrc /etc/bashrc /etc/profile /etc/zsh/zshrc /etc/zshrc $HOME/.bashr $HOME/.bash_profile $HOME/.zshrc $HOME/.profile"
|
||||
|
||||
log INFO 'You may now reboot your system to confirm these changes with "systemctl reboot"'
|
||||
Loading…
Add table
Add a link
Reference in a new issue