Commit bce206e

Ansari <ping@ansari.wtf>
2025-08-01 17:36:23
minor tweaks
1 parent 1c5dfa6
arch.sh → arch/install.sh
@@ -128,7 +128,7 @@ install_base_system(){
     echo
     log_info "Installing base system packages"
     log_warning "About to install base system packages. This may take a while."
-    execute_step "pacstrap -K /mnt base linux linux-headers linux-firmware btrfs-progs vim openssh networkmanager sudo" "Installing base system packages"
+    execute_step "pacstrap -K /mnt base base-devel linux linux-headers linux-firmware btrfs-progs vim openssh networkmanager sudo git" "Installing base system packages"
     clear_screen_from_given_line 25
     log_success "Base system packages installed successfully."
 }
@@ -169,6 +169,13 @@ configure_initramfs() {
     log_success "Initramfs configured successfully."
 }
 
+configure_initramfs_nvidia() {
+    log_info "Configuring initramfs for Btrfs NVIDIA"
+    execute_step "sed -i 's/^MODULES=(btrfs)/MODULES=(btrfs nvidia nvidia_modeset nvidia_uvm nvidia_drm)/' /etc/mkinitcpio.conf" "Configuring initramfs for Btrfs"
+    execute_step "mkinitcpio -P" "Generating initramfs"
+    log_success "Initramfs configured successfully."
+}
+
 setup_users() {
     log_info "Setting up users"
     execute_step "echo -e '$ROOT_PASSWORD\n$ROOT_PASSWORD' | passwd root" "Setting root password"   
@@ -195,6 +202,12 @@ EOF
     log_success "Bootloader set up successfully."
 }
 
