Skip to content

Commit 82be3c2

Browse files
committed
Repository initialization
Add all files to the repository
1 parent 2c0eca3 commit 82be3c2

8 files changed

+313
-0
lines changed

README.md

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# FancyBoot Plymouth theme
2+
### About FancyBoot
3+
FancyBoot is a beautiful Plymouth boot screen for Ubuntu, featuring a progress bar, a live boot log, and a colorful animated background.
4+
5+
### How to use
6+
#### Install
7+
Open a terminal in the theme folder (called `fancyBoot`) and type the following commands:
8+
```bash
9+
chmod +x install.sh
10+
```
11+
Then:
12+
```bash
13+
./install.sh
14+
```
15+
This command will ask you some important questions. You will have to answer __carefully__. You also will have to enter your password at least one time when asked.
16+
The program will then show the plymouth for 10s and quit.
17+
#### Uninstall
18+
Open a terminal in the theme folder (called `fancyBoot`) and type the following commands:
19+
```bash
20+
chmod +x uninstall.sh
21+
```
22+
Then:
23+
```bash
24+
./uninstall.sh
25+
```
26+
The program will ask you to choose between two options. Once again, answer carefully. If you don't know what to choose, use option `1`.
27+
The program will remove the theme and set back the default one, and do a 10s test.
28+
#### Update
29+
If you want to edit this theme and then update it, edit the copy in the downloaded folder, then open a terminal in this same folder (called `fancyBoot`) and type the following commands:
30+
```bash
31+
chmod +x update.sh
32+
```
33+
Then:
34+
```bash
35+
./update.sh
36+
```
37+
This will update the theme and show you a 10s test.
38+
#### Test
39+
To test the Plymouth theme, open a terminal in the theme folder (called `fancyBoot`) and type the following commands:
40+
```bash
41+
chmod +x test.sh
42+
```
43+
Then:
44+
```bash
45+
./test.sh
46+
```
47+
### Warning
48+
Do __never__:
49+
* Delete the `/usr/share/plymouth/themes/fancyboot/installed` file.
50+
* Delete the `/usr/share/initramfs-tools/scripts/functions.backup` file.
51+
52+
-
53+
54+
You can __open__ an issue on https://github.com/vPumpking/fancyBoot-Plymouth-boot-screen if you have any question.

fancyboot.plymouth

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[Plymouth Theme]
2+
Name=Fancy Boot
3+
Description=A fancy text based progress bar with a colorful background
4+
ModuleName=script
5+
6+
[script]
7+
ImageDir=/usr/share/plymouth/themes/fancyboot
8+
ScriptFile=/usr/share/plymouth/themes/fancyboot/fancyboot.script
9+
UseFirmwareBackground=false

