Use consistent bash5 style for conditionals and quoting

This commit is contained in:
David Heinemeier Hansson
2026-02-21 10:18:47 +01:00
parent d2acf3b6ba
commit 7514ae7dcf
113 changed files with 289 additions and 287 deletions
+8 -8
View File
@@ -24,12 +24,12 @@ start_log_output() {
line="${current_lines[i]:-}"
# Truncate if needed
if [ ${#line} -gt $max_line_width ]; then
if (( ${#line} > max_line_width )); then
line="${line:0:$max_line_width}..."
fi
# Add clear line escape and formatted output for each line
if [ -n "$line" ]; then
if [[ -n $line ]]; then
output+="${ANSI_CLEAR_LINE}${ANSI_GRAY}${PADDING_LEFT_SPACES}${line}${ANSI_RESET}\n"
else
output+="${ANSI_CLEAR_LINE}${PADDING_LEFT_SPACES}\n"
@@ -45,7 +45,7 @@ start_log_output() {
}
stop_log_output() {
if [ -n "${monitor_pid:-}" ]; then
if [[ -n ${monitor_pid:-} ]]; then
kill $monitor_pid 2>/dev/null || true
wait $monitor_pid 2>/dev/null || true
unset monitor_pid
@@ -72,11 +72,11 @@ stop_install_log() {
echo "" >>"$OMARCHY_INSTALL_LOG_FILE"
echo "=== Installation Time Summary ===" >>"$OMARCHY_INSTALL_LOG_FILE"
if [ -f "/var/log/archinstall/install.log" ]; then
if [[ -f "/var/log/archinstall/install.log" ]]; then
ARCHINSTALL_START=$(grep -m1 '^\[' /var/log/archinstall/install.log 2>/dev/null | sed 's/^\[\([^]]*\)\].*/\1/' || true)
ARCHINSTALL_END=$(grep 'Installation completed without any errors' /var/log/archinstall/install.log 2>/dev/null | sed 's/^\[\([^]]*\)\].*/\1/' || true)
if [ -n "$ARCHINSTALL_START" ] && [ -n "$ARCHINSTALL_END" ]; then
if [[ -n $ARCHINSTALL_START ]] && [[ -n $ARCHINSTALL_END ]]; then
ARCH_START_EPOCH=$(date -d "$ARCHINSTALL_START" +%s)
ARCH_END_EPOCH=$(date -d "$ARCHINSTALL_END" +%s)
ARCH_DURATION=$((ARCH_END_EPOCH - ARCH_START_EPOCH))
@@ -88,7 +88,7 @@ stop_install_log() {
fi
fi
if [ -n "$OMARCHY_START_TIME" ]; then
if [[ -n $OMARCHY_START_TIME ]]; then
OMARCHY_START_EPOCH=$(date -d "$OMARCHY_START_TIME" +%s)
OMARCHY_END_EPOCH=$(date -d "$OMARCHY_END_TIME" +%s)
OMARCHY_DURATION=$((OMARCHY_END_EPOCH - OMARCHY_START_EPOCH))
@@ -98,7 +98,7 @@ stop_install_log() {
echo "Omarchy: ${OMARCHY_MINS}m ${OMARCHY_SECS}s" >>"$OMARCHY_INSTALL_LOG_FILE"
if [ -n "$ARCH_DURATION" ]; then
if [[ -n $ARCH_DURATION ]]; then
TOTAL_DURATION=$((ARCH_DURATION + OMARCHY_DURATION))
TOTAL_MINS=$((TOTAL_DURATION / 60))
TOTAL_SECS=$((TOTAL_DURATION % 60))
@@ -123,7 +123,7 @@ run_logged() {
local exit_code=$?
if [ $exit_code -eq 0 ]; then
if (( exit_code == 0 )); then
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Completed: $script" >>"$OMARCHY_INSTALL_LOG_FILE"
unset CURRENT_SCRIPT
else