Advertisement
willysec_id

Windows Template Auto Install

Oct 21st, 2024
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.15 KB | Source Code | 0 0
  1. #!/bin/bash
  2.  
  3. # Function to display banners
  4. display_banners() {
  5.     echo "==================================================="
  6.     echo "       Windows Installation Script for Linux       "
  7.     echo "                               by @willygoid       "
  8.     echo "==================================================="
  9.     echo "                                                   "
  10.     echo "    Default username: Administrator or Admin       "
  11.     echo "    Default password: Willy.pro                    "
  12.     echo "==================================================="
  13.     echo
  14. }
  15.  
  16. # Function to check and install required packages
  17. check_and_install() {
  18.     for package in wget unpigz coreutils; do
  19.         if ! command -v "$package" &> /dev/null; then
  20.             echo "$package not found. Installing..."
  21.             if [ "$(uname -s)" == "Linux" ]; then
  22.                 # Assuming a Debian-based system for installation
  23.                 sudo apt-get update
  24.                 sudo apt-get install -y "$package"
  25.             else
  26.                 echo "Unsupported OS. Please install $package manually."
  27.                 exit 1
  28.             fi
  29.         fi
  30.     done
  31. }
  32.  
  33. # Function to check available disks and prompt user to select one
  34. select_disk() {
  35.     local valid_disks=("/dev/sda" "/dev/sdb" "/dev/vda" "/dev/vdb")
  36.     local disks_found=()
  37.    
  38.     for disk in "${valid_disks[@]}"; do
  39.         if [ -e "$disk" ]; then
  40.             disks_found+=("$disk")
  41.         fi
  42.     done
  43.  
  44.     if [ ${#disks_found[@]} -eq 0 ]; then
  45.         echo "No valid disks found for installation."
  46.         exit 1
  47.     fi
  48.  
  49.     echo "Available disks:"
  50.     for disk in "${disks_found[@]}"; do
  51.         echo "- $disk"
  52.     done
  53.  
  54.     while true; do
  55.         read -p "Enter the disk to install to (e.g., /dev/sda): " selected_disk
  56.         if [[ " ${disks_found[*]} " == *" $selected_disk "* ]]; then
  57.             echo "You have selected $selected_disk for installation."
  58.             break
  59.         else
  60.             echo "Invalid choice. Please enter a valid disk from the list above."
  61.         fi
  62.     done
  63. }
  64.  
  65. # Display banners
  66. display_banners
  67.  
  68. # Check and install required packages
  69. check_and_install
  70.  
  71. # Select available disk
  72. select_disk
  73.  
  74. while true; do
  75.     clear
  76.     echo "Select an option to install:"
  77.     echo "1. Install Windows Server 2012"
  78.     echo "2. Install Windows Server 2016"
  79.     echo "3. Install Windows Server 2019"
  80.     echo "4. Install Windows Server 2022"
  81.     echo "5. Install Windows 10"
  82.     echo "6. Install windows 10 XP"
  83.     echo "7. Install Windows 11"
  84.     echo "8. Install Windows 11 Neon"
  85.     echo " "
  86.     echo " "
  87.     echo " "
  88.     echo "0. Quit"
  89.     read -p "Enter your choice: " choice
  90.  
  91.     case $choice in
  92.         1)
  93.             wget -O- --no-check-certificate "https://repo.willy.pro/win2012.gz" | unpigz | dd of="$selected_disk" status=progress
  94.             ;;
  95.         2)
  96.             wget -O- --no-check-certificate "https://repo.willy.pro/win2016.gz" | unpigz | dd of="$selected_disk" status=progress
  97.             ;;
  98.         3)
  99.             wget -O- --no-check-certificate "https://repo.willy.pro/win2019.gz" | unpigz | dd of="$selected_disk" status=progress
  100.             ;;
  101.         4)
  102.             wget -O- --no-check-certificate "https://repo.willy.pro/win2022.gz" | unpigz | dd of="$selected_disk" status=progress
  103.             ;;
  104.         5)
  105.             wget -O- --no-check-certificate "https://repo.willy.pro/win10.gz" | unpigz | dd of="$selected_disk" status=progress
  106.             ;;
  107.         6)
  108.             wget -O- --no-check-certificate "https://repo.willy.pro/win10xp.gz" | unpigz | dd of="$selected_disk" status=progress
  109.             ;;
  110.         7)
  111.             wget -O- --no-check-certificate "https://repo.willy.pro/win11.gz" | unpigz | dd of="$selected_disk" status=progress
  112.             ;;
  113.         8)
  114.             wget -O- --no-check-certificate "https://repo.willy.pro/win11neon.gz" | unpigz | dd of="$selected_disk" status=progress
  115.             ;;
  116.         0)
  117.             echo "Quitting..."
  118.             exit 0
  119.             ;;
  120.         *)
  121.             echo "Invalid option, please try again."
  122.             read -p "Press Enter to continue..."
  123.             ;;
  124.     esac
  125. done
  126.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement