Enhance installation and update processes with user confirmation and GPU detection; add required packages
This commit is contained in:
+16
-4
@@ -4,6 +4,7 @@ import { detectGpuVendors, driverPackagesFor } from "./gpu.js";
|
||||
import {
|
||||
backupConflicts,
|
||||
ensureSddmEnabled,
|
||||
ensureSudoSession,
|
||||
ensureYay,
|
||||
ensureZsh,
|
||||
installPackages,
|
||||
@@ -12,18 +13,21 @@ import {
|
||||
writeState,
|
||||
} from "./stow.js";
|
||||
|
||||
export async function install() {
|
||||
export async function install({ yes = false }: { yes?: boolean } = {}) {
|
||||
p.intro("Hyprland dotfiles install");
|
||||
|
||||
ensureYay();
|
||||
p.log.warn(
|
||||
"This installer assumes a clean Arch Linux system. Running it elsewhere, " +
|
||||
"or on an already-configured machine, may back up and replace existing config.",
|
||||
);
|
||||
|
||||
const chosen = new Set(packages.filter((pkg) => pkg.tier === "required").map((pkg) => pkg.name));
|
||||
|
||||
for (const group of groups) {
|
||||
const options = packages.filter((pkg) => pkg.group === group);
|
||||
const groupOptions = packages.filter((pkg) => pkg.group === group);
|
||||
const pick = await p.select({
|
||||
message: `Choose a ${group}`,
|
||||
options: options.map((pkg) => ({ value: pkg.name, label: pkg.name })),
|
||||
options: groupOptions.map((pkg) => ({ value: pkg.name, label: pkg.name })),
|
||||
});
|
||||
if (p.isCancel(pick)) return p.cancel("Install cancelled.");
|
||||
chosen.add(pick as string);
|
||||
@@ -56,6 +60,14 @@ export async function install() {
|
||||
for (const name of gpuPicks) chosen.add(name);
|
||||
}
|
||||
|
||||
p.note([...chosen].join("\n"), "Packages to install");
|
||||
if (!yes) {
|
||||
const proceed = await p.confirm({ message: "Proceed?" });
|
||||
if (p.isCancel(proceed) || !proceed) return p.cancel("Install cancelled.");
|
||||
}
|
||||
|
||||
ensureSudoSession();
|
||||
ensureYay();
|
||||
installPackages([...chosen]);
|
||||
|
||||
ensureSddmEnabled();
|
||||
|
||||
Reference in New Issue
Block a user