package plymouth

import (
	"fmt"
	"os/exec"
	"strconv"
)

func ShowPlymouthMessage(message string) {
	cmd := exec.Command("plymouth", "update", "--status=\""+message+"\"")
	if err := cmd.Run(); err != nil {
		fmt.Println(message)
	}
}

func ShowPlymouthProgress(progress int) {
	if progress < 100 && progress > 0 {
		progressStr := strconv.Itoa(progress)
		cmd := exec.Command("plymouth", "system-update", "--progress="+progressStr+"\"")
		if err := cmd.Run(); err != nil {
			fmt.Printf("Progress: %s%%", progressStr)
		}
	}
}
