InnotexBootloarder V1
This commit is contained in:
8
InnotexBootloarder/InnotexBootloarder.plymouth
Normal file
8
InnotexBootloarder/InnotexBootloarder.plymouth
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[Plymouth Theme]
|
||||||
|
Name=InnotexBootloarder
|
||||||
|
Description=This theme uses your UEFI logo for seamless booting
|
||||||
|
ModuleName=script
|
||||||
|
|
||||||
|
[script]
|
||||||
|
ImageDir=/usr/share/plymouth/themes/InnotexBootloarder
|
||||||
|
ScriptFile=/usr/share/plymouth/themes/InnotexBootloarder/InnotexBootloarder.script
|
||||||
BIN
InnotexBootloarder/InnotexBootloarder.png
Normal file
BIN
InnotexBootloarder/InnotexBootloarder.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
257
InnotexBootloarder/InnotexBootloarder.script
Normal file
257
InnotexBootloarder/InnotexBootloarder.script
Normal file
@@ -0,0 +1,257 @@
|
|||||||
|
|
||||||
|
# Load the image from the BGRT
|
||||||
|
bgrt_image = Image("InnotexBootloarder.png");
|
||||||
|
|
||||||
|
# Create a sprite of the BGRT
|
||||||
|
bgrt_sprite = Sprite(bgrt_image);
|
||||||
|
|
||||||
|
bgrt_sprite.SetPosition(
|
||||||
|
(Window.GetWidth() / 2) - (bgrt_sprite.GetImage().GetWidth() / 2),
|
||||||
|
(Window.GetHeight() / 2) - (bgrt_sprite.GetImage().GetHeight() / 2),
|
||||||
|
1
|
||||||
|
);
|
||||||
|
#bgrt_sprite.SetPosition(0, 100, 1);
|
||||||
|
|
||||||
|
# Add your code here
|
||||||
|
|
||||||
|
# Callbacks which can be hooked
|
||||||
|
# Plymouth.SetBootProgressFunction: the callback function is called with two numbers, time spent booting so far and the progress (between 0 and 1) [IMPLEMENTED]
|
||||||
|
# Plymouth.SetRootMountedFunction: the callback function is called when a new root is mounted
|
||||||
|
# Plymouth.SetKeyboardInputFunction: the callback function is called with a string containing a new character entered on the keyboard
|
||||||
|
# Plymouth.SetUpdateStatusFunction: the callback function is called with the new boot status string [IMPLEMENTED]
|
||||||
|
# Plymouth.SetDisplayPasswordFunction: the callback function is called when the display should display a password dialogue. First arg is prompt string, the second is the number of bullets. [IMPLEMENTED]
|
||||||
|
# Plymouth.SetDisplayQuestionFunction: the callback function is called when the display should display a question dialogue. First arg is prompt string, the second is the entry contents.
|
||||||
|
# Plymouth.SetDisplayNormalFunction: the callback function is called when the display should return to normal
|
||||||
|
# Plymouth.SetMessageFunction: the callback function is called when new message should be displayed. First arg is message to display. [IMPLEMENTED]
|
||||||
|
|
||||||
|
|
||||||
|
fun refresh_callback ()
|
||||||
|
{
|
||||||
|
# Currently we do nothing here
|
||||||
|
}
|
||||||
|
|
||||||
|
Plymouth.SetRefreshFunction (refresh_callback);
|
||||||
|
|
||||||
|
#----------------------------------------- Dialogue --------------------------------
|
||||||
|
|
||||||
|
status = "normal";
|
||||||
|
|
||||||
|
fun dialog_setup()
|
||||||
|
{
|
||||||
|
local.box;
|
||||||
|
|
||||||
|
box.image = Image("box.png");
|
||||||
|
box.sprite = Sprite(box.image);
|
||||||
|
|
||||||
|
box.x = Window.GetWidth() * 0.50 - box.image.GetWidth ()/2;
|
||||||
|
box.y = Window.GetHeight() * 0.75 - box.image.GetHeight()/2;
|
||||||
|
box.z = 10000;
|
||||||
|
box.sprite.SetPosition(box.x, box.y, box.z);
|
||||||
|
|
||||||
|
global.dialog.box = box;
|
||||||
|
global.dialog.bullet_image = Image("bullet.png");
|
||||||
|
dialog_opacity (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fun dialog_opacity (opacity)
|
||||||
|
{
|
||||||
|
dialog.box.sprite.SetOpacity (opacity);
|
||||||
|
for (index = 0; dialog.bullet[index]; index++)
|
||||||
|
{
|
||||||
|
dialog.bullet[index].sprite.SetOpacity(opacity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun display_normal_callback ()
|
||||||
|
{
|
||||||
|
global.status = "normal";
|
||||||
|
if (global.dialog)
|
||||||
|
dialog_opacity (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
fun display_password_callback (prompt, bullets)
|
||||||
|
{
|
||||||
|
global.status = "password";
|
||||||
|
if (!global.dialog)
|
||||||
|
dialog_setup();
|
||||||
|
else
|
||||||
|
dialog_opacity(1);
|
||||||
|
for (index = 0; dialog.bullet[index] || index < bullets; index++)
|
||||||
|
{
|
||||||
|
if (!dialog.bullet[index])
|
||||||
|
{
|
||||||
|
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
|
||||||
|
dialog.bullet[index].x = dialog.box.x + 6 + index * dialog.bullet_image.GetWidth();
|
||||||
|
dialog.bullet[index].y = dialog.box.y + dialog.box.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
|
||||||
|
dialog.bullet[index].z = dialog.box.z + 1;
|
||||||
|
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
|
||||||
|
}
|
||||||
|
if (index < bullets)
|
||||||
|
dialog.bullet[index].sprite.SetOpacity(1);
|
||||||
|
else
|
||||||
|
dialog.bullet[index].sprite.SetOpacity(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Plymouth.SetDisplayNormalFunction(display_normal_callback);
|
||||||
|
Plymouth.SetDisplayPasswordFunction(display_password_callback);
|
||||||
|
|
||||||
|
#----------------------------------------- Progress Bar --------------------------------
|
||||||
|
|
||||||
|
progress_box.image = Image("progress_box.png");
|
||||||
|
progress_box.sprite = Sprite(progress_box.image);
|
||||||
|
|
||||||
|
progress_box.x = Window.GetWidth() * 0.50 - progress_box.image.GetWidth() / 2;
|
||||||
|
progress_box.y = Window.GetHeight() * 0.90 - progress_box.image.GetHeight() / 2;
|
||||||
|
progress_box.sprite.SetPosition(progress_box.x, progress_box.y, 0);
|
||||||
|
|
||||||
|
progress_bar.original_image = Image("progress_bar.png");
|
||||||
|
progress_bar.sprite = Sprite();
|
||||||
|
|
||||||
|
progress_bar.x = progress_box.x + progress_box.image.GetWidth() / 2 - progress_bar.original_image.GetWidth() / 2;
|
||||||
|
progress_bar.y = progress_box.y + progress_box.image.GetHeight() / 2 - progress_bar.original_image.GetHeight() / 2;
|
||||||
|
#progress_bar.y = Window.GetHeight() / 2 * 1.5 - progress_box.image.GetHeight() / 2 + (progress_box.image.GetHeight() - progress_bar.original_image.GetHeight()) / 2;
|
||||||
|
progress_bar.sprite.SetPosition(progress_bar.x, progress_bar.y, 1);
|
||||||
|
|
||||||
|
fun progress_callback (duration, progress)
|
||||||
|
{
|
||||||
|
if (progress_bar.image.GetWidth () != Math.Int (progress_bar.original_image.GetWidth () * progress))
|
||||||
|
{
|
||||||
|
progress_bar.image = progress_bar.original_image.Scale(progress_bar.original_image.GetWidth(progress_bar.original_image) * progress, progress_bar.original_image.GetHeight());
|
||||||
|
progress_bar.sprite.SetImage (progress_bar.image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Plymouth.SetBootProgressFunction(progress_callback);
|
||||||
|
|
||||||
|
#----------------------------------------- Quit --------------------------------
|
||||||
|
|
||||||
|
fun quit_callback ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Plymouth.SetQuitFunction(quit_callback);
|
||||||
|
|
||||||
|
#----------------------------------------- Message --------------------------------
|
||||||
|
|
||||||
|
message_sprite = Sprite();
|
||||||
|
message_sprite.SetPosition(10, 10, 10000);
|
||||||
|
|
||||||
|
fun message_callback (text)
|
||||||
|
{
|
||||||
|
# If you change this or the font below, also update the initramfs-hook to get them into your initramfs
|
||||||
|
my_image = Image.Text(text, 1, 1, 1, 1, "Exo Regular 12");
|
||||||
|
message_sprite.SetImage(my_image);
|
||||||
|
|
||||||
|
# HCenter, VNearTop
|
||||||
|
x = (Window.GetWidth() * 0.50) - (message_sprite.GetImage().GetWidth() / 2);
|
||||||
|
y = (Window.GetHeight() * 0.05) - (message_sprite.GetImage().GetHeight() / 2);
|
||||||
|
message_sprite.SetPosition(x, Math.Clamp(y, 1, Window.GetHeight()), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
Plymouth.SetMessageFunction(message_callback);
|
||||||
|
|
||||||
|
#----------------------------------------- Message --------------------------------
|
||||||
|
|
||||||
|
# If you change this or the font above, also update the initramfs-hook to get them into your initramfs
|
||||||
|
FONT = "Quicksand Medium 24";
|
||||||
|
NUM_SCROLL_LINES = 5;
|
||||||
|
NUM_SCROLL_COLS = 60;
|
||||||
|
|
||||||
|
test_str = "";
|
||||||
|
for (i=0; i < NUM_SCROLL_COLS; i++) {
|
||||||
|
test_str += "x";
|
||||||
|
}
|
||||||
|
LINE_WIDTH = Image.Text(test_str, 1, 1, 1, 1, FONT).GetWidth();
|
||||||
|
LINE_HEIGHT = Image.Text(FONT, 1, 1, 1, 1, FONT).GetHeight();
|
||||||
|
update_x = 0 + ( bgrt_sprite.GetImage().GetWidth() / 2 ) - ( LINE_WIDTH / 2);
|
||||||
|
update_y = 100 + ( bgrt_sprite.GetImage().GetHeight() + 10);
|
||||||
|
STRT = Image.Text(".... ", 0.8, 0.8, 0.8, 1.0, FONT);
|
||||||
|
GOOD = Image.Text(" OK ", 0.0, 1.0, 0.0, 1.0, FONT);
|
||||||
|
FAIL = Image.Text("FAIL ", 1.0, 0.0, 0.0, 1.0, FONT);
|
||||||
|
WARN = Image.Text("WARN ", 1.0, 1.0, 1.0, 1.0, FONT);
|
||||||
|
INFO = Image.Text("INFO ", 0.0, 1.0, 1.0, 1.0, FONT);
|
||||||
|
DONE = Image.Text("DONE ", 0.8, 0.8, 0.8, 1.0, FONT);
|
||||||
|
status_width = Math.Max(STRT.GetWidth(), Math.Max(GOOD.GetWidth(), Math.Max(FAIL.Getwidth(), Math.Max(WARN.GetWidth(), Math.Max(INFO.GetWidth(), DONE.GetWidth())))));
|
||||||
|
status_x = update_x - status_width;
|
||||||
|
|
||||||
|
// Initialising text images and their positions
|
||||||
|
for (i=0; i < NUM_SCROLL_LINES; i++) {
|
||||||
|
lines[i] = "";
|
||||||
|
message_sprite[i] = Sprite();
|
||||||
|
message_sprite[i].SetPosition(update_x, update_y + (i * LINE_HEIGHT), 10000);
|
||||||
|
status_sprite[i] = Sprite();
|
||||||
|
status_sprite[i].SetPosition(status_x, update_y + (i * LINE_HEIGHT), 10000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// From ubuntu-logo
|
||||||
|
fun StringLength(string) {
|
||||||
|
index = 0;
|
||||||
|
str = String(string);
|
||||||
|
while(str.CharAt(index)) index++;
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
fun scroll_message_callback(text) {
|
||||||
|
|
||||||
|
msg = String(text);
|
||||||
|
noscroll = 0;
|
||||||
|
|
||||||
|
if (msg.SubString(0,8) == "[status]") {
|
||||||
|
msg = msg.SubString(8, StringLength(msg));
|
||||||
|
noscroll = 1;
|
||||||
|
|
||||||
|
if (msg == "0") {
|
||||||
|
status_sprite[NUM_SCROLL_LINES - 1].SetImage(GOOD);
|
||||||
|
} else if (msg == "255") {
|
||||||
|
status_sprite[NUM_SCROLL_LINES - 1].SetImage(WARN);
|
||||||
|
} else {
|
||||||
|
status_sprite[NUM_SCROLL_LINES - 1].SetImage(FAIL);
|
||||||
|
}
|
||||||
|
} else if (msg.SubString(0,5) == "[...]") {
|
||||||
|
msg = msg.SubString(7, StringLength(msg));
|
||||||
|
noscroll = 1;
|
||||||
|
status_sprite[NUM_SCROLL_LINES - 1].SetImage(STRT);
|
||||||
|
} else if (msg.SubString(0,6) == "[info]") {
|
||||||
|
msg = msg.SubString(6, StringLength(msg));
|
||||||
|
noscroll = 0;
|
||||||
|
status_sprite[NUM_SCROLL_LINES - 1].SetImage(INFO);
|
||||||
|
} else if (msg.SubString(0,6) == "[done]") {
|
||||||
|
msg = msg.SubString(6, StringLength(msg));
|
||||||
|
noscroll = 0;
|
||||||
|
status_sprite[NUM_SCROLL_LINES - 1].SetImage(DONE);
|
||||||
|
} else if (msg.SubString(0,6) == "[fail]") {
|
||||||
|
msg = msg.SubString(6, StringLength(msg));
|
||||||
|
noscroll = 0;
|
||||||
|
status_sprite[NUM_SCROLL_LINES - 1].SetImage(FAIL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Truncate the message if too long
|
||||||
|
if (StringLength(msg) > NUM_SCROLL_COLS) {
|
||||||
|
msg = msg.SubString(0, NUM_SCROLL_COLS - 3);
|
||||||
|
msg += "...";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (noscroll == 0) {
|
||||||
|
// Shift message one up
|
||||||
|
for (i = 0; i < NUM_SCROLL_LINES - 1; i++) {
|
||||||
|
lines[i] = lines[i+1];
|
||||||
|
}
|
||||||
|
lines[i] = msg;
|
||||||
|
|
||||||
|
// Re-positioning the msg images
|
||||||
|
for (i = 0; i < NUM_SCROLL_LINES; i++) {
|
||||||
|
if (i < NUM_SCROLL_LINES - 1) {
|
||||||
|
message_sprite[i].SetImage(Image.Text(lines[i], 0.8, 0.8, 0.8, 0.8, FONT));
|
||||||
|
} else {
|
||||||
|
message_sprite[i].SetImage(Image.Text(lines[i], 1.0, 1.0, 1.0, 1.0, FONT));
|
||||||
|
}
|
||||||
|
status_sprite[i].SetImage(status_sprite[i+1].GetImage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uncomment if you want the status messages
|
||||||
|
#Plymouth.SetUpdateStatusFunction(scroll_message_callback);
|
||||||
257
InnotexBootloarder/InnotexBootloarder.script.in
Normal file
257
InnotexBootloarder/InnotexBootloarder.script.in
Normal file
@@ -0,0 +1,257 @@
|
|||||||
|
|
||||||
|
# Load the image from the BGRT
|
||||||
|
bgrt_image = Image("InnotexBootloarder.png");
|
||||||
|
|
||||||
|
# Create a sprite of the BGRT
|
||||||
|
bgrt_sprite = Sprite(bgrt_image);
|
||||||
|
|
||||||
|
bgrt_sprite.SetPosition(
|
||||||
|
(Window.GetWidth() / 2) - (bgrt_sprite.GetImage().GetWidth() / 2),
|
||||||
|
(Window.GetHeight() / 2) - (bgrt_sprite.GetImage().GetHeight() / 2),
|
||||||
|
1
|
||||||
|
);
|
||||||
|
#bgrt_sprite.SetPosition($BGRTLEFT$, $BGRTTOP$, 1);
|
||||||
|
|
||||||
|
# Add your code here
|
||||||
|
|
||||||
|
# Callbacks which can be hooked
|
||||||
|
# Plymouth.SetBootProgressFunction: the callback function is called with two numbers, time spent booting so far and the progress (between 0 and 1) [IMPLEMENTED]
|
||||||
|
# Plymouth.SetRootMountedFunction: the callback function is called when a new root is mounted
|
||||||
|
# Plymouth.SetKeyboardInputFunction: the callback function is called with a string containing a new character entered on the keyboard
|
||||||
|
# Plymouth.SetUpdateStatusFunction: the callback function is called with the new boot status string [IMPLEMENTED]
|
||||||
|
# Plymouth.SetDisplayPasswordFunction: the callback function is called when the display should display a password dialogue. First arg is prompt string, the second is the number of bullets. [IMPLEMENTED]
|
||||||
|
# Plymouth.SetDisplayQuestionFunction: the callback function is called when the display should display a question dialogue. First arg is prompt string, the second is the entry contents.
|
||||||
|
# Plymouth.SetDisplayNormalFunction: the callback function is called when the display should return to normal
|
||||||
|
# Plymouth.SetMessageFunction: the callback function is called when new message should be displayed. First arg is message to display. [IMPLEMENTED]
|
||||||
|
|
||||||
|
|
||||||
|
fun refresh_callback ()
|
||||||
|
{
|
||||||
|
# Currently we do nothing here
|
||||||
|
}
|
||||||
|
|
||||||
|
Plymouth.SetRefreshFunction (refresh_callback);
|
||||||
|
|
||||||
|
#----------------------------------------- Dialogue --------------------------------
|
||||||
|
|
||||||
|
status = "normal";
|
||||||
|
|
||||||
|
fun dialog_setup()
|
||||||
|
{
|
||||||
|
local.box;
|
||||||
|
|
||||||
|
box.image = Image("box.png");
|
||||||
|
box.sprite = Sprite(box.image);
|
||||||
|
|
||||||
|
box.x = Window.GetWidth() * 0.50 - box.image.GetWidth ()/2;
|
||||||
|
box.y = Window.GetHeight() * 0.75 - box.image.GetHeight()/2;
|
||||||
|
box.z = 10000;
|
||||||
|
box.sprite.SetPosition(box.x, box.y, box.z);
|
||||||
|
|
||||||
|
global.dialog.box = box;
|
||||||
|
global.dialog.bullet_image = Image("bullet.png");
|
||||||
|
dialog_opacity (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fun dialog_opacity (opacity)
|
||||||
|
{
|
||||||
|
dialog.box.sprite.SetOpacity (opacity);
|
||||||
|
for (index = 0; dialog.bullet[index]; index++)
|
||||||
|
{
|
||||||
|
dialog.bullet[index].sprite.SetOpacity(opacity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun display_normal_callback ()
|
||||||
|
{
|
||||||
|
global.status = "normal";
|
||||||
|
if (global.dialog)
|
||||||
|
dialog_opacity (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
fun display_password_callback (prompt, bullets)
|
||||||
|
{
|
||||||
|
global.status = "password";
|
||||||
|
if (!global.dialog)
|
||||||
|
dialog_setup();
|
||||||
|
else
|
||||||
|
dialog_opacity(1);
|
||||||
|
for (index = 0; dialog.bullet[index] || index < bullets; index++)
|
||||||
|
{
|
||||||
|
if (!dialog.bullet[index])
|
||||||
|
{
|
||||||
|
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
|
||||||
|
dialog.bullet[index].x = dialog.box.x + 6 + index * dialog.bullet_image.GetWidth();
|
||||||
|
dialog.bullet[index].y = dialog.box.y + dialog.box.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
|
||||||
|
dialog.bullet[index].z = dialog.box.z + 1;
|
||||||
|
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
|
||||||
|
}
|
||||||
|
if (index < bullets)
|
||||||
|
dialog.bullet[index].sprite.SetOpacity(1);
|
||||||
|
else
|
||||||
|
dialog.bullet[index].sprite.SetOpacity(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Plymouth.SetDisplayNormalFunction(display_normal_callback);
|
||||||
|
Plymouth.SetDisplayPasswordFunction(display_password_callback);
|
||||||
|
|
||||||
|
#----------------------------------------- Progress Bar --------------------------------
|
||||||
|
|
||||||
|
progress_box.image = Image("progress_box.png");
|
||||||
|
progress_box.sprite = Sprite(progress_box.image);
|
||||||
|
|
||||||
|
progress_box.x = Window.GetWidth() * 0.50 - progress_box.image.GetWidth() / 2;
|
||||||
|
progress_box.y = Window.GetHeight() * 0.90 - progress_box.image.GetHeight() / 2;
|
||||||
|
progress_box.sprite.SetPosition(progress_box.x, progress_box.y, 0);
|
||||||
|
|
||||||
|
progress_bar.original_image = Image("progress_bar.png");
|
||||||
|
progress_bar.sprite = Sprite();
|
||||||
|
|
||||||
|
progress_bar.x = progress_box.x + progress_box.image.GetWidth() / 2 - progress_bar.original_image.GetWidth() / 2;
|
||||||
|
progress_bar.y = progress_box.y + progress_box.image.GetHeight() / 2 - progress_bar.original_image.GetHeight() / 2;
|
||||||
|
#progress_bar.y = Window.GetHeight() / 2 * 1.5 - progress_box.image.GetHeight() / 2 + (progress_box.image.GetHeight() - progress_bar.original_image.GetHeight()) / 2;
|
||||||
|
progress_bar.sprite.SetPosition(progress_bar.x, progress_bar.y, 1);
|
||||||
|
|
||||||
|
fun progress_callback (duration, progress)
|
||||||
|
{
|
||||||
|
if (progress_bar.image.GetWidth () != Math.Int (progress_bar.original_image.GetWidth () * progress))
|
||||||
|
{
|
||||||
|
progress_bar.image = progress_bar.original_image.Scale(progress_bar.original_image.GetWidth(progress_bar.original_image) * progress, progress_bar.original_image.GetHeight());
|
||||||
|
progress_bar.sprite.SetImage (progress_bar.image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Plymouth.SetBootProgressFunction(progress_callback);
|
||||||
|
|
||||||
|
#----------------------------------------- Quit --------------------------------
|
||||||
|
|
||||||
|
fun quit_callback ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Plymouth.SetQuitFunction(quit_callback);
|
||||||
|
|
||||||
|
#----------------------------------------- Message --------------------------------
|
||||||
|
|
||||||
|
message_sprite = Sprite();
|
||||||
|
message_sprite.SetPosition(10, 10, 10000);
|
||||||
|
|
||||||
|
fun message_callback (text)
|
||||||
|
{
|
||||||
|
# If you change this or the font below, also update the initramfs-hook to get them into your initramfs
|
||||||
|
my_image = Image.Text(text, 1, 1, 1, 1, "Exo Regular 12");
|
||||||
|
message_sprite.SetImage(my_image);
|
||||||
|
|
||||||
|
# HCenter, VNearTop
|
||||||
|
x = (Window.GetWidth() * 0.50) - (message_sprite.GetImage().GetWidth() / 2);
|
||||||
|
y = (Window.GetHeight() * 0.05) - (message_sprite.GetImage().GetHeight() / 2);
|
||||||
|
message_sprite.SetPosition(x, Math.Clamp(y, 1, Window.GetHeight()), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
Plymouth.SetMessageFunction(message_callback);
|
||||||
|
|
||||||
|
#----------------------------------------- Message --------------------------------
|
||||||
|
|
||||||
|
# If you change this or the font above, also update the initramfs-hook to get them into your initramfs
|
||||||
|
FONT = "Quicksand Medium 24";
|
||||||
|
NUM_SCROLL_LINES = 5;
|
||||||
|
NUM_SCROLL_COLS = 60;
|
||||||
|
|
||||||
|
test_str = "";
|
||||||
|
for (i=0; i < NUM_SCROLL_COLS; i++) {
|
||||||
|
test_str += "x";
|
||||||
|
}
|
||||||
|
LINE_WIDTH = Image.Text(test_str, 1, 1, 1, 1, FONT).GetWidth();
|
||||||
|
LINE_HEIGHT = Image.Text(FONT, 1, 1, 1, 1, FONT).GetHeight();
|
||||||
|
update_x = $BGRTLEFT$ + ( bgrt_sprite.GetImage().GetWidth() / 2 ) - ( LINE_WIDTH / 2);
|
||||||
|
update_y = $BGRTTOP$ + ( bgrt_sprite.GetImage().GetHeight() + 10);
|
||||||
|
STRT = Image.Text(".... ", 0.8, 0.8, 0.8, 1.0, FONT);
|
||||||
|
GOOD = Image.Text(" OK ", 0.0, 1.0, 0.0, 1.0, FONT);
|
||||||
|
FAIL = Image.Text("FAIL ", 1.0, 0.0, 0.0, 1.0, FONT);
|
||||||
|
WARN = Image.Text("WARN ", 1.0, 1.0, 1.0, 1.0, FONT);
|
||||||
|
INFO = Image.Text("INFO ", 0.0, 1.0, 1.0, 1.0, FONT);
|
||||||
|
DONE = Image.Text("DONE ", 0.8, 0.8, 0.8, 1.0, FONT);
|
||||||
|
status_width = Math.Max(STRT.GetWidth(), Math.Max(GOOD.GetWidth(), Math.Max(FAIL.Getwidth(), Math.Max(WARN.GetWidth(), Math.Max(INFO.GetWidth(), DONE.GetWidth())))));
|
||||||
|
status_x = update_x - status_width;
|
||||||
|
|
||||||
|
// Initialising text images and their positions
|
||||||
|
for (i=0; i < NUM_SCROLL_LINES; i++) {
|
||||||
|
lines[i] = "";
|
||||||
|
message_sprite[i] = Sprite();
|
||||||
|
message_sprite[i].SetPosition(update_x, update_y + (i * LINE_HEIGHT), 10000);
|
||||||
|
status_sprite[i] = Sprite();
|
||||||
|
status_sprite[i].SetPosition(status_x, update_y + (i * LINE_HEIGHT), 10000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// From ubuntu-logo
|
||||||
|
fun StringLength(string) {
|
||||||
|
index = 0;
|
||||||
|
str = String(string);
|
||||||
|
while(str.CharAt(index)) index++;
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
fun scroll_message_callback(text) {
|
||||||
|
|
||||||
|
msg = String(text);
|
||||||
|
noscroll = 0;
|
||||||
|
|
||||||
|
if (msg.SubString(0,8) == "[status]") {
|
||||||
|
msg = msg.SubString(8, StringLength(msg));
|
||||||
|
noscroll = 1;
|
||||||
|
|
||||||
|
if (msg == "0") {
|
||||||
|
status_sprite[NUM_SCROLL_LINES - 1].SetImage(GOOD);
|
||||||
|
} else if (msg == "255") {
|
||||||
|
status_sprite[NUM_SCROLL_LINES - 1].SetImage(WARN);
|
||||||
|
} else {
|
||||||
|
status_sprite[NUM_SCROLL_LINES - 1].SetImage(FAIL);
|
||||||
|
}
|
||||||
|
} else if (msg.SubString(0,5) == "[...]") {
|
||||||
|
msg = msg.SubString(7, StringLength(msg));
|
||||||
|
noscroll = 1;
|
||||||
|
status_sprite[NUM_SCROLL_LINES - 1].SetImage(STRT);
|
||||||
|
} else if (msg.SubString(0,6) == "[info]") {
|
||||||
|
msg = msg.SubString(6, StringLength(msg));
|
||||||
|
noscroll = 0;
|
||||||
|
status_sprite[NUM_SCROLL_LINES - 1].SetImage(INFO);
|
||||||
|
} else if (msg.SubString(0,6) == "[done]") {
|
||||||
|
msg = msg.SubString(6, StringLength(msg));
|
||||||
|
noscroll = 0;
|
||||||
|
status_sprite[NUM_SCROLL_LINES - 1].SetImage(DONE);
|
||||||
|
} else if (msg.SubString(0,6) == "[fail]") {
|
||||||
|
msg = msg.SubString(6, StringLength(msg));
|
||||||
|
noscroll = 0;
|
||||||
|
status_sprite[NUM_SCROLL_LINES - 1].SetImage(FAIL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Truncate the message if too long
|
||||||
|
if (StringLength(msg) > NUM_SCROLL_COLS) {
|
||||||
|
msg = msg.SubString(0, NUM_SCROLL_COLS - 3);
|
||||||
|
msg += "...";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (noscroll == 0) {
|
||||||
|
// Shift message one up
|
||||||
|
for (i = 0; i < NUM_SCROLL_LINES - 1; i++) {
|
||||||
|
lines[i] = lines[i+1];
|
||||||
|
}
|
||||||
|
lines[i] = msg;
|
||||||
|
|
||||||
|
// Re-positioning the msg images
|
||||||
|
for (i = 0; i < NUM_SCROLL_LINES; i++) {
|
||||||
|
if (i < NUM_SCROLL_LINES - 1) {
|
||||||
|
message_sprite[i].SetImage(Image.Text(lines[i], 0.8, 0.8, 0.8, 0.8, FONT));
|
||||||
|
} else {
|
||||||
|
message_sprite[i].SetImage(Image.Text(lines[i], 1.0, 1.0, 1.0, 1.0, FONT));
|
||||||
|
}
|
||||||
|
status_sprite[i].SetImage(status_sprite[i+1].GetImage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uncomment if you want the status messages
|
||||||
|
#Plymouth.SetUpdateStatusFunction(scroll_message_callback);
|
||||||
BIN
InnotexBootloarder/box.png
Normal file
BIN
InnotexBootloarder/box.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
BIN
InnotexBootloarder/bullet.png
Normal file
BIN
InnotexBootloarder/bullet.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
InnotexBootloarder/progress_bar.png
Normal file
BIN
InnotexBootloarder/progress_bar.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
BIN
InnotexBootloarder/progress_box.png
Normal file
BIN
InnotexBootloarder/progress_box.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
69
install.sh
Executable file
69
install.sh
Executable file
@@ -0,0 +1,69 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Configurables
|
||||||
|
PLYMOUTH_DIR=/usr/share/plymouth/themes
|
||||||
|
PLYMOUTH_THEME=InnotexBootloarder
|
||||||
|
THEME_IMAGE=InnotexBootloarder/InnotexBootloarder.png # Chemin vers l'image dans le thème
|
||||||
|
|
||||||
|
# Vérification et installation de plymouth si nécessaire
|
||||||
|
if ! command -v plymouthd >/dev/null 2>&1; then
|
||||||
|
echo "Plymouth n'est pas installé. Installation en cours..."
|
||||||
|
if command -v apt-get >/dev/null 2>&1; then
|
||||||
|
apt-get update && apt-get install -y plymouth plymouth-themes
|
||||||
|
elif command -v dnf >/dev/null 2>&1; then
|
||||||
|
dnf install -y plymouth plymouth-themes
|
||||||
|
elif command -v pacman >/dev/null 2>&1; then
|
||||||
|
pacman -Sy --noconfirm plymouth plymouth-themes
|
||||||
|
else
|
||||||
|
echo "Impossible de détecter le gestionnaire de paquets. Installez plymouth manuellement."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Sanity Checks
|
||||||
|
if [[ ! -f "$THEME_IMAGE" ]]; then
|
||||||
|
echo "Sorry, I can't find the theme image at $THEME_IMAGE"
|
||||||
|
echo "Please make sure the image exists in your theme directory."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
command -v convert >/dev/null 2>&1 || { echo >&2 "I require convert (from imagemagick) but it's not installed. Aborting."; exit 1; }
|
||||||
|
command -v install >/dev/null 2>&1 || { echo >&2 "I require install (from coreutils) but it's not installed. Aborting."; exit 1; }
|
||||||
|
command -v awk >/dev/null 2>&1 || { echo >&2 "I require awk but it's not installed. Aborting."; exit 1; }
|
||||||
|
|
||||||
|
# OK. On suppose que l'image est déjà au bon format et au bon endroit
|
||||||
|
# Si besoin de conversion, décommentez la ligne suivante et adaptez
|
||||||
|
# convert "$THEME_IMAGE" "$THEME_IMAGE"
|
||||||
|
|
||||||
|
# Remplace les placeholders avec les offsets (à adapter selon tes besoins)
|
||||||
|
# Si tu veux garder les offsets, il faut les définir manuellement ici ou les lire d'un fichier de config
|
||||||
|
BGRTLEFT=0
|
||||||
|
BGRTTOP=100
|
||||||
|
|
||||||
|
< InnotexBootloarder/InnotexBootloarder.script.in awk \
|
||||||
|
-v BGRTLEFT="$BGRTLEFT" \
|
||||||
|
-v BGRTTOP="$BGRTTOP" \
|
||||||
|
'{gsub (/\$BGRTLEFT\$/, BGRTLEFT);
|
||||||
|
gsub (/\$BGRTTOP\$/, BGRTTOP);
|
||||||
|
print}' > InnotexBootloarder/InnotexBootloarder.script
|
||||||
|
|
||||||
|
# Enfin, installe le thème
|
||||||
|
install -d ${PLYMOUTH_DIR}/${PLYMOUTH_THEME}
|
||||||
|
install -m644 InnotexBootloarder/InnotexBootloarder.plymouth ${PLYMOUTH_DIR}/${PLYMOUTH_THEME}/
|
||||||
|
install -m644 InnotexBootloarder/InnotexBootloarder.{script,png} ${PLYMOUTH_DIR}/${PLYMOUTH_THEME}/
|
||||||
|
install -m644 InnotexBootloarder/{box,bullet,progress_{bar,box}}.png ${PLYMOUTH_DIR}/${PLYMOUTH_THEME}/
|
||||||
|
|
||||||
|
[ -d /lib/lsb/init-functions.d ] && install -m644 scripts/init-functions /lib/lsb/init-functions.d/999-bgrt
|
||||||
|
[ -d /etc/initramfs-tools/hooks ] && install -m755 scripts/initramfs-hook /etc/initramfs-tools/hooks/bgrt-fonts
|
||||||
|
|
||||||
|
# Mise à jour de l'initramfs si nécessaire
|
||||||
|
if [ -x /usr/bin/update-initramfs ]; then
|
||||||
|
update-initramfs -u
|
||||||
|
elif [ -x /usr/bin/dracut ]; then
|
||||||
|
dracut --force
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Install complete."
|
||||||
|
echo "To use this theme, run as root:"
|
||||||
|
echo " plymouth-set-default-theme -R ${PLYMOUTH_THEME}"
|
||||||
|
|
||||||
40
scripts/init-functions
Normal file
40
scripts/init-functions
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#
|
||||||
|
|
||||||
|
if ! plymouth --ping > /dev/null 2>&1
|
||||||
|
then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
log_daemon_msg_post () {
|
||||||
|
# Starting/Stopping a daemon
|
||||||
|
/bin/plymouth update --status="[start]${@}" || true
|
||||||
|
}
|
||||||
|
|
||||||
|
log_begin_msg_post () {
|
||||||
|
/bin/plymouth update --status="[...]${@}" || true
|
||||||
|
}
|
||||||
|
|
||||||
|
log_action_msg_post () {
|
||||||
|
# Log an atomic action
|
||||||
|
/bin/plymouth update --status="[info]${@}" || true
|
||||||
|
}
|
||||||
|
|
||||||
|
log_action_begin_msg_post () {
|
||||||
|
/bin/plymouth update --status="[...]${@}" || true
|
||||||
|
}
|
||||||
|
|
||||||
|
log_end_msg_post () {
|
||||||
|
# End of daemon. The status value is written after the text (e.g. [status]255, so we can choose GOOD, WARN or FAIL.
|
||||||
|
/bin/plymouth update --status="[status]${@}" || true
|
||||||
|
}
|
||||||
|
|
||||||
|
log_action_end_msg_post () {
|
||||||
|
# Log the end of an action
|
||||||
|
local end
|
||||||
|
end="${2:-}"
|
||||||
|
if [ $1 -eq 0 ]; then
|
||||||
|
/bin/plymouth update --status="[done]${end}" || true
|
||||||
|
else
|
||||||
|
/bin/plymouth update --status="[fail]${end}" || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
33
scripts/initramfs-hook
Normal file
33
scripts/initramfs-hook
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
PREREQ=""
|
||||||
|
|
||||||
|
prereqs()
|
||||||
|
{
|
||||||
|
echo "${PREREQ}"
|
||||||
|
}
|
||||||
|
|
||||||
|
case "${1}" in
|
||||||
|
prereqs)
|
||||||
|
prereqs
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
. /usr/share/initramfs-tools/hook-functions
|
||||||
|
|
||||||
|
FONTS="
|
||||||
|
Exo Regular
|
||||||
|
Quicksand Medium
|
||||||
|
"
|
||||||
|
|
||||||
|
while read -r font; do
|
||||||
|
for line in $(fc-list :fullname="${font}" file | sed -e 's/:\s*$//'); do
|
||||||
|
mkdir -p "${DESTDIR}$(dirname "${line}")"
|
||||||
|
cp -a "${line}" "${DESTDIR}$(dirname "${line}")"
|
||||||
|
done
|
||||||
|
done <<EOF
|
||||||
|
$FONTS
|
||||||
|
EOF
|
||||||
Reference in New Issue
Block a user