@@ -260,25 +260,37 @@ def einfo(self) -> str:
260260
261261
262262def ewarn (self ) -> str :
263- """Returns a bash function like ewarn."""
264- return [
265- "if check_var plymouth; then" ,
266- ' plymouth display-message --text="Warning: ${*}"' ,
267- " return" ,
268- "fi" ,
263+ """Returns a bash function like ewarn.
264+ If plymouth is running, it displays a message instead of echoing.
265+ """
266+ if "ugrd.base.plymouth" in self ["modules" ]:
267+ output = [
268+ "if check_var plymouth; then" , # Always show the message if plymouth is running
269+ ' plymouth display-message --text="Warning: ${*}"' ,
270+ " return" , # Return early so echo doesn't leak
271+ "fi" ,
272+ ]
273+ else :
274+ output = []
275+
276+ output += [
269277 "if check_var quiet; then" ,
270278 " return" ,
271279 "fi" ,
272280 r'echo -e "\e[1;33m *\e[0m ${*}"' ,
273281 ]
282+ return output
274283
275284
276285def eerror (self ) -> str :
277286 """Returns a bash function like eerror."""
278- return [
279- "if check_var plymouth; then" ,
280- ' plymouth display-message --text="Error: ${*}"' ,
281- " return" ,
282- "fi" ,
283- r'echo -e "\e[1;31m *\e[0m ${*}"' ,
284- ]
287+ if "ugrd.base.plymouth" in self ["modules" ]:
288+ return [
289+ "if check_var plymouth; then" ,
290+ ' plymouth display-message --text="Error: ${*}"' ,
291+ " return" ,
292+ "fi" ,
293+ r'echo -e "\e[1;31m *\e[0m ${*}"'
294+ ]
295+ else :
296+ return [r'echo -e "\e[1;31m *\e[0m ${*}"' ]
0 commit comments