Add no-simple-init flag
This commit is contained in:
parent
a119d6ac19
commit
97a5127a59
105
cmd/deploy.go
105
cmd/deploy.go
|
@ -23,7 +23,9 @@ var username string
|
||||||
var password string
|
var password string
|
||||||
var serail string
|
var serail string
|
||||||
var partsize string
|
var partsize string
|
||||||
|
var nosimpleinit bool
|
||||||
var partpercent int
|
var partpercent int
|
||||||
|
|
||||||
var deployCmd = &cobra.Command{
|
var deployCmd = &cobra.Command{
|
||||||
Use: "deploy <rootfs.lni>",
|
Use: "deploy <rootfs.lni>",
|
||||||
Short: "Deploy system to device",
|
Short: "Deploy system to device",
|
||||||
|
@ -353,70 +355,74 @@ var deployCmd = &cobra.Command{
|
||||||
logger.Info("System cofigured")
|
logger.Info("System cofigured")
|
||||||
}
|
}
|
||||||
|
|
||||||
adbd.RunCommand("mkdir /tmp/uefi-install")
|
var uefi_out string
|
||||||
|
|
||||||
bootshim, err := utils.Files.UEFIBootshim.Get(*pbar.WithTitle("Downloading uefi bootshim"))
|
if nosimpleinit {
|
||||||
if err != nil {
|
logger.Info("-Q flag present. Skipping simpleinit install")
|
||||||
if bootshim != nil {
|
uefi_out = "0"
|
||||||
logger.Warn("Unable to verify uefi bootship image")
|
} else {
|
||||||
} else {
|
adbd.RunCommand("mkdir /tmp/uefi-install")
|
||||||
logger.Error("Unable to download uefi bootshim image")
|
|
||||||
os.Exit(179)
|
bootshim, err := utils.Files.UEFIBootshim.Get(*pbar.WithTitle("Downloading uefi bootshim"))
|
||||||
|
if err != nil {
|
||||||
|
if bootshim != nil {
|
||||||
|
logger.Warn("Unable to verify uefi bootship image")
|
||||||
|
} else {
|
||||||
|
logger.Error("Unable to download uefi bootshim image")
|
||||||
|
os.Exit(179)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
conn, err := adbd.OpenWrite(pterm.Sprintf("/tmp/uefi-install/%s", utils.Files.UEFIBootshim.Name), fs.FileMode(0777), adb.MtimeOfClose)
|
conn, err := adbd.OpenWrite(pterm.Sprintf("/tmp/uefi-install/%s", utils.Files.UEFIBootshim.Name), fs.FileMode(0777), adb.MtimeOfClose)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("Failed to send uefi bootshim", logger.Args("Error", err))
|
logger.Error("Failed to send uefi bootshim", logger.Args("Error", err))
|
||||||
}
|
|
||||||
_, err = conn.Write(bootshim)
|
|
||||||
if err != nil {
|
|
||||||
logger.Error("Failed to send uefi bootshim", logger.Args("Error", err))
|
|
||||||
}
|
|
||||||
conn.Close()
|
|
||||||
|
|
||||||
payload, err := utils.Files.UEFIPayload.Get(*pbar.WithTitle("Downloading uefi payload"))
|
|
||||||
if err != nil {
|
|
||||||
if payload != nil {
|
|
||||||
logger.Warn("Unable to verify uefi payload image")
|
|
||||||
} else {
|
|
||||||
logger.Error("Unable to download uefi payload image")
|
|
||||||
os.Exit(179)
|
|
||||||
}
|
}
|
||||||
}
|
_, err = conn.Write(bootshim)
|
||||||
conn, err = adbd.OpenWrite(pterm.Sprintf("/tmp/uefi-install/%s", utils.Files.UEFIPayload.Name), fs.FileMode(0777), adb.MtimeOfClose)
|
if err != nil {
|
||||||
if err != nil {
|
logger.Error("Failed to send uefi bootshim", logger.Args("Error", err))
|
||||||
logger.Error("Failed to send uefi payload", logger.Args("Error", err))
|
}
|
||||||
}
|
conn.Close()
|
||||||
_, err = conn.Write(payload)
|
|
||||||
if err != nil {
|
|
||||||
logger.Error("Failed to send uefi payload", logger.Args("Error", err))
|
|
||||||
}
|
|
||||||
conn.Close()
|
|
||||||
|
|
||||||
uefiSpinner, _ := spinner.Start("Patching UEFI")
|
payload, err := utils.Files.UEFIPayload.Get(*pbar.WithTitle("Downloading uefi payload"))
|
||||||
out, err = adbd.RunCommand("uefi-patch > /dev/null 2>&1; echo $?")
|
if err != nil {
|
||||||
out = strings.TrimRight(out, "\n")
|
if payload != nil {
|
||||||
if err != nil {
|
logger.Warn("Unable to verify uefi payload image")
|
||||||
logger.Error("Failed to install uefi. Reflash stock rom and try again", logger.Args("Error", err))
|
} else {
|
||||||
os.Exit(176)
|
logger.Error("Unable to download uefi payload image")
|
||||||
}
|
os.Exit(179)
|
||||||
logger.Debug("Uefi patch", logger.Args("Out", out))
|
}
|
||||||
|
}
|
||||||
|
conn, err = adbd.OpenWrite(pterm.Sprintf("/tmp/uefi-install/%s", utils.Files.UEFIPayload.Name), fs.FileMode(0777), adb.MtimeOfClose)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("Failed to send uefi payload", logger.Args("Error", err))
|
||||||
|
}
|
||||||
|
_, err = conn.Write(payload)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("Failed to send uefi payload", logger.Args("Error", err))
|
||||||
|
}
|
||||||
|
conn.Close()
|
||||||
|
|
||||||
switch out {
|
uefiSpinner, _ := spinner.Start("Patching UEFI")
|
||||||
case "1":
|
uefi_out, err = adbd.RunCommand("uefi-patch > /dev/null 2>&1; echo $?")
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("Failed to install uefi. Reflash stock rom and try again", logger.Args("Error", err))
|
||||||
|
os.Exit(176)
|
||||||
|
}
|
||||||
|
uefi_out = strings.TrimRight(uefi_out, "\n")
|
||||||
|
logger.Debug("Uefi patch", logger.Args("Out", out))
|
||||||
uefiSpinner.Stop()
|
uefiSpinner.Stop()
|
||||||
|
}
|
||||||
|
|
||||||
|
switch uefi_out {
|
||||||
|
case "1":
|
||||||
logger.Error("Failed to install uefi. Reflash stock rom and try again", logger.Args("Error", err))
|
logger.Error("Failed to install uefi. Reflash stock rom and try again", logger.Args("Error", err))
|
||||||
adbd.RunCommand("reboot bootloader")
|
adbd.RunCommand("reboot bootloader")
|
||||||
os.Exit(176)
|
os.Exit(176)
|
||||||
case "2":
|
case "2":
|
||||||
|
|
||||||
adbd.RunCommand("reboot")
|
adbd.RunCommand("reboot")
|
||||||
uefiSpinner.Stop()
|
|
||||||
logger.Info("Bootimage already patched")
|
logger.Info("Bootimage already patched")
|
||||||
case "0":
|
case "0":
|
||||||
adbd.RunCommand("reboot")
|
adbd.RunCommand("reboot")
|
||||||
uefiSpinner.Stop()
|
|
||||||
logger.Info("Installation done!")
|
logger.Info("Installation done!")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -428,4 +434,5 @@ func init() {
|
||||||
deployCmd.Flags().StringVarP(&password, "password", "p", "", "User password")
|
deployCmd.Flags().StringVarP(&password, "password", "p", "", "User password")
|
||||||
deployCmd.Flags().StringVarP(&serail, "serial", "s", "autodetect", "Device serial")
|
deployCmd.Flags().StringVarP(&serail, "serial", "s", "autodetect", "Device serial")
|
||||||
deployCmd.Flags().StringVarP(&partsize, "part-size", "S", "", "Linux partition size in percents")
|
deployCmd.Flags().StringVarP(&partsize, "part-size", "S", "", "Linux partition size in percents")
|
||||||
|
deployCmd.Flags().BoolVarP(&nosimpleinit, "no-simple-init", "Q", false, "Disable simple init install")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue