-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plymouth-kcm-dracut.patch
168 lines (161 loc) · 7.66 KB
/
plymouth-kcm-dracut.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
We do not se update-alternatives for plymouth theme
After a theme change initrd regeneration is needed
so that' why dracut is called
diff -up plymouth-kcm-5.24.4/src/helper.cpp.1~ plymouth-kcm-5.24.4/src/helper.cpp
--- plymouth-kcm-5.24.4/src/helper.cpp.1~ 2022-03-29 13:38:15.000000000 +0200
+++ plymouth-kcm-5.24.4/src/helper.cpp 2022-04-26 01:14:48.242704142 +0200
@@ -88,75 +88,12 @@ ActionReply PlymouthHelper::save(const Q
QFile configFile(QStringLiteral(PLYMOUTH_CONFIG_PATH));
configFile.setPermissions(QFileDevice::ReadOwner | QFileDevice::WriteOwner | QFileDevice::ReadGroup | QFileDevice::ReadOther);
- // Special case: Ubuntu derivatives, which work different from everybody else
- if (hasUpdateAlternatives()) {
- // find the .plymouth file in the theme
- QDir dir(QStringLiteral(PLYMOUTH_THEMES_DIR) + theme);
- const QStringList themeFile = dir.entryList(QStringList() << QStringLiteral("*.plymouth"));
- if (themeFile.count() != 1) {
- reply = ActionReply::BackendError;
- reply.setErrorDescription(i18n("Theme corrupted: .plymouth file not found inside theme."));
- return reply;
- }
-
- QProcess checkProcess;
- QByteArray data;
- qDebug() << "Running update-alternatives --list default.plymouth now";
- checkProcess.start(updateAlternatives(), {QStringLiteral("--list"), QStringLiteral("default.plymouth")});
- if (!checkProcess.waitForStarted()) {
- reply = ActionReply::BackendError;
- reply.setErrorDescription(i18n("Cannot start update-alternatives."));
- return reply;
- }
- if (!checkProcess.waitForFinished()) {
- reply = ActionReply::BackendError;
- reply.setErrorDescription(i18n("update-alternatives failed to run."));
- return reply;
- }
- data = checkProcess.readAllStandardOutput();
-
- if (int ret = checkProcess.exitCode(); ret != 0) {
- reply = ActionReply(ActionReply::HelperErrorReply());
- reply.setErrorCode(static_cast<ActionReply::Error>(ret));
- reply.setErrorDescription(i18n("update-alternatives returned with error condition %1.", ret));
- return reply;
- }
- const QString installFile = dir.path() + QLatin1Char('/') + themeFile.first();
- if (!data.contains(installFile.toUtf8())) {
- qDebug() << "Plymouth file not found in update-alternatives. So install it";
- if (auto reply = updateAlternativesInstall(installFile); reply.failed()) {
- return reply;
- }
- } else {
- qDebug() << "Running update-alternatives --set now";
- QProcess process;
- process.start(QStringLiteral("update-alternatives"), QStringList() << QStringLiteral("--set") << QStringLiteral("default.plymouth") << installFile);
- if (!process.waitForStarted()) {
- reply = ActionReply::BackendError;
- reply.setErrorDescription(i18n("Cannot start update-alternatives."));
- return reply;
- }
- if (!process.waitForFinished()) {
- reply = ActionReply::BackendError;
- reply.setErrorDescription(i18n("update-alternatives failed to run."));
- return reply;
- }
-
- if (int ret = process.exitCode(); ret != 0) {
- reply = ActionReply(ActionReply::HelperErrorReply());
- reply.setErrorCode(static_cast<ActionReply::Error>(ret));
- reply.setErrorDescription(i18n("update-alternatives returned with error condition %1.", ret));
- return reply;
- }
- }
- }
-
QProcess process;
- qDebug() << "Running update-initramfs -u now";
- process.start(QStringLiteral("/usr/sbin/update-initramfs"), QStringList() << QStringLiteral("-u"));
+ qDebug() << "Running dracut --force now";
+ process.start(QStringLiteral("/usr/sbin/dracut"), QStringList() << QStringLiteral("--force"));
if (!process.waitForStarted()) {
reply = ActionReply::BackendError;
- reply.setErrorDescription(i18n("Cannot start initramfs."));
+ reply.setErrorDescription(i18n("Cannot start dracut."));
return reply;
}
// We don't know how long this will take. The helper will need to generate N=installed_kernels initrds.
@@ -164,7 +101,7 @@ ActionReply PlymouthHelper::save(const Q
// NB: there is also a timeout in the KCM
if (!process.waitForFinished(std::chrono::milliseconds(15min).count())) {
reply = ActionReply::BackendError;
- reply.setErrorDescription(i18n("Initramfs failed to run."));
+ reply.setErrorDescription(i18n("Dracut failed to run."));
return reply;
}
@@ -174,7 +111,7 @@ ActionReply PlymouthHelper::save(const Q
}
reply = ActionReply(ActionReply::HelperErrorReply());
reply.setErrorCode(static_cast<ActionReply::Error>(ret));
- reply.setErrorDescription(i18n("Initramfs returned with error condition %1.", ret));
+ reply.setErrorDescription(i18n("Dracut returned with error condition %1.", ret));
return reply;
}
@@ -247,22 +184,6 @@ ActionReply PlymouthHelper::install(cons
archive->close();
- // Special case: Ubuntu derivatives, which work different from everybody else
- if (hasUpdateAlternatives()) {
- // find the .plymouth file in the theme
- QDir dir(themePath);
- const QStringList themeFile = dir.entryList({QStringLiteral("*.plymouth")});
- if (themeFile.count() != 1) {
- reply = ActionReply::BackendError;
- reply.setErrorDescription(i18n("Theme corrupted: .plymouth file not found inside theme."));
- return reply;
- }
-
- if (auto reply = updateAlternativesInstall(themePath + QLatin1Char('/') + themeFile.first()); reply.failed()) {
- return reply;
- }
- }
-
QVariantMap map;
map[QStringLiteral("plugin")] = themeName;
map[QStringLiteral("path")] = themePath;
@@ -294,40 +215,6 @@ ActionReply PlymouthHelper::uninstall(co
return reply;
}
- // Special case: Ubuntu derivatives, which work different from everybody else
- if (hasUpdateAlternatives()) {
- // find the .plymouth file in the theme
- const QStringList themeFile = dir.entryList(QStringList() << QStringLiteral("*.plymouth"));
- if (themeFile.count() != 1) {
- reply = ActionReply::BackendError;
- reply.setErrorDescription(i18n("Theme corrupted: .plymouth file not found inside theme."));
- return reply;
- }
- int ret = 0;
- QProcess process;
-
- process.start(QStringLiteral("update-alternatives"),
- {QStringLiteral("--remove"), QStringLiteral("default.plymouth"), dir.path() + QLatin1Char('/') + themeFile.first()});
- if (!process.waitForStarted()) {
- reply = ActionReply::BackendError;
- reply.setErrorDescription(i18n("Cannot start update-alternatives."));
- return reply;
- }
- if (!process.waitForFinished()) {
- reply = ActionReply::BackendError;
- reply.setErrorDescription(i18n("update-alternatives failed to run."));
- return reply;
- }
- ret = process.exitCode();
-
- if (ret != 0) {
- reply = ActionReply(ActionReply::HelperErrorReply());
- reply.setErrorCode(static_cast<ActionReply::Error>(ret));
- reply.setErrorDescription(i18n("update-alternatives returned with error condition %1.", ret));
- return reply;
- }
- }
-
if (dir.removeRecursively()) {
return ActionReply::SuccessReply();
}