feat: add uninstall script.

This commit is contained in:
Elysia
2025-11-19 21:00:54 +08:00
parent 5c8d824749
commit 9001cae848
4 changed files with 250 additions and 83 deletions
+1
View File
@@ -1,3 +1,4 @@
/*/*.tar.*
/*/pkg/
/*/src/
user-config.yaml
+194
View File
@@ -0,0 +1,194 @@
# Fedora dependencies list
# Audio
[groups.audio]
packages = [
"cava",
"pavucontrol",
"wireplumber",
"libdbusmenu-gtk3-devel",
"playerctl"
]
# Backlight
[groups.backlight]
packages = [
"geoclue2",
"brightnessctl",
"ddcutil"
]
# Basic
[groups.basic]
packages = [
"bc",
"coreutils",
"cliphist",
"cmake",
"curl",
"wget2",
"ripgrep",
"gojq",
"xdg-utils",
"rsync",
"yq"
]
# Cursor themes
[groups.cursor_themes]
packages = [
"bibata-cursor-theme"
]
# Fonts & Themes
[groups.fonts_and_themes]
packages = [
"adw-gtk3-theme",
"breeze-cursor-theme",
"grub2-breeze-theme",
"breeze-icon-theme",
"breeze-icon-theme-fedora",
"kf6-breeze-icons",
"sddm-breeze",
"breeze-plus-icon-theme",
"darkly",
"eza",
"fish",
"fontconfig",
"kitty",
"matugen",
"florian-karsten-space-grotesk-fonts",
"starship",
"jetbrains-mono-nerd-fonts",
"google-material-symbols-vf-rounded-fonts",
"material-icons-fonts",
"readex-pro-fonts-all",
"google-rubik-vf-fonts",
"twitter-twemoji-fonts"
]
# Hyprland
[groups.hyprland]
packages = [
"hyprland",
"hyprland-qtutils",
"hyprsunset",
"wl-clipboard"
]
install_opts = ["--setopt=install_weak_deps=False"]
# KDE
[groups.kde]
packages = [
"bluedevil",
"gnome-keyring",
"NetworkManager",
"plasma-nm",
"polkit-kde",
"dolphin",
"plasma-systemsettings"
]
# MicroTeX-git
[groups.microtex]
packages = [
"microtex"
]
# Portal
[groups.portal]
packages = [
"xdg-desktop-portal",
"xdg-desktop-portal-gtk",
"xdg-desktop-portal-kde",
"xdg-desktop-portal-hyprland"
]
# Python
[groups.python]
packages = [
"clang",
"uv",
"gtk4-devel",
"libadwaita-devel",
"libsoup3-devel",
"libportal-gtk4",
"gobject-introspection-devel",
"python3",
"python3.12",
"python3-devel",
"python3.12-devel"
]
install_opts = ["--setopt=install_weak_deps=False"]
# Quickshell-git
[groups.quickshell]
packages = [
"qt6-qtdeclarative",
"qt6-qtbase",
"jemalloc",
"qt6-qtsvg",
"pipewire-libs",
"libxcb",
"wayland-devel",
"qt6-qtwayland",
"qt5-qtwayland",
"libdrm",
"breakpad",
"kf6-kirigami",
# NOTE: Below are custom dependencies of illogical-impulse
"qt6-qt5compat",
"qt6-qtimageformats",
"qt6-qtpositioning",
"qt6-qtquicktimeline",
"qt6-qtsensors",
"qt6-qttools",
"qt6-qttranslations",
"qt6-qtvirtualkeyboard",
"qt6-qtwayland",
"kdialog",
"kf6-syntax-highlighting"
]
# Screencapture
[groups.screencapture]
packages = [
"hyprshot",
"slurp",
"swappy",
"tesseract",
"tesseract-langpack-eng",
"tesseract-langpack-chi_sim",
"wf-recorder"
]
# Toolkit
[groups.toolkit]
packages = [
"upower",
"wtype",
"ydotool"
]
# Widgets
[groups.widgets]
packages = [
"fuzzel",
"glib2",
"ImageMagick",
"hypridle",
"hyprlock",
"hyprpicker",
"songrec",
"translate-shell",
"wlogout"
]
# Extra
[groups.extra]
packages = [
"mpvpaper",
"plasma-systemmonitor",
"unzip"
]
install_opts = ["--setopt=install_weak_deps=False"]
+45 -83
View File
@@ -1,6 +1,19 @@
# This script is meant to be sourced.
# It's not for directly running.
# Initialize the user configuration file
user_config=${REPO_ROOT}/sdata/dist-fedora/user_data.yaml
# Recording DNF Transaction ID
function r() {
original_id=$(dnf history info | grep -Po '^Transaction ID\s+:\s+\K\d+')
"$@"
last_id=$(dnf history info | grep -Po '^Transaction ID\s+:\s+\K\d+')
[ -f "$user_config" ] || ( touch "$user_config" && yq -i ".dnf.original_transaction_id = $original_id" "$user_config" )
[ "$original_id" != "$last_id" ] && yq -i ".dnf.transaction_ids += [ $last_id ]" "$user_config"
}
if ! command -v dnf >/dev/null 2>&1; then
printf "${STY_RED}[$0]: dnf not found, it seems that the system is not Fedora 42 or later distros. Aborting...${STY_RST}\n"
exit 1
@@ -15,8 +28,11 @@ esac
# Remove version lock
v sudo dnf versionlock delete quickshell-git 2>/dev/null
# Development-tools installation
v sudo dnf install @development-tools fedora-packager rpmdevtools fonts-rpm-macros qt6-rpm-macros -y
# Install yq for parsing config files
v sudo dnf install yq -y
# Development-tools
r v sudo dnf install @development-tools fedora-packager rpmdevtools fonts-rpm-macros qt6-rpm-macros -y
# COPR repositories
v sudo dnf copr enable ririko66z/dots-hyprland -y
@@ -25,84 +41,7 @@ v sudo dnf copr enable deltacopy/darkly -y
v sudo dnf copr enable alternateved/eza -y
v sudo dnf copr enable atim/starship -y
# Audio
v sudo dnf install cava pavucontrol wireplumber libdbusmenu-gtk3-devel playerctl -y
# Backlight
v sudo dnf install geoclue2 brightnessctl ddcutil -y
# Basic
v sudo dnf install bc coreutils cliphist cmake curl wget2 ripgrep jq xdg-utils rsync yq -y
# Cursor themes
v sudo dnf install bibata-cursor-theme -y
# Fonts & Themes
themes_deps=(
adw-gtk3-theme breeze-cursor-theme grub2-breeze-theme breeze-icon-theme{,-fedora} kf6-breeze-icons
sddm-breeze breeze-plus-icon-theme darkly eza fish fontconfig kitty matugen florian-karsten-space-grotesk-fonts
starship jetbrains-mono-nerd-fonts google-material-symbols-vf-rounded-fonts material-icons-fonts
readex-pro-fonts-all google-rubik-vf-fonts twitter-twemoji-fonts
)
v sudo dnf install ${themes_deps[@]} -y
# Hyprland
hyprland_deps=(
hyprland
hyprsunset
wl-clipboard
)
v sudo dnf install --setopt="install_weak_deps=False" "${hyprland_deps[@]}" -y
# hyprland-qt-support's build deps
v sudo dnf install hyprlang-devel -y
# KDE
v sudo dnf install bluedevil gnome-keyring NetworkManager plasma-nm polkit-kde dolphin plasma-systemsettings -y
# MicroTeX-git
v sudo dnf install microtex -y
# Portal
v sudo dnf install xdg-desktop-portal{,-gtk,-kde,-hyprland} -y
# Python
v sudo dnf install --setopt="install_weak_deps=False" clang uv gtk4-devel libadwaita-devel \
libsoup3-devel libportal-gtk4 gobject-introspection-devel -y
v sudo dnf install python3{,.12}{,-devel} -y
# Quickshell-git
quickshell_deps=(
qt6-qtdeclarative qt6-qtbase jemalloc qt6-qtsvg pipewire-libs libxcb wayland-devel qt6-qtwayland
qt5-qtwayland libdrm breakpad
)
# NOTE: Below are custom dependencies of illogical-impulse
quickshell_custom_deps=(
qt6-qt5compat qt6-qtimageformats qt6-qtpositioning qt6-qtquicktimeline qt6-qtsensors qt6-qttools
qt6-qttranslations qt6-qtvirtualkeyboard qt6-qtwayland kdialog kf6-syntax-highlighting kf6-kirigami
)
quickshell_build_deps=(
breakpad-static breakpad-devel gcc-c++ ninja-build mesa-libgbm-devel cli11-devel glib2-devel
jemalloc-devel libdrm-devel pipewire-devel pam-devel polkit-devel wayland-devel wayland-protocols-devel
qt6-qtdeclarative-devel qt6-qtshadertools-devel qt6-qtbase-private-devel spirv-tools
libasan
)
v sudo dnf install "${quickshell_deps[@]}" -y
v sudo dnf install "${quickshell_custom_deps[@]}" -y
v sudo dnf install "${quickshell_build_deps[@]}" -y
# Screencapture
v sudo dnf install hyprshot slurp swappy tesseract tesseract-langpack-eng tesseract-langpack-chi_sim wf-recorder -y
# Toolkit
v sudo dnf install upower wtype ydotool -y
# Widgets
v sudo dnf install fuzzel glib2 ImageMagick hypridle hyprlock hyprpicker songrec translate-shell wlogout -y
# Extra
v sudo dnf install --setopt="install_weak_deps=False" mpvpaper plasma-systemmonitor unzip -y
# Start building the missing RPM package locally.
# Start building and install the missing RPM package locally.
install_RPMS() {
rpmbuildroot=${REPO_ROOT}/cache/rpmbuild
x mkdir -p $rpmbuildroot/{BUILD,RPMS,SOURCES}
@@ -111,19 +50,42 @@ install_RPMS() {
mapfile -t -d '' local_specs < <(find "$rpmbuildroot/SPECS" -maxdepth 1 -type f -name "*.spec" -print0)
for spec_file in ${local_specs[@]}; do
x spectool -g -C "$rpmbuildroot/SOURCES" $spec_file
r x sudo dnf builddep -y $spec_file
x rpmbuild -bb --define "_topdir $rpmbuildroot" $spec_file
done
mapfile -t -d '' local_rpms < <(find "$rpmbuildroot/RPMS" -maxdepth 2 -type f -name '*.rpm' -not -name '*debug*' -print0)
echo -e "${STY_BLUE}Next command:${STY_RST} sudo dnf install ${local_rpms[@]} -y"
x sudo dnf install "${local_rpms[@]}" -y
r x sudo dnf install "${local_rpms[@]}" -y
x cd ${REPO_ROOT}
}
showfun install_RPMS
v install_RPMS
# hyprland-qtutils depends on hyprland-qt-support
v sudo dnf install hyprland-qtutils -y
deps_data_file="${REPO_ROOT}/sdata/dist-fedora/feddeps.toml"
deps_data=$(yq -o=j '.' "$deps_data_file")
echo "Starting to install packages from $deps_data_file ..."
while IFS= read -r deps_list_key; do
echo "Installing package list: $deps_list_key"
install_opts=$(echo $deps_data | yq ".groups.\"$deps_list_key\" | select(has(\"install_opts\")) | .install_opts[]")
package_list=$(echo $deps_data | yq ".groups.\"$deps_list_key\".packages | unique | .[]")
r v sudo dnf install -y $install_opts $package_list </dev/tty
echo "----------------------------------------"
done < <(echo "$deps_data" | yq '
.groups |
keys[] // [] |
select(length > 0)
')
# Add back versionlock at the end
v sudo dnf versionlock add quickshell-git
echo -e "\n========================================"
echo "All installations are complete."
echo "========================================"
+10
View File
@@ -0,0 +1,10 @@
# This script is meant to be sourced.
# It's not for directly running.
user_config="${REPO_ROOT}/sdata/dist-fedora/user-config.yaml"
yq -r '.dnf.transaction_ids[]? | reverse' "$user_config" | while read -r tx_id; do
echo -e "\n========================================"
echo "Rolling back DNF Transactions ID$tx_id"
echo "========================================"
v sudo dnf history undo -y "$tx_id"
done