Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Function to display banners
- display_banners() {
- echo "==================================================="
- echo " Windows Installation Script for Linux "
- echo " by @willygoid "
- echo "==================================================="
- echo " "
- echo " Default username: Administrator or Admin "
- echo " Default password: Willy.pro "
- echo "==================================================="
- echo
- }
- # Function to check and install required packages
- check_and_install() {
- for package in wget unpigz coreutils; do
- if ! command -v "$package" &> /dev/null; then
- echo "$package not found. Installing..."
- if [ "$(uname -s)" == "Linux" ]; then
- # Assuming a Debian-based system for installation
- sudo apt-get update
- sudo apt-get install -y "$package"
- else
- echo "Unsupported OS. Please install $package manually."
- exit 1
- fi
- fi
- done
- }
- # Function to check available disks and prompt user to select one
- select_disk() {
- local valid_disks=("/dev/sda" "/dev/sdb" "/dev/vda" "/dev/vdb")
- local disks_found=()
- for disk in "${valid_disks[@]}"; do
- if [ -e "$disk" ]; then
- disks_found+=("$disk")
- fi
- done
- if [ ${#disks_found[@]} -eq 0 ]; then
- echo "No valid disks found for installation."
- exit 1
- fi
- echo "Available disks:"
- for disk in "${disks_found[@]}"; do
- echo "- $disk"
- done
- while true; do
- read -p "Enter the disk to install to (e.g., /dev/sda): " selected_disk
- if [[ " ${disks_found[*]} " == *" $selected_disk "* ]]; then
- echo "You have selected $selected_disk for installation."
- break
- else
- echo "Invalid choice. Please enter a valid disk from the list above."
- fi
- done
- }
- # Display banners
- display_banners
- # Check and install required packages
- check_and_install
- # Select available disk
- select_disk
- while true; do
- clear
- echo "Select an option to install:"
- echo "1. Install Windows Server 2012"
- echo "2. Install Windows Server 2016"
- echo "3. Install Windows Server 2019"
- echo "4. Install Windows Server 2022"
- echo "5. Install Windows 10"
- echo "6. Install windows 10 XP"
- echo "7. Install Windows 11"
- echo "8. Install Windows 11 Neon"
- echo " "
- echo " "
- echo " "
- echo "0. Quit"
- read -p "Enter your choice: " choice
- case $choice in
- 1)
- wget -O- --no-check-certificate "https://repo.willy.pro/win2012.gz" | unpigz | dd of="$selected_disk" status=progress
- ;;
- 2)
- wget -O- --no-check-certificate "https://repo.willy.pro/win2016.gz" | unpigz | dd of="$selected_disk" status=progress
- ;;
- 3)
- wget -O- --no-check-certificate "https://repo.willy.pro/win2019.gz" | unpigz | dd of="$selected_disk" status=progress
- ;;
- 4)
- wget -O- --no-check-certificate "https://repo.willy.pro/win2022.gz" | unpigz | dd of="$selected_disk" status=progress
- ;;
- 5)
- wget -O- --no-check-certificate "https://repo.willy.pro/win10.gz" | unpigz | dd of="$selected_disk" status=progress
- ;;
- 6)
- wget -O- --no-check-certificate "https://repo.willy.pro/win10xp.gz" | unpigz | dd of="$selected_disk" status=progress
- ;;
- 7)
- wget -O- --no-check-certificate "https://repo.willy.pro/win11.gz" | unpigz | dd of="$selected_disk" status=progress
- ;;
- 8)
- wget -O- --no-check-certificate "https://repo.willy.pro/win11neon.gz" | unpigz | dd of="$selected_disk" status=progress
- ;;
- 0)
- echo "Quitting..."
- exit 0
- ;;
- *)
- echo "Invalid option, please try again."
- read -p "Press Enter to continue..."
- ;;
- esac
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement