From 3f29764944916b6c4cfa568b70af0719596c40e6 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 12 Sep 2024 23:17:04 +0200 Subject: [PATCH] Create a dedicated script for deploying software actions --- scripts/Arch/OS/install.fish | 237 +-------------------------- scripts/Arch/Scripts/deploy.fish | 268 +++++++++++++++++++++++++++++++ scripts/Common/OS/install.fish | 17 +- 3 files changed, 288 insertions(+), 234 deletions(-) create mode 100644 scripts/Arch/Scripts/deploy.fish diff --git a/scripts/Arch/OS/install.fish b/scripts/Arch/OS/install.fish index f8a641b8..5b034f3b 100755 --- a/scripts/Arch/OS/install.fish +++ b/scripts/Arch/OS/install.fish @@ -2,6 +2,10 @@ begin set -l dir (status dirname) + function getDeploymentScript -V dir + echo "$dir/../Scripts/deploy.fish"; + end + function initialize -V dir source "$dir/../../Common/Scripts/wait-network.fish" waitNetwork @@ -18,238 +22,5 @@ begin powershell-bin end - if not type -q installSoftware - function installSoftware -V dir - source "$dir/../../Common/Scripts/config.fish" - source "$dir/../Scripts/software.fish" - - if collectionActive essential - yayinst \ - mkinitcpio-firmware \ - neofetch \ - bash-completion \ - wget \ - oh-my-posh-bin \ - screen \ - tmux \ - htop \ - lsof \ - zsh \ - fish \ - pkgfile \ - sl \ - rar - - sudo pkgfile --update - source "$dir/../../Common/Software/bash/main.fish" - source "$dir/../Software/openssh/main.fish" - source "$dir/../Software/vim/main.fish" - source "$dir/../Software/git/main.fish" - source "$dir/../Software/zoxide/main.fish" - source "$dir/../Software/logo-ls/main.fish" - - # GRUB Shenanigans - if that's not an essential I don't know what is! - source "$dir/../Software/minegrub-theme/main.fish"; - end - - if collectionActive common - yayinst \ - tldr \ - btop \ - terminal-parrot - - source "$dir/../Software/aliae/main.fish" - end - - if collectionActive desktopExperience - yayinst \ - maliit-keyboard \ - dconf-editor \ - flatpak ( - # Fixes: https://www.reddit.com/r/flatpak/comments/168tav2/how_to_fix_blurry_flatpaks_on_high_resolution/ - ) xdg-desktop-portal-gtk - - source "$dir/../Software/KDE/main.fish" - source "$dir/../Software/sddm/main.fish" - - # Fonts - yayinst \ - ttf-cascadia-code-nerd \ - ttf-ms-win11-auto \ - otf-cascadia-code \ - ttf-droid - - # Password Management - yayinst \ - bitwarden \ - keepass \ - keepassxc - - # Tools - yayinst \ - android-tools \ - blackbox-terminal \ - cpu-x \ - gnome-calculator \ - yubikey-manager-qt \ - wireshark-qt \ - linux-wifi-hotspot - - # Remote Access - yayinst \ - remmina ( - # RDP support for Remmina - ) freerdp - - # Creativity - yayinst \ - gimp \ - inkscape - - # Office stuff - yayinst \ - libreoffice-fresh \ - naps2-bin \ - pdfarranger \ - protonmail-bridge \ - thunderbird - - yayinst \ - texlive \ - texlive-langgerman - - # Browser - source "$dir/../Software/Firefox/main.fish" - source "$dir/../Software/brave/main.fish" - source "$dir/../Software/Pennywise/main.fish" - - # Virtualization - source "$dir/../Software/waydroid/main.fish" - source "$dir/../Software/Virtual Machine Manager/main.fish" - yayinst propertree-git # mac .plist config file editor - - if collectionActive coding - yayinst \ - devdocs-desktop \ - godot-mono-bin - - source "$dir/../Software/vscode/main.fish" - end - - if collectionActive school - yayinst \ - teams-for-linux \ - xournalpp-git \ - rnote - end - end - - if collectionActive server - else - # Energy Saving - yayinst power-profiles-daemon - sudo systemctl enable --now power-profiles-daemon - - # Networking - yayinst \ - networkmanager-openvpn \ - networkmanager-openconnect \ - protonvpn - - if collectionActive common - source "$dir/../Software/IcedTea/main.fish" - - yayinst \ - img2pdf \ - numbat-bin \ - nvtop \ - pdf2svg \ - tnef - end - end - - if collectionActive media - yayinst \ - ytmdesktop-bin \ - netflix \ - spotube-bin \ - stremio \ - tidal-dl \ - tidal-hifi-bin \ - nuclear-player-bin \ - audius-client-bin - end - - if collectionActive fileSync - yayinst nextcloud-client - source "$dir/../Software/rclone/main.fish" - end - - if collectionActive socialMedia - yayinst \ - signal-desktop \ - threema-desktop \ - vesktop-bin - end - - if collectionActive productivity - yayinst \ - anki-bin - end - - if collectionActive school - yayinst \ - jdk17-temurin \ - gradle \ - jetbrains-toolbox - - source "$dir/../../Common/Software/udev/ct-board.fish" - end - - if collectionActive coding - yayinst \ - archiso \ - wimlib ( - # ISO support for wimlib - ) cdrkit \ - tea \ - woodpecker-cli ( - # AsciiDocs - ) python-docutils ( - # reStructuredText - ) esbonio - - source "$dir/../Software/n/main.fish" - end - - if collectionActive python - yayinst \ - python \ - python-pip \ - python-pipenv - - source "$dir/../Software/pyenv/main.fish" - end - - if collectionActive gaming - yayinst \ - steam \ - chiaki \ - osu-lazer-bin \ - libretro \ - supertux \ - gamepad-tool-bin - - source "$dir/../Software/Lutris/main.fish" - sudo flatpak install -y flathub com.usebottles.bottles - end - - if collectionActive essential - yayinst \ - bb - end - end - end - source "$dir/../../Common/OS/install.fish" end diff --git a/scripts/Arch/Scripts/deploy.fish b/scripts/Arch/Scripts/deploy.fish new file mode 100644 index 00000000..8b896c3c --- /dev/null +++ b/scripts/Arch/Scripts/deploy.fish @@ -0,0 +1,268 @@ +function deploySoftware -d "Deploys a the specified software action" -a action + set -l dir (status dirname) + . "$dir/software.fish" + + if [ -z "$action" ] + set action "install" + end + + set -l isInstall ( + if [ "$action" = "install" ] + echo true + else + echo false + end + ) + + if collectionActive essential + if $isInstall + yayinst \ + mkinitcpio-firmware \ + neofetch \ + bash-completion \ + wget \ + oh-my-posh-bin \ + screen \ + tmux \ + htop \ + lsof \ + zsh \ + fish \ + pkgfile \ + sl \ + rar + + sudo pkgfile --update + end + + source "$dir/../../Common/Software/bash/main.fish" $action + source "$dir/../Software/openssh/main.fish" $action + source "$dir/../Software/vim/main.fish" $action + source "$dir/../Software/git/main.fish" $action + source "$dir/../Software/zoxide/main.fish" $action + source "$dir/../Software/logo-ls/main.fish" $action + + # GRUB Shenanigans - if that's not essential I don't know what is! + source "$dir/../Software/minegrub-theme/main.fish" $action + end + + if collectionActive common + if $isInstall + yayinst \ + tldr \ + btop \ + terminal-parrot + end + + source "$dir/../Software/aliae/main.fish" $action + end + + if collectionActive desktopExperience + if $isInstall + yayinst \ + maliit-keyboard \ + dconf-editor \ + flatpak ( + # Fixes: https://www.reddit.com/r/flatpak/comments/168tav2/how_to_fix_blurry_flatpaks_on_high_resolution/ + ) xdg-desktop-portal-gtk + + # Fonts + yayinst \ + ttf-cascadia-code-nerd \ + ttf-ms-win11-auto \ + otf-cascadia-code \ + ttf-droid + + # Password Management + yayinst \ + bitwarden \ + keepass \ + keepassxc + + # Tools + yayinst \ + android-tools \ + blackbox-terminal \ + cpu-x \ + gnome-calculator \ + yubikey-manager-qt \ + wireshark-qt \ + linux-wifi-hotspot + + # Remote Access + yayinst \ + remmina ( + # RDP support for Remmina + ) freerdp + + # Creativity + yayinst \ + gimp \ + inkscape + + # Office stuff + yayinst \ + libreoffice-fresh \ + naps2-bin \ + pdfarranger \ + protonmail-bridge \ + thunderbird + + yayinst \ + texlive \ + texlive-langgerman + + # Virtualization + yayinst propertree-git # mac .plist config file editor + + if collectionActive school + yayinst \ + teams-for-linux \ + xournalpp-git \ + rnote + end + end + + source "$dir/../Software/KDE/main.fish" $action + source "$dir/../Software/sddm/main.fish" $action + + # Internet Access + source "$dir/../Software/Firefox/main.fish" $action + source "$dir/../Software/brave/main.fish" $action + source "$dir/../Software/Pennywise/main.fish" $action + + # Virtualization + source "$dir/../Software/waydroid/main.fish" $action + source "$dir/../Software/Virtual Machine Manager/main.fish" $action + + if collectionActive coding + if $isInstall + yayinst \ + devdocs-desktop \ + godot-mono-bin + end + + source "$dir/../Software/vscode/main.fish" $action + end + end + + if collectionActive server + else + if $isInstall + # Energy Saving + yayinst power-profiles-daemon + sudo systemctl enable --now power-profiles-daemon + + # Networking + yayinst \ + networkmanager-openvpn \ + networkmanager-openconnect \ + protonvpn + end + + if collectionActive common + if $isInstall + yayinst \ + img2pdf \ + numbat-bin \ + nvtop \ + pdf2svg \ + tnef + end + + source "$dir/../Software/IcedTea/main.fish" $action + end + end + + if collectionActive media && $isInstall + yayinst \ + ytmdesktop-bin \ + netflix \ + spotube-bin \ + stremio \ + tidal-dl \ + tidal-hifi-bin \ + nuclear-player-bin \ + audius-client-bin + end + + if collectionActive fileSync + if $isInstall + yayinst nextcloud-client + end + + source "$dir/../Software/rclone/main.fish" $action + end + + if collectionActive socialMedia && $isInstall + yayinst \ + signal-desktop \ + threema-desktop \ + vesktop-bin + end + + if collectionActive productivity && $isInstall + yayinst \ + anki-bin + end + + if collectionActive school && $isInstall + yayinst \ + jdk17-temurin \ + gradle \ + jetbrains-toolbox + + source "$dir/../../Common/Software/udev/ct-board.fish" + end + + if collectionActive coding + if $isInstall + yayinst \ + archiso \ + wimlib ( + # ISO support for wimlib + ) cdrkit \ + tea \ + woodpecker-cli ( + # AsciiDocs + ) python-docutils ( + # reStructuredText + ) esbonio + end + + source "$dir/../Software/n/main.fish" $action + end + + if collectionActive python + if $isInstall + yayinst \ + python \ + python-pip \ + python-pipenv + end + + source "$dir/../Software/pyenv/main.fish" $action + end + + if collectionActive gaming + if $isInstall + yayinst \ + steam \ + chiaki \ + osu-lazer-bin \ + libretro \ + supertux \ + gamepad-tool-bin + + sudo flatpak install -y flathub com.usebottles.bottles + end + + source "$dir/../Software/Lutris/main.fish" $action + end + + if collectionActive essential && $isInstall + yayinst bb + end +end + +deploySoftware $argv diff --git a/scripts/Common/OS/install.fish b/scripts/Common/OS/install.fish index 644538d0..adc243d3 100755 --- a/scripts/Common/OS/install.fish +++ b/scripts/Common/OS/install.fish @@ -29,6 +29,14 @@ if [ (id -u) -eq 0 ] userdel -r "$name" else source "$dir/../Software/bash/main.fish" + + if not type -q getDeploymentScript + function getDeploymentScript + echo "No deployment script specified! No software will be installed." 1>&2 + false + end + end + runHook initialize || true runHook installDrivers || true runHook installOS || true @@ -37,7 +45,14 @@ else source "$dir/users.fish" end - runHook installSoftware || true + runHook installSoftware || begin + set -l script (getDeploymentScript) + + if [ -n "$script" ] + source $script + end + end + runHook initializeConfig || true runHook postInstall || true