fancyboot.script

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
Window.SetBackgroundTopColor (0, 0, 0);
2+
Window.SetBackgroundBottomColor (0, 0, 0);
3+
colors=[[225,8,14],[253,144,5],[253,244,7],[66,200,4],[41,194,249],[1,38,243],[93,45,197]];
4+
mode = Plymouth.GetMode();
5+
#mode="boot";
6+
screen_width=Window.GetWidth();
7+
screen_height=Window.GetHeight();
8+
pb_length=321;
9+
jiffies=1;
10+
r = 0.78;
11+
g = 0.0;
12+
b = 0.0;
13+
duration=100;
14+
pb_frame_count=50;
15+
pb_image=Image("progress_bar.png");
16+
pb_sprite = pb_image.Scale (0 , pb_image.GetHeight());
17+
pb_sprite=Sprite(pb_image);
18+
pb_sprite.SetX ((screen_width/2) - (pb_image.GetWidth()/2));
19+
pb_sprite.SetY ((screen_height/2) - (pb_image.GetHeight()/2));
20+
wait_image=Image("awaiting.png");
21+
wait_sprite=Sprite(wait_image);
22+
wait_sprite.SetOpacity(0);
23+
wait_sprite.SetX((screen_width/2) - (wait_image.GetWidth()/2));
24+
wait_sprite.SetY((screen_height/2) - (wait_image.GetHeight()/2));
25+
log_sprite=Sprite();
26+
progress = 0;
27+
fun progress_callback (duration,progress)
28+
{
29+
pb_sprite.SetImage(pb_image.Scale ( progress * pb_length, pb_image.GetHeight()));
30+
}
31+
fun status_callback (text)
32+
{
33+
log_image=Image.Text(text,255,255,255,255,"Sans 12","center");
34+
log_sprite.SetImage(log_image);
35+
log_sprite.SetX((screen_width/2)-(log_image.GetWidth()/2));
36+
log_sprite.SetY((screen_height)-(log_image.GetHeight()));
37+
}
38+
fun refresh_callback ()
39+
{
40+
if (1) {
41+
#color cycle the background
42+
if (jiffies >= (duration * 6)){
43+
jiffies = 0;
44+
r = 0.78;
45+
g = 0.0;
46+
b = 0.0;
47+
}
48+
49+
jiffies++;
50+
51+
#red
52+
if (jiffies > 0 && jiffies <= duration){ #rgb 0.78, 0.00, 0.00 200, 0, 0
53+
r = Math.Clamp((r - 0.0 / duration), 0, 1);
54+
g = Math.Clamp((g + 0.78 / duration), 0, 1);
55+
}
56+
57+
#yellow
58+
if (jiffies > duration && jiffies <= (duration * 2)){ #rgb 0.78, 0.78, 0.00 200, 200, 0
59+
r = Math.Clamp((r - 0.78 / duration), 0, 1);
60+
g = Math.Clamp((g - 0.23 / duration), 0, 1);
61+
}
62+
63+
#green
64+
if (jiffies > (duration * 2) && jiffies <= (duration * 3)){ #rgb 0.00, 0.55, 0.00 0, 140, 0
65+
g = Math.Clamp((g + 0.16 / duration), 0, 1);
66+
b = Math.Clamp((b + 0.70 / duration), 0, 1);
67+
}
68+
69+
#cyan
70+
if (jiffies > (duration * 3) && jiffies <= (duration * 4)){ #rgb 0.00, 0.71, 0.70 0, 180, 180
71+
g = Math.Clamp((g - 0.71 / duration), 0, 1);
72+
b = Math.Clamp((b + 0.30 / duration), 0, 1);
73+
}
74+
75+
#blue
76+
if (jiffies > (duration * 4) && jiffies <= (duration * 5)){ #rgb 0.00, 0.00, 1.00 0, 0, 255
77+
b = Math.Clamp((b - 0.22 / duration), 0, 1);
78+
r = Math.Clamp((r + 0.78 / duration), 0, 1);
79+
}
80+
81+
#magenta
82+
if (jiffies > (duration * 5) && jiffies <= (duration * 6)){ #rgb 0.78, 0.00, 0.78 200, 0, 200
83+
b = Math.Clamp((b - 0.78 / duration), 0, 1);
84+
r = Math.Clamp((r + 0.00 / duration), 0, 1);
85+
}
86+
87+
88+
rt = Math.Clamp((r - 100), 0, 1);
89+
gt = Math.Clamp((g - 100), 0, 1);
90+
bt = Math.Clamp((b - 100), 0, 1);
91+
92+
# Window.SetBackgroundTopColor (rt, gt, bt); #gradient - darker at the top of screen
93+
Window.SetBackgroundTopColor (r, g, b); #no gradient
94+
Window.SetBackgroundBottomColor (r, g, b);
95+
}
96+
}
97+
98+
Plymouth.SetBootProgressFunction(progress_callback);
99+
Plymouth.SetUpdateStatusFunction(status_callback);
100+
Plymouth.SetRefreshFunction (refresh_callback);
101+
102+

install.sh

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
whereto='/_log_msg()/='
3+
fromfile="/usr/share/initramfs-tools/scripts/functions"
4+
tmpfile="./tmp"
5+
echo Please enter your sudo password if you are prompted to do so.
6+
echo
7+
echo
8+
echo WARNING
9+
echo The FancyBoot plymouth theme requires a few script lines in ${fromfile} to display the bottom boot log.
10+
echo "These 3 lines are followed by a '#FANCYBOOT' command. If you are encountering problems with the boot log,"
11+
echo delete carefuly these lines __only__. A backup of ${fromfile} will be made at ${fromfile}.backup, use it to restore
12+
echo "the original file in case of damage. FancyBoot and its author aren't responsible in any case for software/"
13+
echo hardware damage or malfunction.
14+
echo
15+
echo
16+
read -p "Do you want to continue ? (read above lines before) [Y/n] "
17+
if [[ $REPLY =~ ^[Nn]$ ]]
18+
then
19+
echo
20+
echo Exiting... \(1s left\)
21+
sleep 1
22+
exit
23+
fi
24+
if test -f "/usr/share/plymouth/themes/fancyboot/installed"; then
25+
echo Theme already installed. To update it after a modification, please use update.sh.
26+
sleep 1
27+
exit
28+
else
29+
sudo touch "/usr/share/plymouth/themes/fancyboot/installed"
30+
fi
31+
32+
echo Installing the fancyboot plymouth theme...
33+
sed -n $whereto $fromfile >> $tmpfile
34+
tmpval=$(head $tmpfile)
35+
rm $tmpfile
36+
line=$(($tmpval+2))
37+
echo Backup $fromfile to ${fromfile}.backup
38+
sudo cp $fromfile ${fromfile}.backup
39+
echo Done!
40+
echo Add plymouth update at line $line in file $fromfile
41+
update=" if [ -x /bin/plymouth ]; then #FANCYBOOT - Remove this if block in case of problems in boot log"
42+
printf '%s\n' H ${line}i "$update" . wq | sudo ed -s $fromfile
43+
update=' /bin/plymouth update --status="$@" #FANCYBOOT'
44+
line=$(($line+1))
45+
printf '%s\n' H ${line}i "$update" . wq | sudo ed -s $fromfile
46+
update=" fi #FANCYBOOT"
47+
line=$(($line+1))
48+
printf '%s\n' H ${line}i "$update" . wq | sudo ed -s $fromfile
49+
echo Done!
50+
sudo mkdir /usr/share/plymouth/themes/fancyboot
51+
sudo cp -rf ./ /usr/share/plymouth/themes/fancyboot
52+
sudo update-alternatives --quiet --install /usr/share/plymouth/themes/default.plymouth default.plymouth /usr/share/plymouth/themes/fancyboot/fancyboot.plymouth 100
53+
sudo update-alternatives --quiet --set default.plymouth /usr/share/plymouth/themes/fancyboot/fancyboot.plymouth
54+
sudo update-initramfs -u
55+
echo Done!
56+
echo Testing for 10s...
57+
sudo plymouthd
58+
sudo plymouth --show-splash
59+
sleep 10
60+
sudo plymouth quit
61+
echo Everything seems to work!
62+
sleep 1

