diff --git a/README.md b/README.md index 79eb2cf..3286a85 100644 --- a/README.md +++ b/README.md @@ -7,13 +7,13 @@ The goal is a program that can install Linux on an existing Windows machine with ## Status This project is a pre-release. -There is a lot of work left to do in terms of quality and features. +There is a lot of work left to do in terms of features and quality. ### Requirements * Windows 10, 64 bit -* Single unencrypted hard drive hosting the C: volume -* UEFI +* Single drive hosting the C: volume +* UEFI (supports secure boot) * At least 4 GB RAM * At least 15 GB of free disk space on C: * Administrator user permissions @@ -22,9 +22,9 @@ There is a lot of work left to do in terms of quality and features. ### Limitations -* Currently, Tunic only installs [Linux Mint with Cinnamon, 64 bit](https://blog.linuxmint.com/?p=3832). -* We are working on support for Windows 7 and 8, MBR, and other Debian/Ubuntu based Linux distros. -* Error handling needs improvement. A failed install could leave the system in an undesirable state. +* Currently, Tunic only installs [Linux Mint 64 bit](https://blog.linuxmint.com/?p=3832). +* We are working on testing Windows 7 and 8, MBR, and support for other Debian/Ubuntu based Linux distros. +* Error handling needs improvement. ### What Tunic Does @@ -46,6 +46,8 @@ Before you start, make sure to backup up your entire disk(s). Tunic does not assist with full disk backup. Read disclaimer for more information. +No, really. Backup your data. + ### Usage 1. Download and run the latest .exe file from releases. diff --git a/files/distros.ps1 b/files/distros.ps1 index b5b3ac8..d5c938b 100644 --- a/files/distros.ps1 +++ b/files/distros.ps1 @@ -10,7 +10,8 @@ @{ name='Linux Mint - Xfce - 19.3'; url='http://mirrors.gigenet.com/linuxmint/iso/stable/19.3/linuxmint-19.3-xfce-64bit.iso'; - }, + } + <# Untested distros. @{ name='Ubuntu 18.04/LTS'; url='http://releases.ubuntu.com/18.04.3/ubuntu-18.04.3-desktop-amd64.iso'; @@ -27,5 +28,6 @@ name='Pop!_OS - 19.10'; url='https://pop-iso.sfo2.cdn.digitaloceanspaces.com/19.10/amd64/intel/11/pop-os_19.10_amd64_intel_11.iso'; } + #> ) diff --git a/test/test-setup.ps1 b/test/test-setup.ps1 index 3db2ef3..eda3158 100644 --- a/test/test-setup.ps1 +++ b/test/test-setup.ps1 @@ -16,7 +16,7 @@ If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdent } Write-host "Started." -$iso_url='http://mirrors.kernel.org/linuxmint/stable/19.3/linuxmint-19.3-cinnamon-64bit.iso' +$iso_url='http://mirrors.gigenet.com/linuxmint/iso/stable/19.3/linuxmint-19.3-cinnamon-64bit.iso' $letter = $env:HOMEDRIVE[0] $tunic_dir="${env:ALLUSERSPROFILE}\tunic" @@ -80,7 +80,7 @@ New-ItemProperty -Path "$loginPath" -Name DefaultPassword -Value "$password" -fo # DNS #TODO: $gateway = (Get-NetIPConfiguration).ipv4defaultgateway.nexthop -#TODO: add-content 'C:\Windows\System32\drivers\etc\hosts' "$gateway mirrors.kernel.org" +#TODO: add-content 'C:\Windows\System32\drivers\etc\hosts' "$gateway mirrors.gigenet.com" # Desktop Icons diff --git a/tunic.ps1 b/tunic.ps1 index f423026..8a6070c 100644 --- a/tunic.ps1 +++ b/tunic.ps1 @@ -112,6 +112,11 @@ function die($msg) { exit 1 } +function say($msg) { + write-host $msg + [System.Windows.Forms.Messagebox]::Show($msg) +} + function yes($q) { $buttons = [System.Windows.Forms.MessageBoxButtons]::YesNo return [System.Windows.Forms.MessageBox]::Show($q,"Tunic", $buttons ) -eq "Yes" @@ -155,7 +160,8 @@ function checks() { $blInfo = Get-Bitlockervolume if( $blInfo.ProtectionStatus -eq 'On' ) { - die( 'Bitlocker encrypted drive not supported.' ) + $recoveryKey = (Get-BitLockerVolume -MountPoint 'C').KeyProtector + say( "Bitlocker may have issues with dual boot. Write down your recovery key: $recoveryKey" ) } } @@ -164,19 +170,46 @@ function downloadIso() { $iso_file = getUrlFile($global:data.iso_url) if ( -not (Test-Path "$iso_path") ) { $ciso = "Z:\Downloads\$iso_file" - if ( Test-Path "$ciso" ) { + if ( Test-Path "ciso" ) { copy "$ciso" "$iso_path" } else { + Import-Module BitsTransfer + $url = $global:data.iso_url + + $bits = ( Start-BitsTransfer -DisplayName $url -Source $url -Destination $iso_path -Asynchronous ) try { - (New-Object System.Net.WebClient).DownloadFile($global:data.iso_url, "$iso_path") + #TODO: use a callback instead of direct updates. + $global:dlStatus.text = 'Connecting...' + While ($Bits.JobState -eq "Connecting") { + sleep 1 + [System.Windows.Forms.Application]::DoEvents() + } + $global:dlStatus.text = 'Transferring...' + While ($Bits.JobState -eq "Transferring" -and $Bits.BytesTransferred -lt ( 1GB / 100 ) ) { + sleep 1 + [System.Windows.Forms.Application]::DoEvents() + } + While ($Bits.JobState -eq "Transferring") { + if ($Bits.JobState -eq "Error"){ + Resume-BitsTransfer -BitsJob $Bits + } + $state = $bits.jobState + $pct = [int](($Bits.BytesTransferred*100) / $Bits.BytesTotal) + $global:dlStatus.text = "$pct% complete" + sleep 1 + [System.Windows.Forms.Application]::DoEvents() + } #TODO: save to temp and move after. #TODO: verify integrity } catch { - write-host "Error downloading $( $global:data.iso_url ) to $iso_path" + write-host "Error downloading $url to $iso_path" write-host $_ Remove-Item "$iso_path" Throw "Download failed" } + finally { + $Bits | Complete-BitsTransfer + } } } }