mirror of
https://github.com/rwinkhart/cachyos-postinstall-helper.git
synced 2026-08-27 20:36:32 -04:00
Add firmware selector
This commit is contained in:
+44
@@ -0,0 +1,44 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/rwinkhart/go-boilerplate/back"
|
||||||
|
"github.com/rwinkhart/go-boilerplate/front"
|
||||||
|
)
|
||||||
|
|
||||||
|
const firm = "linux-firmware-"
|
||||||
|
|
||||||
|
func firmwareSelector() {
|
||||||
|
var nonOptional = []string{firm + "whence", firm + "cirrus", firm + "other"}
|
||||||
|
var optional []string
|
||||||
|
for {
|
||||||
|
fmt.Println(back.AnsiBold + "\nSelected firmware: " + strings.Join(optional, ", ") + back.AnsiReset + "\n")
|
||||||
|
choice := front.InputMenuGen("Firmware to install:", []string{"BACK", "INSTALL", "intel", "amdgpu", "nvidia", "mediatek", "realtek", "atheros", "qcom", "broadcom"})
|
||||||
|
switch choice {
|
||||||
|
case 1:
|
||||||
|
return
|
||||||
|
case 2:
|
||||||
|
allPackages := append(nonOptional, optional...)
|
||||||
|
managePackages("-S", allPackages)
|
||||||
|
managePackages("-Rcns", []string{"linux-firmware"})
|
||||||
|
case 3:
|
||||||
|
optional = append(optional, firm+"intel")
|
||||||
|
case 4:
|
||||||
|
optional = append(optional, firm+"amdgpu")
|
||||||
|
case 5:
|
||||||
|
optional = append(optional, firm+"nvidia")
|
||||||
|
case 6:
|
||||||
|
optional = append(optional, firm+"mediatek")
|
||||||
|
case 7:
|
||||||
|
optional = append(optional, firm+"realtek")
|
||||||
|
case 8:
|
||||||
|
optional = append(optional, firm+"atheros")
|
||||||
|
case 9:
|
||||||
|
optional = append(optional, firm+"qcom")
|
||||||
|
case 10:
|
||||||
|
optional = append(optional, firm+"broadcom")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"os/user"
|
"os/user"
|
||||||
|
|
||||||
"github.com/rwinkhart/go-boilerplate/front"
|
"github.com/rwinkhart/go-boilerplate/front"
|
||||||
@@ -32,7 +33,7 @@ func main() {
|
|||||||
|
|
||||||
for {
|
for {
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
choice := front.InputMenuGen("Option:", []string{"ALL", "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", "firmware selector"})
|
||||||
switch choice {
|
switch choice {
|
||||||
case 1:
|
case 1:
|
||||||
performAllTweaks = true
|
performAllTweaks = true
|
||||||
@@ -40,6 +41,7 @@ func main() {
|
|||||||
case 2:
|
case 2:
|
||||||
if partitionIsMounted() {
|
if partitionIsMounted() {
|
||||||
fmt.Println("\n" + partitionR + " is already mounted on " + mountPoint)
|
fmt.Println("\n" + partitionR + " is already mounted on " + mountPoint)
|
||||||
|
os.Exit(1)
|
||||||
} else {
|
} else {
|
||||||
premount()
|
premount()
|
||||||
}
|
}
|
||||||
@@ -93,6 +95,16 @@ func main() {
|
|||||||
cosmic()
|
cosmic()
|
||||||
// TODO window decoration position (not yet implemented)
|
// TODO window decoration position (not yet implemented)
|
||||||
// TODO screen blank shortcut (not yet implemented)
|
// TODO screen blank shortcut (not yet implemented)
|
||||||
|
|
||||||
|
if !performAllTweaks {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
fallthrough
|
||||||
|
case 9:
|
||||||
|
firmwareSelector()
|
||||||
|
}
|
||||||
|
if !performAllTweaks {
|
||||||
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-1
@@ -9,7 +9,12 @@ import (
|
|||||||
|
|
||||||
func premount() {
|
func premount() {
|
||||||
for {
|
for {
|
||||||
choice := front.InputMenuGen("Tweak:", []string{"BACK", "enable ext4 fast_commit"})
|
var choice int
|
||||||
|
if performAllTweaks {
|
||||||
|
choice = 2
|
||||||
|
} else {
|
||||||
|
choice = front.InputMenuGen("Tweak:", []string{"BACK", "enable ext4 fast_commit"})
|
||||||
|
}
|
||||||
switch choice {
|
switch choice {
|
||||||
case 1:
|
case 1:
|
||||||
return
|
return
|
||||||
@@ -20,5 +25,8 @@ func premount() {
|
|||||||
other.PrintError("Failed to enable fast_commit", 1)
|
other.PrintError("Failed to enable fast_commit", 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if !performAllTweaks {
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user