progress_bar.png

230 Bytes
Loading

test.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
echo Testing for 10s...
3+
sudo plymouthd
4+
sudo plymouth --show-splash
5+
sleep 10
6+
sudo plymouth quit
7+
echo Everything seems to work!

uninstall.sh

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
safe_removal() {
3+
echo Uninstalling the fancyboot plymouth theme...
4+
sudo update-alternatives --quiet --remove default.plymouth /usr/share/plymouth/themes/fancyboot/fancyboot.plymouth
5+
sudo rm -rf /usr/share/plymouth/themes/fancyboot
6+
sudo update-alternatives --quiet --auto default.plymouth
7+
sudo update-initramfs -u
8+
echo Done!
9+
echo Testing...
10+
sudo plymouthd
11+
sudo plymouth --show-splash
12+
sleep 10
13+
sudo plymouth quit
14+
echo Done. Report to author if a problem happens.
15+
sleep 1
16+
}
17+
complete_removal() {
18+
echo "COMPLETE REMOVAL"
19+
if test -f "/usr/share/initramfs-tools/scripts/functions.backup"; then
20+
echo Backup file exists.
21+
else
22+
echo
23+
echo ERROR
24+
echo "File '/usr/share/initramfs-tools/scripts/functions.backup' does not exist. Emergency option is: Safe removal"
25+
echo Aborting Complete removal and starting Safe removal...
26+
echo SAFE REMOVAL
27+
safe_removal
28+
fi
29+
read -p "Do you want to continue ? [y/N] "
30+
if [[ $REPLY =~ ^[Yy]$ ]]; then
31+
echo Replacing initramfs functions by backup...
32+
sudo cp /usr/share/initramfs-tools/scripts/functions.backup /usr/share/initramfs-tools/scripts/functions
33+
echo Done!
34+
safe_removal
35+
else
36+
echo Exiting... \(1s left\)
37+
sleep 1
38+
exit
39+
fi
40+
}
41+
echo Please enter your sudo password if you are prompted to do so.
42+
echo
43+
echo
44+
echo WARNING
45+
echo There are __two__ existing uninstalling modes for FancyBoot:
46+
echo " 1 - Safe removal : FancyBoot is deleted and the default theme is set back. Most recommanded option."
47+
echo " 2 - Complete removal : FancyBoot is deleted, the default theme is set back and the initramfs functions file is set back from backup. Read warning below.*"
48+
echo
49+
echo "*Warning: Complete removal can cause serious problems in the filesystem if the '/usr/share/initramfs-tools/scripts/functions.backup' doesn't exist. Those problems can be fatal to your computer."
50+
echo
51+
read -p "Type the number of the chosen option. Default option is 1. Type 'q' to quit. "
52+
echo
53+
if [[ $REPLY =~ ^[1]$ ]]; then
54+
echo "SAFE REMOVAL"
55+
safe_removal
56+
else
57+
if [[ $REPLY =~ ^[2]$ ]]; then
58+
complete_removal
59+
else
60+
if [[ $REPLY =~ ^[q]$ ]]; then
61+
echo "Exiting..."
62+
sleep 1 && exit
63+
fi
64+
fi
65+
fi

update.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
sudo mkdir /usr/share/plymouth/themes/fancyboot
3+
sudo cp -rf ./ /usr/share/plymouth/themes/fancyboot
4+
sudo update-alternatives --quiet --install /usr/share/plymouth/themes/default.plymouth default.plymouth /usr/share/plymouth/themes/fancyboot/fancyboot.plymouth 100
5+
sudo update-alternatives --quiet --set default.plymouth /usr/share/plymouth/themes/fancyboot/fancyboot.plymouth
6+
sudo update-initramfs -u
7+
echo Done!
8+
echo Testing for 10s...
9+
sudo plymouthd
10+
sudo plymouth --show-splash
11+
sleep 10
12+
sudo plymouth quit
13+
echo Everything seems to work!
14+
sleep 1

0 commit comments

Comments
 (0)