Skip to content

Commit

Permalink
dl progress. only mint.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeslattery committed Jan 31, 2020
1 parent 4632866 commit d9f686d
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 13 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion files/distros.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
}
#>
)

4 changes: 2 additions & 2 deletions test/test-setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand Down
41 changes: 37 additions & 4 deletions tunic.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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" )
}
}

Expand All @@ -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
}
}
}
}
Expand Down

0 comments on commit d9f686d

Please sign in to comment.