#!/bin/bash # Define color variables LIGHT_BLUE='\033[1;34m' LIGHT_GREEN='\033[1;32m' NC='\033[0m' # No Color # Clear the screen first clear # Check if the script is run as root, if not, attempt to switch to root using sudo -i if [ "$(id -u)" -ne 0 ]; then echo -e "${LIGHT_BLUE}This script requires root privileges!${NC}" echo -e "${LIGHT_BLUE}Attempting to switch to root using 'sudo -i'...${NC}" exec sudo -i "$0" "$@" # exit 1 fi # Ensure the network is active if ! systemctl is-active --quiet network-online.target; then echo -e "${LIGHT_BLUE}Something went wrong!${NC}" echo -e "${LIGHT_BLUE}The host Network is not active!${NC}" # Check if wireless network is inactive if ! systemctl is-active --quiet wpa_supplicant; then echo -e "${LIGHT_BLUE}Wireless network is inactive. Are you using ethernet? Checking whether the wired network is activated.${NC}" # Check if any wired network interface is up wired_interface=$(ip link show up | grep -v 'lo\|wlan\|wlp' | awk '{print $2}' | sed 's/://') if [ -n "$wired_interface" ]; then echo -e "${LIGHT_BLUE}Wired network interface $wired_interface is up.${NC}" else echo -e "${LIGHT_BLUE}Something went wrong! No wired network interface is up.${NC}" echo -e "${LIGHT_BLUE}Please check if the wired network cable is plugged in or if the device is in 'down' mode.${NC}" echo -e "${LIGHT_BLUE}For more details, visit https://nixos.org/manual/nixos/stable/#sec-installation-manual-networking${NC}" exit 1 fi else echo -e "${LIGHT_BLUE}Wireless network is active. Continuing the installation process.${NC}" fi fi clear # Print title echo -e "${LIGHT_GREEN}Welcome to Yaksha!${NC}" echo -e "${LIGHT_GREEN}The Installation Script of LingmoNix." echo -e "(C) 2025 By Yaksha Project" echo -e "This script is only for INSTALL LingmoNix AS SINGLE BOOT." echo -e "Dual-boot is not supported." echo "---------------------------------" # Step 1: Automatically detect boot mode (UEFI or BIOS) echo -e "${LIGHT_GREEN}1. Detecting boot method${NC}" if [ -f /sys/firmware/efi/fw_platform_size ]; then echo -e "${LIGHT_GREEN}UEFI boot mode detected.${NC}" boot_type="UEFI" else echo -e "${LIGHT_GREEN}BIOS boot mode detected.${NC}" boot_type="BIOS" fi # Step 2: Automatically partition the disk echo -e "${LIGHT_GREEN}2. Auto partitioning${NC}" echo "Starting auto partitioning..." echo -e "${LIGHT_BLUE}Please enter the target disk device (e.g., /dev/sda):${NC}" echo "---------------------------------" echo -e "Your host device are:" lsblk echo "---------------------------------" while true; do read -p "Choose a disk: " disk /dev/null; then echo "Setting password for user '$username'." passwd "$username" echo -e "${LIGHT_GREEN}Password for user '$username' has been set.${NC}" else echo -e "${LIGHT_BLUE}User '$username' does not exist! Please try again!${NC}" continue fi # Step 7: Install Cutefish Desktop (optional) echo -e "${LIGHT_GREEN}7. Installing Cutefish Desktop (optional)${NC}" read -p "[For Experimental] Would you like to install the Cutefish Desktop? (y/n): " install_cutefish