+setup_nvidia_packages() {
+    log_info "Setting up Nvidia packages"
+    execute_step "pacman -S dkms libva-nvidia-driver nvidia-open-dkms --noconfirm" "Installing Nvidia packages (OSS version)"
+    log_success "Nvidia Packages installed successfully."
+}
+
 enable_services() {
     log_info "Enabling essential services"
     execute_step "systemctl enable NetworkManager" "Enabling NetworkManager"
@@ -208,6 +221,10 @@ configure_system_basics
 configure_initramfs
 setup_users
 setup_bootloader
+ask_yes_no "Do you want to install Nvidia Packages?" && {
+    setup_nvidia_packages
+    configure_initramfs_nvidia
+} 
 enable_services
 
 log_success "Chroot setup completed successfully."
arch/post-install.sh
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+LOGFILE="arch_post_install.log"
+
+sudo -v
+( while true; do sudo -n true; sleep 60; done ) & 
+sudo_keepalive_pid=$!
+
+cleanup_sudo() {
+    kill "$sudo_keepalive_pid"
+}
+
+ensure_connectivity_and_source(){
+    if ! ping -c 3 archlinux.org >/dev/null 2>&1; then
+        echo "Network connectivity check failed. Please ensure you are connected to the internet."
+        exit 1
+    fi 
+    
+    if ! command -v curl >/dev/null 2>&1; then
+        echo "Install curl and run the script"
+        exit 1
+    fi
+
+    COMMON_SCRIPT_URL="https://scripts.ansari.wtf/base.sh"
+    source <(curl -s $COMMON_SCRIPT_URL)
+}
+
+cleanup(){
+    echo
+    echo -e "${YELLOW}Setup interrupted. Cleaning up...${NC}"
+    exit 1
+}
+
+yay_install(){
+    if ! yay --version >/dev/null 2>&1; then
+        execute_step "git --version" "Precheck Git installed"
+        execute_step "git clone https://aur.archlinux.org/yay.git" "Cloning yay from git"
+        log_info "Installing yay"
+        (cd yay && makepkg -si --noconfirm) && rm -rf yay
+        clear_screen_from_given_line 10
+        log_info "yay installed successfully"
+    else 
+        log_info "yay is already installed.."
+    fi
+}
+
+
+main(){
+    clear
+    ensure_connectivity_and_source
+    setup_cleanup_trap cleanup  
+    trap cleanup_sudo EXIT
+    show_box "Arch Post Installation" 
+    yay_install
+    execute_step "yay -S --noconfirm fzf fd tree stow keychain zsh unzip ghostty tmux zoxide neovim code cliphist pacman-contrib --needed" "Installing Development Essentials"
+    execute_step "yay -S --noconfirm rofi bat polkit-gnome ttf-font-awesome noto-fonts noto-fonts-emoji --needed" "Installing Minimal GUI Tools"
+    execute_step "yay -S --noconfirm bruno-bin obsidian-bin" "Installing Prebuild binaries"
+    execute_step "yay -S --noconfirm hyprland-git" "Installing Hyprland"
+    execute_step "yay -S --noconfirm hypridle hyprlock-git hyprshot ags-hyprpanel-git swww --needed" "Installing Hyprland Environment"
+    execute_step 'sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"' "Installing oh-my-zsh"
+    execute_step "git clone https://github.com/zsh-users/zsh-autosuggestions .oh-my-zsh/custom/plugins/zsh-autosuggestions" "Cloning zsh-autosuggestions plugin"
+    execute_step "git clone https://github.com/The-Robin-Hood/dotfiles" "Cloning Dotfiles"
+    execute_step "cd dotfiles && stow . --adopt && git restore . && cd .." "Configuring dotfiles"
+    # execute_step "swww img .assets/wallpapers/gwen-stacy.jpg --transition-fps=60 --transition-type=wipe" "Configuring Wallpaper" 
+}
+
+main
+
old.html
@@ -1,89 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-
-<head>
-    <meta charset="UTF-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>Simple Scripts</title>
-    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css">
-    <link rel="preconnect" href="https://fonts.googleapis.com">
-    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
-    <link href="https://fonts.googleapis.com/css2?family=Caveat&display=swap" rel="stylesheet">
-    <style>
-        .custom-scrollbar {
-            scrollbar-width: 1px;
-            scrollbar-color: transparent;
-            scroll-margin: 0px;
-        }
-
-        .custom-scrollbar::-webkit-scrollbar {
-            width: 1px;
-        }
-
-        .custom-scrollbar::-webkit-scrollbar-track {
-            background-color: transparent;
-        }
-
-        .custom-scrollbar::-webkit-scrollbar-thumb {
-            border-radius: 5px;
-            height: 1px;
-            width: 1px;
-            scrollbar-width: thin;
-            background-color: rgba(255, 255, 255, 0.3);
-        }
-    </style>
-</head>
-
-
-<body class="bg-gray-800 font-sans text-white">
-    <div class="container mx-auto py-8">
-        <h1 class="text-5xl text-center mb-8" style="font-family: 'Caveat', cursive;">Simple Scripts</h1>
-        <div class="snippet bg-gray-700 p-4 mb-8" id="root">
-        </div>
-    </div>
-    <script>
-        async function copyToClipboard(text) {
-            try {
-                await navigator.clipboard.writeText(text);
-                console.log('Copied to clipboard');
-            } catch (err) {
-                console.error('Failed to copy: ', err);
-            }
-        }
-
-        async function getText() {
-            const scriptList = await fetch("./scripts.json").then((res) => res.json());
-            const rootElement = document.getElementById("root");
-            scriptList.forEach(async (script) => {
-                const response = await fetch(`./${script.filename}`);
-                const data = await response.text();
-                const snippetContainer = document.createElement("div");
-                snippetContainer.className = "snippet p-4 mb-8";
-                const heading = document.createElement("h2");
-                heading.className = "text-xl mb-4 font-semibold";
-                heading.textContent = script.title;
-                const description = document.createElement("p");
-                description.className = "text-gray-400 mb-4";
-                description.textContent = script.description;
-                const pre = document.createElement("pre");
-                pre.className = "bg-gray-900 p-4 border border-gray-700 relative overflow-x-auto custom-scrollbar";
-                const button = document.createElement("button");
-                button.className = "bg-gray-700 hover:bg-gray-600 text-white font-bold py-2 px-2 rounded absolute top-2 right-2";
-                button.innerHTML = `<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-3 w-3"><path d="M1 9.50006C1 10.3285 1.67157 11.0001 2.5 11.0001H4L4 10.0001H2.5C2.22386 10.0001 2 9.7762 2 9.50006L2 2.50006C2 2.22392 2.22386 2.00006 2.5 2.00006L9.5 2.00006C9.77614 2.00006 10 2.22392 10 2.50006V4.00002H5.5C4.67158 4.00002 4 4.67159 4 5.50002V12.5C4 13.3284 4.67158 14 5.5 14H12.5C13.3284 14 14 13.3284 14 12.5V5.50002C14 4.67159 13.3284 4.00002 12.5 4.00002H11V2.50006C11 1.67163 10.3284 1.00006 9.5 1.00006H2.5C1.67157 1.00006 1 1.67163 1 2.50006V9.50006ZM5 5.50002C5 5.22388 5.22386 5.00002 5.5 5.00002H12.5C12.7761 5.00002 13 5.22388 13 5.50002V12.5C13 12.7762 12.7761 13 12.5 13H5.5C5.22386 13 5 12.7762 5 12.5V5.50002Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path></svg>`;
-                button.addEventListener("click", () => copyToClipboard(data));
-                const code = document.createElement("code");
-                code.className = "text-gray-300";
-                code.textContent = data;
-                pre.appendChild(button);
-                pre.appendChild(code);
-                snippetContainer.appendChild(heading);
-                snippetContainer.appendChild(description);
-                snippetContainer.appendChild(pre);
-                rootElement.appendChild(snippetContainer);
-            });
-        }
-        getText();
-    </script>
-</body>
-
-</html>
\ No newline at end of file
scripts.json
@@ -13,8 +13,8 @@
     {
         "id":"002",
         "language":"shell",
-        "filename":"arch.sh",
-        "title":"Arch Linux Installation Script",
+        "filename":"arch/install.sh",
+        "title":"Arch Linux Bootstrap",
         "description":[
             "This script automates the installation of Arch Linux with a Btrfs filesystem, including subvolume setup, base system install, and bootloader configuration.",
             "It guides you through input prompts (disk, username, timezone, etc.) and logs all actions and output for troubleshooting.",