Skip to content

Commit fd36611

Browse files
authored
Merge pull request #179 from desultory/dev
use printf instead of echo -e for more shell compatibility
2 parents 93bc7b6 + f193e5e commit fd36611

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/ugrd/base/base.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = "desultory"
2-
__version__ = "6.1.2"
2+
__version__ = "6.2.0"
33

44
from pathlib import Path
55

@@ -207,11 +207,11 @@ def prompt_user(self) -> list[str]:
207207
"if plymouth --ping; then",
208208
' plymouth display-message --text="$prompt"',
209209
"else",
210-
r' echo -e "\e[1;35m *\e[0m $prompt"',
210+
r' printf "\e[1;35m *\e[0m $prompt"',
211211
"fi",
212212
]
213213
else:
214-
output += [r'echo -e "\e[1;35m *\e[0m $prompt"']
214+
output += [r'printf "\e[1;35m *\e[0m $prompt"']
215215
output += [
216216
'if [ -n "$2" ]; then',
217217
' read -t "$2" -rs && return 0 || return 1',
@@ -266,7 +266,7 @@ def edebug(self) -> str:
266266
if [ "$(readvar debug)" != "1" ]; then
267267
return
268268
fi
269-
echo -e "\e[1;34m *\e[0m ${*}"
269+
printf "\e[1;34m *\e[0m ${*}"
270270
"""
271271

272272

@@ -282,7 +282,7 @@ def einfo(self) -> list[str]:
282282
else:
283283
output = []
284284

285-
output += ["if check_var quiet; then", " return", "fi", r'echo -e "\e[1;32m *\e[0m ${*}"']
285+
output += ["if check_var quiet; then", " return", "fi", r'printf "\e[1;32m *\e[0m ${*}"']
286286
return output
287287

288288

@@ -304,7 +304,7 @@ def ewarn(self) -> list[str]:
304304
"if check_var quiet; then",
305305
" return",
306306
"fi",
307-
r'echo -e "\e[1;33m *\e[0m ${*}"',
307+
r'printf "\e[1;33m *\e[0m ${*}"',
308308
]
309309
return output
310310

@@ -317,7 +317,7 @@ def eerror(self) -> str:
317317
plymouth display-message --text="Error: ${*}"
318318
return
319319
fi
320-
echo -e "\e[1;31m *\e[0m ${*}"
320+
printf "\e[1;31m *\e[0m ${*}"
321321
"""
322322
else:
323-
return r'echo -e "\e[1;31m *\e[0m ${*}"'
323+
return r'printf "\e[1;31m *\e[0m ${*}"'

src/ugrd/fs/fakeudev.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ def fake_dm_udev(self) -> str:
1616
source "${dm}/uevent"
1717
einfo "Faking udev for: ${DEVNAME}"
1818
udev_db_file="/run/udev/data/b${MAJOR}:${MINOR}"
19-
echo -e 'E:DM_UDEV_PRIMARY_SOURCE_FLAG=1\n' > "${udev_db_file}"
19+
printf 'E:DM_UDEV_PRIMARY_SOURCE_FLAG=1\n' > "${udev_db_file}"
2020
done
2121
"""

0 commit comments

Comments
 (0)