Skip to content

Commit

Permalink
go
Browse files Browse the repository at this point in the history
  • Loading branch information
mslattery-lilly committed Aug 18, 2020
1 parent 9ca89c5 commit fa5d4a4
Show file tree
Hide file tree
Showing 6 changed files with 191 additions and 34 deletions.
9 changes: 5 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ indent_size = 4
trim_trailing_whitespace = true
end_of_line = lf

[*.{cmd,bat}]
end_of_line = crlf

[*.{ps1,psm1,psd1,nsi}]
[*.{cmd,bat,ps1,psm1,psd1,nsi}]
end_of_line = crlf

[*.{ps1xml,props,xml.yaml,yml}]
Expand All @@ -22,6 +19,10 @@ indent_size = 2
[*.md]
indent_size = undef

[*.go]
indent_style = tab

[{LICENSE,garbage.txt}]
indent_size = undef
trim_trailing_whitespace = undef

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
tunic.exe
tunic
tmp
*.ova
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
include test.mk

default: unittest

tunic.exe: main.go
GOOS=windows GOARCH=amd64 go build -o tunic.exe

tunic: main.go
GOOS=linux GOARCH=amd64 go build

# public aliases (phony)

clean:
go clean
rm -f tunic.exe tunic

build: tunic.exe tunic

run: main.go
go run main.go

all: clean unittest tunic tunic.exe

#TODO:
# aliases: https://stackoverflow.com/questions/23135840/alias-target-name-in-makefile/33594470#33594470
#

123 changes: 93 additions & 30 deletions doc/junk/garbage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,38 +140,101 @@ golang
* github actions for builds
* uac - https://gist.github.com/jerblack/d0eb182cc5a1c1d92d92a4c4fcc416c6

* mvp 0 - just lets you know if system is compatible with Tunic
- no GUI
- Github actions
- validations
- 32 bit
* mvp 1 - CLI to install tunic given a .iso file. non-interactive.
pipeline
* pandoc
- github markdown
- plantuml
* makefiles and targets
- vagrant to build Windows 7/10 VM
- build tunic.exe (x-compile)
- test on GHA Windows
- test ubiquity on GHA ubuntu
- markdown gfm to pandoc
* testing
- GHA ubuntu or linux desktop - headless fyne unit testing
- GHA Windows or VB-shell - partial functional testing (just not reboot)
- in-between - change /proc/cmdline reading in ubuiquity as output from previous step's grub.cfg
- GHA Ubuntu or docker - partial functional testing - grub-emu, ubiquity, xvfb
- not GHA but linux/VB/Windows - functional testing

Specific checks
* grub2-script-check
* shellcheck -s ksh grub.cfg
* override value of /proc/cmdline
* See if unetbootin distro list updated. Compile just enough C++ code to generate a config file.
* mvp 0 - --help --no-run

* MVP 0 - Download and run last powershell version of tunic.exe. Manual build.
* Github actions: Windows-based build and test script for Go.
* release draft versions after `git push tag` on “develop” branch
* MVP 1
- Download Mint Cinnamon latest.
- Copy .iso argument to efi
- copy grub files onto efi
- install grub
- reboot
* disable fastboot
* secure boot
* Download Mint Cinnamon latest
* GUI MVP
- single page
- read-only fields: disclaimer, progress
- buttons: ok, quit/cancel
* UAC
* disclaimer checkbox
* progress page
* ubuntu and mint flavors pulldown
- install grub and reboot.
* secure boot support.
* UAC elevate - https://github.com/mozey/run-as-admin
* disable Windows fastboot.
* validations  (e.g. UEFI, WIndows 10 64 bit, etc).
* MVP 2 milestone - Hassle free.  No extra steps by users.
- switch to master branch
- start deploying releases (instead of drafts)
* refactor
- Go “best practice” project structure
- static checkers
- Vagrant
- Makefiles
* GUI - "Are you sure?"  pop-up
* Single page GUI: ok, quit, progress  (no cancel)
* mint and ubuntu flavors pulldown
* progress %, cancel
- Retries. Continue on failure. (HEAD, Range)
* MVP 3 milestone - Nice GUI.
* Refactor
- Unstrangle.
- 32 bit .exe on 64 bit OS
* preseed basics (locale, TZ, kb)
* install type
* free space page w/o utilities
* user pane
* auto reboot into linux (if not custom)
* free space page w/utilities
* iso list from unetbootin, multibootusb
* grub cleanup post-install
* auto release on push to master
* email me on master build failures
* auto upate iso list in GHA once a week
* Install types
- install type field and preseed
- free space pane w/o utilities
* user fields pane
* auto reboot into linux (if no user input required from ubiquity)
* free space pane w/utilities
* LUKS. Password
* MVP 4 milestone - Feature parity with powershell Tunic
* Windows Task - in powershell
- Delete Tunic's custom grub
- Fix missing Grub
* Win 7, 32 bit, MBR support.
* Win XP 32 bit support (64 bit in future)
- "Install alongside..." not provided.
* Testing matrix: Win XP/7/10, 32/64, MBR/EFI, BIOS/GPT
* More distros and means for download
- Embed Grub For Windows
- kickstart support
- iso list from unetbootin, multibootusb
- aria2 or similar, metalink
* distro filters
- 32 Bit
- Supports secure boot
- Author's choice: Lightweight
- Author's choice: Beginner Friendly


References
* https://github.com/anacrolix/torrent
* aria2 - https://github.com/zyxar/argo
* https://github.com/golang-standards/project-layout
* example app - https://github.com/Jacalz/sparta
* example app - https://github.com/airplayx/gormat
* iso fs - https://github.com/diskfs/go-diskfs
* repl - https://stackoverflow.com/questions/8513609/does-go-provide-repl

Research
* username, computername
* diskspace `disableSwap(), clean(), defrag()`
* `checks()`




-----
Expand Down
50 changes: 50 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package main

import (
"log"
"net/http"
"io"
"os"
"os/exec"
)

/**
* Tunic Linux Installer
*
* This is just something to get us started with very minimal MVP.
* The MVP just downloads the old Tunic and runs it.
*/
func Download() error {
resp, err := http.Get("https://github.com/mikeslattery/tunic/releases/download/0.2.4/tunic.exe")
if err != nil {
return err
}
defer resp.Body.Close()

out, err := os.Create("tunic.exe")
if err != nil {
return err
}
defer out.Close()

_, err = io.Copy(out, resp.Body)
return err
}

func Run() error {
cmd := exec.Command("tunic.exe")
err := cmd.Run()
return err
}

func main() {
err := Download()
if err != nil {
err = Run()
}
if err != nil {
log.Fatal(err)
os.Exit(1)
}
}

15 changes: 15 additions & 0 deletions test.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
download-vm10:
# Found at https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/
#TODO: https://app.vagrantup.com/Microsoft/boxes/EdgeOnWindows10
curl -L 'https://az792536.vo.msecnd.net/vms/VMBuild_20190311/VirtualBox/MSEdge/MSEdge.Win10.VirtualBox.zip'
unzip MSEdge.Win10.VirtualBox.zip
rm MSEdge.Win10.VirtualBox.zip
#TODO: create 'MSEdge - Win10.ova'

unittest: main.go
go test

loop:
# TODO: recusrive on all source input: .go, resources, images, etc
while :; do inotifywait -qq -r -e create,close_write,modify,move,delete ./ && go test ./...; done

0 comments on commit fa5d4a4

Please sign in to comment.