replace sed with correct srftime dialog

This commit is contained in:
Tobias Powalowski 2024-06-26 22:47:46 +02:00
parent 4819849658
commit d5b0c738b5
2 changed files with 3 additions and 4 deletions

View file

@ -49,13 +49,12 @@ _timeset() {
if [[ -z "${_SET_TIME}" ]]; then
timedatectl set-ntp 0
# display and ask to set date/time
_dialog --title " Date " --no-cancel --calendar "Use <TAB> to navigate and arrow keys to change values." 0 0 0 0 0 2>"${_ANSWER}"
_dialog --title " Date " --no-cancel --calendar --date-format='%F' "Use <TAB> to navigate and arrow keys to change values." 0 0 0 0 0 2>"${_ANSWER}"
_DATE="$(cat "${_ANSWER}")"
_dialog --title " Time " --no-cancel --timebox "Use <TAB> to navigate and up/down to change values." 0 0 2>"${_ANSWER}"
_TIME="$(cat "${_ANSWER}")"
# save the time
# DD/MM/YYYY hh:mm:ss -> YYYY-MM-DD hh:mm:ss
_DATETIME="$(echo "${_DATE}" "${_TIME}" | sed 's#\(..\)/\(..\)/\(....\) \(..\):\(..\):\(..\)#\3-\2-\1 \4:\5:\6#g')"
_DATETIME=""${_DATE}" "${_TIME}""
timedatectl set-time "${_DATETIME}"
_SET_TIME="1"
fi

View file

@ -7,7 +7,7 @@
# wait for modules to initialize cmompletely
udevadm wait --settle /dev/fb0
# get screen setting mode from /sys
_FB_SIZE="$(sed -e 's#.*:##g' -e 's#x.*##g' /sys/class/graphics/fb0/modes 2>/dev/null)"
_FB_SIZE="$(rg -o ':(.*)x' -r '$1' /sys/class/graphics/fb0/modes 2>/dev/null)"
if [[ "${_FB_SIZE}" -gt '1900' ]]; then
_SIZE="32"
else