Skip to content

Commit

Permalink
core-initrd: un-vendor UC plymouth theme
Browse files Browse the repository at this point in the history
As we will keep any difference between initramfs in the snapd repo, it
does not make sense anymore to keep the plymouth theme in a separate
repository.
  • Loading branch information
alfonsosanchezbeato committed Dec 13, 2024
1 parent eba73ad commit be847a8
Show file tree
Hide file tree
Showing 36 changed files with 165 additions and 5 deletions.
9 changes: 4 additions & 5 deletions core-initrd/latest/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ override_dh_auto_install:
mkdir debian/tmp
cp -ar factory/* debian/tmp

# splash functionality
# splash functionality
mkdir -p debian/tmp/usr/share/plymouth/themes/
cp -a vendor/plymouth-theme-ubuntu-core/ubuntu-core \
cp -a plymouth-theme-ubuntu-core/ubuntu-core \
debian/tmp/usr/share/plymouth/themes/
mkdir -p debian/tmp/usr/share/fonts/
cp /usr/share/fonts/truetype/ubuntu/Ubuntu-R.ttf \
Expand All @@ -30,17 +30,16 @@ ifeq ($(DEB_HOST_ARCH),amd64)
endif

override_dh_clean:
# Include ubuntu-core plymouth theme in sources
[ -d vendor/plymouth-theme-ubuntu-core ] || ( mkdir -p vendor; cd vendor; \
git clone https://github.com/snapcore/plymouth-theme-ubuntu-core )
dh_clean

override_dh_python3:
dh_python3 --no-ext-rename

override_dh_fixperms:
dh_fixperms -Xusr/lib/ubuntu-core-initramfs/main

override_dh_makeshlibs:
dh_makeshlibs -Xusr/lib/ubuntu-core-initramfs/main

override_dh_shlibdeps:
dh_shlibdeps -Xusr/lib/ubuntu-core-initramfs/main
1 change: 1 addition & 0 deletions core-initrd/latest/plymouth-theme-ubuntu-core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The ubuntu-core theme for plymouth was originally in https://github.com/canonical/plymouth-theme-ubuntu-core
32 changes: 32 additions & 0 deletions core-initrd/latest/plymouth-theme-ubuntu-core/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Plymouth
Upstream-Contact: [email protected]
Source: http://www.freedesktop.org/software/plymouth/releases/

Files: *
Copyright: 2022 Canonical Ltd.
License: GPL-2+

Files: ubuntu-core/throbber-*.png
Copyright: 2006-2008 Red Hat, Inc.
2007-2008 Ray Strode <[email protected]>
2003 University of Southern California
2003 Charlie Brej <[email protected]>
License: GPL-2+

License: GPL-2+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
The complete text of the GNU General Public License
can be found in /usr/share/common-licenses/GPL-2 file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Plymouth Theme]
Name=Ubuntu Core
Description=The default theme for Ubuntu Core.
ModuleName=script

[script]
ImageDir=/
ScriptFile=/usr/share/plymouth/themes/ubuntu-core/ubuntu-core.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# ubuntu-core.script - boot splash plugin
#
# Copyright (C) 2022 Canonical Ltd.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

fun WriteText(text, colour)
{
# Ubuntu Font
font = "Ubuntu, sans-serif 16";
font_alignment = "center";
image = Image.Text(text, colour.red, colour.green, colour.blue, colour.alpha,
font, font_alignment);
}

fun message_callback(message)
{
text_img = WriteText(message, white);
# Text centered in last quarter of the screen
text.x = Window.GetX() + (Window.GetWidth() - text_img.GetWidth())/2;
text.y = Window.GetY() + 7*Window.GetHeight()/8 - text_img.GetHeight() - 10;
text_sprite.SetImage(text_img);
# x,y,z position
text_sprite.SetPosition(text.x, text.y, 2000);

# debug_img = Image.Text("Width: " + text_img.GetWidth(),
# white.red, white.green, white.blue, white.alpha);
# debug_sprite.SetImage(debug_img);
# debug_sprite.SetPosition(Window.GetX()+10,Window.GetY() + 10, 2000);
}

# Called 50 times every second.
# NOTE: if a refresh function is not set, Plymouth doesn't seem to be able to
# update the screen correctly. This happens, for instance, when getty
# takes control of the screen. We need to update with the splash at
# that moment (also, this produces a blink). Calling again SetImage
# is needed for the update to happen.
fun refresh_callback()
{
logo.sprite.SetImage(logo.image);
logo.sprite.SetPosition(logo.x, logo.y, logo.z);
logo.sprite.SetOpacity(1);

# Spinner
if (++spin.frame_cnt % spin.refresh_rate == 0) {
if (++spin.idx == 31)
spin.idx = 1;
spin.image = Image(spin.base_name + spin.idx + ".png");
}
spin.sprite.SetImage(spin.image);
spin.sprite.SetPosition(spin.x, spin.y, spin.z);
spin.sprite.SetOpacity(1);

if (uc_logo.raw_image != NULL) {
uc_logo.sprite.SetImage(uc_logo.image);
uc_logo.sprite.SetPosition(uc_logo.x, uc_logo.y, uc_logo.z);
uc_logo.sprite.SetOpacity(1);
}
}

white.red = 1.0;
white.green = 1.0;
white.blue = 1.0;

# Warning: Sprites need to be global variables, apparently
text_sprite = Sprite();
#debug_sprite = Sprite();

logo.raw_image = Image("run/mnt/gadget/splash/vendor-logo.png");
uc_logo.raw_image = NULL;
if (logo.raw_image == NULL) {
logo.raw_image = Image("usr/share/plymouth/themes/ubuntu-core/ubuntu-core.png");
} else {
uc_logo.raw_image = Image("usr/share/plymouth/themes/ubuntu-core/ubuntu-core.png");
uc_logo_w = Window.GetWidth()/5;
uc_logo.image = uc_logo.raw_image.Scale(uc_logo_w,
uc_logo_w*uc_logo.raw_image.GetHeight()/uc_logo.raw_image.GetWidth());
uc_logo.sprite = Sprite();
# Logo touching the top and in the last 8th of the screen
uc_logo.x = Window.GetX() + Window.GetWidth()/2 - uc_logo.image.GetWidth()/2;
uc_logo.y = Window.GetY() + 7*Window.GetHeight()/8;
uc_logo.z = 100;
}

logo_w = 2*Window.GetWidth()/3;
logo.image = logo.raw_image.Scale(logo_w, logo_w*logo.raw_image.GetHeight()/logo.raw_image.GetWidth());
logo.sprite = Sprite();
# Logo right on top of the low-half of the screen
logo.x = Window.GetX() + Window.GetWidth()/2 - logo.image.GetWidth()/2;
logo.y = Window.GetY() + Window.GetHeight()/2 - logo.image.GetHeight();
logo.z = 100;

spin.base_name = "usr/share/plymouth/themes/ubuntu-core/throbber-";
spin.idx = 1;
spin.refresh_rate = 5;
spin.frame_cnt = 0;
spin.image = Image(spin.base_name + spin.idx + ".png");
spin.sprite = Sprite();
# Spin between third and fourth quarters
spin.x = Window.GetX() + Window.GetWidth()/2 - spin.image.GetWidth()/2;
spin.y = Window.GetY() + 3*Window.GetHeight()/4 - spin.image.GetHeight()/2;
spin.z = 100;

refresh_callback();

Plymouth.SetMessageFunction(message_callback);
Plymouth.SetRefreshFunction(refresh_callback);

0 comments on commit be847a8

Please sign in to comment.