From 28a8b46af11f89151d56370adafe1d796161af0b Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Sun, 12 Oct 2025 15:12:03 -0400 Subject: [PATCH] Add option to perform all tweaks --- applications.go | 10 +++++++- configurations.go | 10 +++++++- main.go | 59 ++++++++++++++++++++++++++++++++++++----------- removals.go | 17 +++++++++----- system.go | 10 +++++++- 5 files changed, 83 insertions(+), 23 deletions(-) diff --git a/applications.go b/applications.go index d2a1d82..e1d24af 100644 --- a/applications.go +++ b/applications.go @@ -9,8 +9,13 @@ import ( func applications() { for { + var choice int + if performAllTweaks { + choice = 2 + } else { + choice = front.InputMenuGen("Application to install:", []string{"BACK", "ALL", "yay-bin", "zsh", "htop", "neovim", "virt-manager (also installs qemu-desktop+libvirt)", "librewolf-bin", "zed", "steam", "corectrl"}) + } var doAll bool - choice := front.InputMenuGen("Application to install:", []string{"BACK", "ALL", "yay-bin", "zsh", "htop", "neovim", "virt-manager (also installs qemu-desktop+libvirt)", "librewolf-bin", "zed", "steam", "corectrl"}) switch choice { case 1: return @@ -88,6 +93,9 @@ func applications() { managePackages("-Rcns", []string{"power-profiles-daemon"}) writeFile(mountPoint+"/etc/polkit-1/rules.d/90-corectrl.rules", corectrlPolkit, "root", 0644) } + if performAllTweaks { + break + } } } diff --git a/configurations.go b/configurations.go index f51d835..b4077b9 100644 --- a/configurations.go +++ b/configurations.go @@ -6,8 +6,13 @@ import ( func configurations() { for { + var choice int + if performAllTweaks { + choice = 2 + } else { + choice = front.InputMenuGen("Custom config:", []string{"BACK", "ALL", "shell profile", "makepkg", "pacman"}) + } var doAll bool - choice := front.InputMenuGen("Custom config:", []string{"BACK", "ALL", "shell profile", "makepkg", "pacman"}) switch choice { case 1: return @@ -35,6 +40,9 @@ func configurations() { writeFile(mountPoint+"/etc/pacman.d/hooks/paccache-clean.hook", pacmanHookClean, "root", 0644) writeFile(mountPoint+"/etc/pacman.d/hooks/nvidia.hook", pacmanHookNvidia, "root", 0644) } + if performAllTweaks { + break + } } } diff --git a/main.go b/main.go index 5b1c687..f9c061a 100644 --- a/main.go +++ b/main.go @@ -8,12 +8,11 @@ import ( "github.com/rwinkhart/go-boilerplate/other" ) -var mountPoint = "/mnt/cph" - var username string var partitionR, partitionB string +var mountPoint = "/mnt/cph" +var performAllTweaks bool -// TODO add mode to perform EVERYTHING func main() { userInfo, err := user.Current() if err != nil { @@ -33,35 +32,67 @@ func main() { for { fmt.Println() - choice := front.InputMenuGen("Option:", []string{"pre-mount tweaks", "universal tweaks", "system tweaks", "removals", "applications", "configuration", "cosmic"}) + choice := front.InputMenuGen("Option:", []string{"ALL", "pre-mount tweaks", "universal tweaks", "system tweaks", "removals", "applications", "configuration", "cosmic"}) switch choice { case 1: + performAllTweaks = true + fallthrough + case 2: if partitionIsMounted() { fmt.Println("\n" + partitionR + " is already mounted on " + mountPoint) } else { premount() } - case 2: - mountPartition() - universalTweaks() + + if !performAllTweaks { + break + } + fallthrough case 3: mountPartition() - system() + universalTweaks() + + if !performAllTweaks { + break + } + fallthrough case 4: mountPartition() - removals() + system() + + if !performAllTweaks { + break + } + fallthrough case 5: mountPartition() - applications() + removals() + + if !performAllTweaks { + break + } + fallthrough case 6: mountPartition() - configurations() + applications() + + if !performAllTweaks { + break + } + fallthrough case 7: + mountPartition() + configurations() + + if !performAllTweaks { + break + } + fallthrough + case 8: mountPartition() cosmic() - // TODO keyboard shortcuts for screenshot/sticky window/terminal - // TODO window decoration position (not yet implemented?) - // TODO link CachyOS wallpapers? + // TODO window decoration position (not yet implemented) + // TODO screen blank shortcut (not yet implemented) } } } diff --git a/removals.go b/removals.go index 5b2d6b1..55a9a1d 100644 --- a/removals.go +++ b/removals.go @@ -7,17 +7,22 @@ import ( // TODO remove unneeded linux-firmware packages! func removals() { for { - var doAll bool - choice := front.InputMenuGen("Application to remove:", []string{"BACK", "linux-cachyos-lts"}) - var target string + var choice int + if performAllTweaks { + choice = 1 + } else { + choice = front.InputMenuGen("Application to remove:", []string{"BACK", "linux-cachyos-lts"}) + } + var targets []string switch choice { case 1: return case 2: - target = "linux-cachyos-lts" + targets = append(targets, "linux-cachyos-lts") } - if !doAll { - managePackages("-Rcns", []string{target}) + managePackages("-Rcns", targets) + if performAllTweaks { + break } } } diff --git a/system.go b/system.go index 2849b4b..cb25154 100644 --- a/system.go +++ b/system.go @@ -11,8 +11,13 @@ import ( func system() { for { + var choice int + if performAllTweaks { + choice = 2 + } else { + choice = front.InputMenuGen("Tweak:", []string{"BACK", "ALL", "replace sudo with doas", "enable ipv6 privacy extensions", "enable SysRq reboots", "disable kernel security mitigations", "unlock amdgpu tuning", "enable amd_pstate in passive mode (recommended for zenver2)"}) + } var doAll bool - choice := front.InputMenuGen("Tweak:", []string{"BACK", "ALL", "replace sudo with doas", "enable ipv6 privacy extensions", "enable SysRq reboots", "disable kernel security mitigations", "unlock amdgpu tuning", "enable amd_pstate in passive mode (recommended for zenver2)"}) switch choice { case 1: return @@ -71,6 +76,9 @@ func system() { case 8: addKernelParams([]string{"amd_pstate=passive"}) } + if performAllTweaks { + break + } } }