Skip to content

Commit 9fffb25

Browse files
authored
Merge pull request #191 from desultory/dev
improve POSIX shell compatibility, fix quoting
2 parents f1c1ba5 + c3e86fe commit 9fffb25

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/ugrd/base/base.py

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

44
from pathlib import Path
55

@@ -183,7 +183,7 @@ def setvar(self) -> str:
183183
if check_var debug; then
184184
edebug "Setting $1 to $2"
185185
fi
186-
echo -n "$2" > "/run/vars/${1}"
186+
printf "%s" "$2" > "/run/vars/${1}"
187187
"""
188188

189189

@@ -221,11 +221,11 @@ def wait_enter(self) -> str:
221221
"""
222222
return r"""
223223
tty_env=$(stty -g)
224-
t=$(printf "%.0f" $(echo "${1:-0} * 10" | bc))
224+
t=$(printf "%.0f" "$(echo "${1:-0} * 10" | bc)")
225225
if [ "$t" -gt 300 ]; then
226226
stty raw -echo min 0 time 300
227227
elif [ "$t" -gt 0 ]; then
228-
stty raw -echo min 0 time $t
228+
stty raw -echo min 0 time "$t"
229229
else
230230
stty raw -echo
231231
fi

src/ugrd/crypto/cryptsetup.py

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

44
from pathlib import Path
55

@@ -428,14 +428,14 @@ def get_crypt_dev(self) -> str:
428428
source_token="$(readvar CRYPTSETUP_TOKEN_"$1")"
429429
if [ -n "$source_dev" ]; then
430430
if [ -e "$source_dev" ]; then
431-
echo -n "$source_dev"
431+
printf "%s" "$source_dev"
432432
return
433433
fi
434434
fi
435435
if [ -n "$source_token" ]; then
436436
source_dev=$(blkid --match-token "$source_token" --output device)
437437
if [ -n "$source_dev" ]; then
438-
echo -n "$source_dev"
438+
printf "%s" "$source_dev"
439439
fi
440440
fi
441441
if [ -z "$source_dev" ]; then

src/ugrd/fs/btrfs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "1.12.3"
1+
__version__ = "1.12.4"
22
__author__ = "desultory"
33

44
from pathlib import Path
@@ -115,7 +115,7 @@ def select_subvol(self) -> str:
115115
ewarn 'Invalid selection'
116116
else
117117
einfo "Selected subvolume: $subvol"
118-
echo -n ",subvol=$subvol" >> /run/vars/MOUNTS_ROOT_OPTIONS
118+
printf "%s" ",subvol=$subvol" >> /run/vars/MOUNTS_ROOT_OPTIONS
119119
break
120120
fi
121121
;;
@@ -130,4 +130,4 @@ def select_subvol(self) -> str:
130130
def set_root_subvol(self) -> str:
131131
"""Adds the root_subvol to the root_mount options."""
132132
_validate_root_subvol(self)
133-
return f"""echo -n ",subvol={self['root_subvol']}" >> /run/vars/MOUNTS_ROOT_OPTIONS"""
133+
return f"""printfs ",subvol={self['root_subvol']}" >> /run/vars/MOUNTS_ROOT_OPTIONS"""

src/ugrd/fs/resume.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.4.1"
1+
__version__ = "0.4.2"
22

33

44
def handle_resume(self) -> None:
@@ -24,7 +24,7 @@ def handle_resume(self) -> None:
2424
" fi",
2525
' if [ -e "$resume" ]; then', # Check if the resume device exists
2626
' einfo "Resuming from: $resume"',
27-
' echo -n "$resume" > /sys/power/resume', # Attempt to resume
27+
' printf "%s" "$resume" > /sys/power/resume', # Attempt to resume
2828
' ewarn "Failed to resume from: $resume"',
2929
" else",
3030
' ewarn "Resume device not found: $resume)"', # Warn if the resume device does not exist

0 commit comments

Comments
 (0)