Skip to content

Commit b559f9e

Browse files
mikeslatteryMichael Slattery
authored andcommitted
Python version. Incomplete.
1 parent c0d4f68 commit b559f9e

File tree

4 files changed

+607
-0
lines changed

4 files changed

+607
-0
lines changed

doc/next.md

Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,279 @@
1+
# Tunic Linux Installer for Windows
2+
# Copyright (c) Michael Slattery under GPLv3 with NO warranty.
3+
# For more info see https://www.gnu.org/licenses/gpl-3.0.html#section15
4+
5+
# 'Elementary OS - 5.1' = '';
6+
# 'Zorin OS - 15.1' = '';
7+
# 'Debian - 10/buster' = '';
8+
# 'Debian - Testing' = '';
9+
# 'AntiX - 19.1' = '';
10+
# 'KDE Neon'
11+
12+
13+
```
14+
```
15+
### tunic.ps1
16+
- test full install
17+
* windows 7
18+
- disable updates
19+
* Windows 7 / Python
20+
- new branch
21+
- python3, gtk, 32 bit, no choco
22+
- hello world - show hi/hello.txt
23+
- deploy with subdirs to windows 7 32 bit
24+
- arch: unit tests, MVP, mock OS
25+
- classes: powershell, wmi, exec
26+
- versions
27+
- defer to ubiquity, [x] disclaimer, static cfg
28+
- download iso, progress page
29+
- checks
30+
- locale/dynamic preseed
31+
- distro picker
32+
- user
33+
- install type, disk sizing
34+
* Downloads
35+
- If pwsh<3, install .NET 4.5. Check for and download
36+
https://docs.microsoft.com/en-us/powershell/scripting/wmf/setup/install-configure?view=powershell-7
37+
`Start-Process -FilePath D:\path\to\dotnetfx45_full_x86_x64.exe -ArgumentList "/q /norestart" -Wait -Verb RunAs`
38+
`echo $?`
39+
- If pwsh<3, install Powershell 3 for Windows 7 w/WMI, WinRM.
40+
* Check pending updates on restart
41+
* Require 6.1.7601 (64 bit)
42+
* $mount test
43+
* distros
44+
$vmlinux = (dir 'D:\' -file -filter '*vmlinu*' -recurse).FullName.toLower() -replace '^\w:','' -replace '\\','/'
45+
$initrd = (dir 'D:\' -file -filter '*initrd*' -recurse).FullName.toLower() -replace '^\w:','' -replace '\\','/'
46+
47+
# only work if a single hit. otherwise use default, even if it doesn't exist
48+
#$global:data.iso_url = 'ubuntu-18.04.3-desktop-amd64.iso'
49+
#$global:data.iso_url = 'deepin-15.11-amd64.iso'
50+
import and modify grub /boot/grub/grub.cfg
51+
prefix (usb) to all paths
52+
grep linux grub.cfg | sed -r 's|([ \t=])/|\1(usb)/|g; s| file=[^ ]+ | |g s|iso-scan/filename=[^ ]+||g'
53+
add "kernel-params" to distros.ps1 - e.g. automatic-ubiquity
54+
inject preseed: file=, iso-scan/filename=
55+
reduce timeout or add if not exists. 3s
56+
* distro test - debug mode
57+
- preseed on success command that writes to a shared folder to let host know it all worked!
58+
- install vbox additions
59+
- log files
60+
- snapshot
61+
- shut down VM after startup
62+
- copy .iso back to host, if not exists
63+
- test waits for shutdown of VM and moves to next distro
64+
- on a very long timeout, kill it and mark as failure.
65+
- check that a snapshot was created
66+
* Ubuntu 19.10 errors - can't umount /cdrom
67+
* Download all dependencies and package, if compatible
68+
- grub-for-windows.zip
69+
- 18.04's grubx64.efi
70+
- PopOS's shimx64.efi
71+
- windowsZones.xml
72+
- 7z.exe (may not need it)
73+
- THIRDPARTYLICENSE
74+
* List of legal Qs
75+
- best way to list 3rd party licenses
76+
- license for shimx64?
77+
- gpl2 usable?
78+
* nvidia R&D
79+
* keyboard
80+
* full-disk: wait X min, screenshot
81+
- branch
82+
- checkout various commit-id's or stashes
83+
* debug boolean in $data
84+
- branch
85+
- fast - skip extra packages
86+
- install vbox guest additions
87+
- install openssh-server
88+
* How to help doc
89+
- relax risk
90+
* tesserat
91+
* MBR
92+
* Win 7. VM. Test
93+
* Win 7, EFI/MBR, 32/64 bit (hardware) testing
94+
* reboot-continue (to delete swap)
95+
* Advanced options
96+
* icons: os-uninstall, Windows files,
97+
* 1.0
98+
* abort.sh (also before.sh, after.sh)
99+
* bitlocker
100+
- get recovery key and tell user to write it down.
101+
- GRUB_TERMINAL=console
102+
- requires secure boot.
103+
- https://www.ctrl.blog/entry/dual-boot-bitlocker-device.html
104+
* uninstall - bcd import, delete part2, expand C:, delete tunic grub
105+
* log dump
106+
* pre-install: bit-torrent client seeding ubuntu installs
107+
* 32 bit
108+
* if laptop install TLP http://www.techcrafters.com/scripts/windows-system-management/determine-whether-a-machine-is-laptop-or-not.html
109+
### Testing
110+
### Bling
111+
* ico
112+
* Spash (during free space calc)
113+
* screenshot(s)
114+
### tech debt
115+
* download to temp file and move
116+
* hash password
117+
* distros: key, sig url
118+
* nsis - ico
119+
* grub protection task
120+
* test bcd restore
121+
* grub-installer update-grub workaround in preseed.cfg
122+
* grub move to $ESP/tunic
123+
* after.sh
124+
* refactor - squash + hide, cli api, globals
125+
---
126+
* keyboard select - https://github.com/linuxmint/ubiquity/blob/master/ubiquity/misc.py#L672
127+
* detect pending updates. refuse to install
128+
129+
Help me
130+
* GPL headers
131+
* shim
132+
* screenshot
133+
134+
135+
* calc avilable as partition gap + sizemin - 2.1
136+
* required vs supported
137+
138+
cards: checks, input, advanced, progress
139+
140+
## Check
141+
* Always show (even if briefly)
142+
* if all succeed, go to next
143+
* if fail, exit, re-check buttons.
144+
145+
## Basic questions
146+
* C: size, free
147+
* disk number: 1
148+
* Shrink Windows by: 10 GB
149+
* available space
150+
* "Tunic will use available space."
151+
* [Clean] button
152+
* Username(current) + Password + Password
153+
* Computer name
154+
* Distro: [Linux Mint, Cinnamon, 64 bit]
155+
* [ ] Advanced
156+
* [ ] Agree
157+
* Continue
158+
159+
# Advanced options
160+
* ISO URL or file: https://...
161+
* Browse Config files (dir of generated preseed.cfg, grub.cfg, ks.cfg)
162+
* [ ] Skip shrink partition (clean, disable swap, defrag, reboot-cont)
163+
* [ ] Skip Ubiquity UI
164+
* [x] Reboot now
165+
166+
# validation
167+
* https://stackoverflow.com/questions/4645126/looking-for-regex-code-for-hostname-machine-name-validation
168+
* https://stackoverflow.com/questions/1221985/how-to-validate-a-user-name-with-regex
169+
* everything is non null
170+
* shrink <= available
171+
* either: shrink size or unused space is > ubuntu requirement + iso + new-efi
172+
* accept = checked
173+
174+
## Basic questions - progress
175+
176+
* PSJob in background
177+
* Abort button
178+
* if, MBR unhide Continue button
179+
* Converting to EFI n/a (don't auto-reboot if this is done)
180+
* Remove swap
181+
* Defragmenting Done
182+
* Add swap
183+
* Partitioning In Progress
184+
* Downloading To do
185+
* enable Continue
186+
187+
# preseed values
188+
(Get-WinSystemLocale).name -eq 'en-US'
189+
(Get-WinSystemLocale).textInfo.culturename -eq 'en'
190+
(Get-Culture).TwoLetterISOLanguageName -eq 'en'
191+
(Get-Culture).Name -eq 'en-US'
192+
(New-Object System.Globalization.RegionInfo (Get-Culture).Name).TwoLetterISORegionName -eq 'US'
193+
194+
195+
# loop
196+
$form = None
197+
while($true) {
198+
if(! $form ) $form.close()
199+
source view.ps1
200+
$form.show()
201+
}
202+
203+
https://imgur.com/a/4xC0xsa
204+
<# Failed testing, usu. because of paths.
205+
@{
206+
name='Pop!_OS - 19.10';
207+
url='https://pop-iso.sfo2.cdn.digitaloceanspaces.com/19.10/amd64/intel/11/pop-os_19.10_amd64_intel_11.iso';
208+
}
209+
@{
210+
name='Pop!_OS - 18.04/LTS';
211+
url='https://pop-iso.sfo2.cdn.digitaloceanspaces.com/18.04/amd64/intel/58/pop-os_18.04_amd64_intel_58.iso';
212+
},
213+
@{
214+
name='Deepin 15.11';
215+
url='https://osdn.net/projects/deepin/storage/15.11/deepin-15.11-amd64.iso';
216+
}
217+
#>
218+
219+
insmod ntfs
220+
insmod part_gpt
221+
222+
# get iso_path, real_iso_path and preseed_path
223+
source /boot/grub/grub.var.cfg
224+
source /boot/grub/grub.params.cfg
225+
226+
set iso_path="$real_iso_path automatic-ubiquity"
227+
228+
# Load distro's cfg with iso root
229+
```
230+
set efi="$root"
231+
search --set=ntfs --file "$real_iso_path"
232+
loopback loop ($ntfs)"$real_iso_path"
233+
set root=(loop)
234+
source /boot/grub/grub.cfg
235+
set root="$efi"
236+
237+
set timeout=3
238+
239+
#TODO: win menu goes there
240+
linux /casper/vmlinuz file=/cdrom/preseed/linuxmint.seed boot=casper iso-scan/filename=${iso_path} quiet splash --
241+
initrd /casper/initrd.lz
242+
243+
linux (loop)/casper/vmlinuz file=/isodevice${tunic_dir}/preseed.cfg automatic-ubiquity boot=casper iso-scan/filename=${iso_path} toram noprompt --
244+
initrd (loop)/casper/initrd.lz
245+
-----
246+
pip install pyinstaller
247+
pip install pywin32 wmi
248+
pip install wmi
249+
250+
--- windows7
251+
sed -rn '/^\s*+#/d; /\{/d; s/remove-item//i; s/new-object//i; s/start-process//i; s/write-host//i; s/out-null//i; s/[gs]et-content//i; s/test-path//i; s/where-object//i; s/^.*\b(\w+-\w+).*$/\1/p' tunic.ps1 | tr '[A-Z]' '[a-z]' | grep -Ev 'as-is|import-module|new-itemproperty|pop-os|re-part|set-loca|windirstat|xfce|7-zip|desktop-amd|remove-item|restart-computer|re-enabl' | sort | uniq -c | sort
252+
```
253+
r!xsel -o
254+
255+
/disable-windowserrorreporting
256+
/enable-windowserrorreporting
257+
enable-computerrestore
258+
disable-computerrestore
259+
260+
get-culture
261+
/get-timezone
262+
263+
/complete-bitstransfer
264+
/resume-bitstransfer
265+
/start-bitstransfer
266+
267+
add-type
268+
269+
/get-bitlockervolume
270+
271+
/confirm-securebootuefi
272+
/optimize-volume
273+
/get-partitionsupportedsize
274+
/resize-partition
275+
/get-volume
276+
/get-disk
277+
/dismount-diskimage
278+
/get-partition
279+

0 commit comments

Comments
 (0)