added installer shell script and additional steps

This commit is contained in:
tumillanino
2025-10-28 22:53:15 +11:00
parent 6f1a6f6efa
commit 27ca5a9426
11 changed files with 644 additions and 0 deletions

61
tui/steps/hostname.go Normal file
View File

@@ -0,0 +1,61 @@
package steps
import (
"miasma-installer/tui/styles"
"github.com/charmbracelet/bubbles/textinput"
tea "github.com/charmbracelet/bubbletea"
)
type HostnameModel struct {
Hostname string
input textinput.Model
Finished bool
}
func NewHostnameModel() HostnameModel {
ti := textinput.New()
ti.Placeholder = "miasma"
ti.Focus()
ti.CharLimit = 63
return HostnameModel{
input: ti,
}
}
func (m HostnameModel) Init() tea.Cmd {
return textinput.Blink
}
func (m HostnameModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if m.Finished {
return m, nil
}
switch msg := msg.(type) {
case tea.KeyMsg:
switch msg.String() {
case "enter":
if m.input.Value() != "" {
m.Hostname = m.input.Value()
m.Finished = true
return m, nil
}
}
}
var cmd tea.Cmd
m.input, cmd = m.input.Update(msg)
return m, cmd
}
func (m HostnameModel) View() string {
s := styles.TitleStyle.Render("System Hostname")
s += "\n\n"
s += "Enter a hostname for your system:\n\n"
s += m.input.View() + "\n\n"
s += styles.HelpStyle.Render("[Enter] Continue")
return styles.MainStyle.Render(s)
}