Skip to content

Commit

Permalink
Beta v9.6.1 (#7137)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaIng authored Jul 7, 2024
2 parents 0ba8261 + dda0c51 commit 7f5ece1
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 73 deletions.
27 changes: 27 additions & 0 deletions .update/patches
Original file line number Diff line number Diff line change
Expand Up @@ -1710,6 +1710,33 @@ Patch_9_6()
# Remove obsolete drop-in config: https://github.com/MichaIng/DietPi/issues/7104
[[ -f '/etc/systemd/system/[email protected]/dietpi.conf' ]] && G_EXEC rm -R /etc/systemd/system/[email protected]/dietpi.conf
[[ -d '/etc/systemd/system/[email protected]' ]] && G_EXEC rmdir --ignore-fail-on-non-empty /etc/systemd/system/[email protected]

# Fix filter for STDOUT logging since Bookworm: https://github.com/fail2ban/fail2ban/pull/3597
if [[ -f '/etc/fail2ban/filter.d/dropbear.conf' && ! -f '/etc/fail2ban/filter.d/dropbear.local' ]]
then
G_DIETPI-NOTIFY 2 'Fixing Dropbear Fail2Ban filter for STDOUT logging since Bookworm: https://github.com/fail2ban/fail2ban/pull/3597'
cat << '_EOF_' > /etc/fail2ban/filter.d/dropbear.local
[INCLUDES]
before = common.conf
[Definition]
_daemon = dropbear
# Fix filter for STDOUT logging since Bookworm: https://github.com/fail2ban/fail2ban/pull/3597
prefregex = ^%(__prefix_line)s(\[\d+\] [A-Z][a-z]+ \d\d \d\d:\d\d:\d\d )?<F-CONTENT>(?:[Ll]ogin|[Bb]ad|[Ee]xit).+</F-CONTENT>$
failregex = ^[Ll]ogin attempt for nonexistent user ('.*' )?from <HOST>:\d+$
^[Bb]ad (PAM )?password attempt for .+ from <HOST>(:\d+)?$
^[Ee]xit before auth \(user '.+', \d+ fails\): Max auth tries reached - user '.+' from <HOST>:\d+\s*$
ignoreregex =
# Add journalmatch to enhance performance since Bookworm
journalmatch = _SYSTEMD_UNIT=dropbear.service + _COMM=dropbear
_EOF_
G_EXEC systemctl restart fail2ban
fi
}

# v6.35 => v7 migration
Expand Down
2 changes: 1 addition & 1 deletion .update/version
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Available DietPi version
G_REMOTE_VERSION_CORE=9
G_REMOTE_VERSION_SUB=6
G_REMOTE_VERSION_RC=0
G_REMOTE_VERSION_RC=1
# Minimum DietPi version to allow update
G_MIN_VERSION_CORE=7
G_MIN_VERSION_SUB=0
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
v9.6
(2024-07-06)
(2024-07-07)

New software:
- soju | This IRC bouncer has been added to our software catalogue. Many thanks to @subnut for implementing it: https://github.com/MichaIng/DietPi/pull/7124
Expand All @@ -22,6 +22,7 @@ Bug fixes:
- DietPi-Drive_Manager | Resolved an issue, where network drives and potentially mounts in general could be attempted to be unmounted on shutdown, before services which can access them are stopped, leading to hanging shutdown sequences and potentially even data loss. Many thanks to @polite-garlic for reporting this issue: https://dietpi.com/forum/t/20542
- DietPi-Dashboard | Resolved an issue where the installation on RISC-V systems failed.
- DietPi-Software | Node-RED: Resolved an issue where reinstalls/updates failed because of incompatibilities between latest Node.js or global modules with older local instances. Many thanks to @thinkbig1979 for reporting this issue: https://github.com/MichaIng/DietPi/issues/7128
- DietPi-Software | Fail2Ban: Resolved an issue on Debian Bookworm and above, where Dropbear login failures were not detected due to a non-matching default filter. Dropbear runs as native systemd unit since Bookworm, logging to the system journal via STDOUT, which results in a different log entry prefix. The default filter however has not been updated for this. The fix is as well applied to existing Fail2Ban installs, as long as no own override /etc/fail2ban/filter.d/dropbear.local has been created. Many thanks to @ThePlanplan for reporting this issue: https://github.com/MichaIng/DietPi/issues/6665

As always, many smaller code performance and stability improvements, visual and spelling fixes have been done, too much to list all of them here. Check out all code changes of this release on GitHub: https://github.com/MichaIng/DietPi/pull/ADDME

Expand Down
38 changes: 27 additions & 11 deletions dietpi/dietpi-software
Original file line number Diff line number Diff line change
Expand Up @@ -6314,7 +6314,7 @@ _EOF_
*) local arch='x64';;
esac

local fallback_url="https://github.com/Kareadita/Kavita/releases/download/v0.8.1/kavita-linux-$arch.tar.gz"
local fallback_url="https://github.com/Kareadita/Kavita/releases/download/v0.8.2/kavita-linux-$arch.tar.gz"
Download_Install "$(curl -sSfL 'https://api.github.com/repos/Kareadita/Kavita/releases/latest' | mawk -F\" "/^ *\"browser_download_url\": \".*\/kavita-linux-$arch\.tar\.gz\"$/{print \$4}")"
G_EXEC chmod +x Kavita/Kavita

Expand Down Expand Up @@ -6678,13 +6678,8 @@ _EOF_
# - Disable cache
local cache=$(runuser -u nodered -- mktemp -d)
# - Reinstall: Remove all locally installed modules, to work around update issues, but preserve installed plugins from package.json: https://github.com/MichaIng/DietPi/issues/7128
if [[ -f 'package.json' ]]
then
G_EXEC rm -Rf node_modules .npm/_cacache
G_EXEC_OUTPUT=1 G_EXEC runuser -u nodered -- npm up --cache "$cache" --no-audit
else
G_EXEC_OUTPUT=1 G_EXEC runuser -u nodered -- npm i --cache "$cache" --no-audit node-red
fi
[[ -f 'package.json' ]] && G_EXEC rm -Rf node_modules .npm/_cacache
G_EXEC_OUTPUT=1 G_EXEC runuser -u nodered -- npm i --cache "$cache" --no-audit node-red@latest
G_EXEC rm -R "$cache"
G_EXEC cd "$G_WORKING_DIR"

Expand Down Expand Up @@ -7300,6 +7295,27 @@ _EOF_
# Log to systemd by default
G_EXEC eval 'echo -e '\''[Definition]\nlogtarget = SYSOUT'\'' > /etc/fail2ban/fail2ban.d/97_dietpi.conf'

# Fix Dropbear filter for STDOUT logging since Bookworm: https://github.com/fail2ban/fail2ban/pull/3597
[[ -f '/etc/fail2ban/filter.d/dropbear.local' ]] || cat << '_EOF_' > /etc/fail2ban/filter.d/dropbear.local
[INCLUDES]
before = common.conf

[Definition]

_daemon = dropbear

# Fix filter for STDOUT logging since Bookworm: https://github.com/fail2ban/fail2ban/pull/3597
prefregex = ^%(__prefix_line)s(\[\d+\] [A-Z][a-z]+ \d\d \d\d:\d\d:\d\d )?<F-CONTENT>(?:[Ll]ogin|[Bb]ad|[Ee]xit).+</F-CONTENT>$

failregex = ^[Ll]ogin attempt for nonexistent user ('.*' )?from <HOST>:\d+$
^[Bb]ad (PAM )?password attempt for .+ from <HOST>(:\d+)?$
^[Ee]xit before auth \(user '.+', \d+ fails\): Max auth tries reached - user '.+' from <HOST>:\d+\s*$

ignoreregex =

# Add journalmatch to enhance performance since Bookworm
journalmatch = _SYSTEMD_UNIT=dropbear.service + _COMM=dropbear
_EOF_
G_AGI python3-systemd fail2ban
Remove_SysV fail2ban 1

Expand Down Expand Up @@ -9970,7 +9986,7 @@ _EOF_
*) local arch='x64';;
esac

local fallback_url="https://github.com/Prowlarr/Prowlarr/releases/download/v1.19.0.4568/Prowlarr.master.1.19.0.4568.linux-core-$arch.tar.gz"
local fallback_url="https://github.com/Prowlarr/Prowlarr/releases/download/v1.20.1.4603/Prowlarr.master.1.20.1.4603.linux-core-$arch.tar.gz"
Download_Install "$(curl -sSfL 'https://api.github.com/repos/Prowlarr/Prowlarr/releases/latest' | mawk -F\" "/^ *\"browser_download_url\": \".*linux-core-$arch\.tar\.gz\"$/{print \$4}")"
G_EXEC mv Prowlarr /opt/prowlarr
fi
Expand Down Expand Up @@ -10044,7 +10060,7 @@ _EOF_
*) local arch='x64';;
esac

local fallback_url="https://github.com/Readarr/Readarr/releases/download/v0.3.29.2565/Readarr.develop.0.3.29.2565.linux-core-$arch.tar.gz"
local fallback_url="https://github.com/Readarr/Readarr/releases/download/v0.3.30.2576/Readarr.develop.0.3.30.2576.linux-core-$arch.tar.gz"
Download_Install "$(curl -sSfL 'https://api.github.com/repos/Readarr/Readarr/releases' | mawk -F\" "/^ *\"browser_download_url\": \".*linux-core-$arch\.tar\.gz\"$/{print \$4}" | head -1)"
G_EXEC mv Readarr /opt/readarr
fi
Expand Down Expand Up @@ -10612,7 +10628,7 @@ _EOF_
*) local arch='arm-6';;
esac

local fallback_url="https://github.com/go-gitea/gitea/releases/download/v1.22.0/gitea-1.22.0-linux-$arch.xz"
local fallback_url="https://github.com/go-gitea/gitea/releases/download/v1.22.1/gitea-1.22.1-linux-$arch.xz"
Download_Install "$(curl -sSfL 'https://api.github.com/repos/go-gitea/gitea/releases/latest' | mawk -F\" "/\"browser_download_url\": \".*\/gitea-[^\"\/]*-linux-$arch\.xz\"/{print \$4}")" /mnt/dietpi_userdata/gitea/gitea

# User
Expand Down
156 changes: 96 additions & 60 deletions dietpi/func/dietpi-globals
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# - Assign defaults/code version as fallback
[[ $G_DIETPI_VERSION_CORE ]] || G_DIETPI_VERSION_CORE=9
[[ $G_DIETPI_VERSION_SUB ]] || G_DIETPI_VERSION_SUB=6
[[ $G_DIETPI_VERSION_RC ]] || G_DIETPI_VERSION_RC=0
[[ $G_DIETPI_VERSION_RC ]] || G_DIETPI_VERSION_RC=1
[[ $G_GITBRANCH ]] || G_GITBRANCH='master'
[[ $G_GITOWNER ]] || G_GITOWNER='MichaIng'
# - Save current version and Git branch
Expand Down Expand Up @@ -803,6 +803,63 @@ $grey─────────────────────────
return "${result:-1}"
}

# G_BUG_REPORT [-c COMMAND] [-? EXIT_CODE]
# - Print pre-filled bug report template
G_BUG_REPORT()
{
local command exit_code
while (( $# ))
do
case $1 in
'-c') shift; command=$1;;
'-?') shift; exit_code=$1;;
*) G_DIETPI-NOTIFY 1 "Invalid argument \"$1\""; return 1;;
esac
shift
done

# Print bug report template
echo "#### Details:
- Date | $(date '+%F %T')"
# - Add program/script name, failed command and exit code if given
[[ $G_PROGRAM_NAME ]] && echo "- Program name | $G_PROGRAM_NAME"
[[ $command ]] && echo "- Command | \`$command\`"
[[ $exit_code ]] && echo "- Exit code | $exit_code"
echo "- DietPi version | v$G_DIETPI_VERSION_CORE.$G_DIETPI_VERSION_SUB.$G_DIETPI_VERSION_RC ($G_GITOWNER/$G_GITBRANCH)
- Distro version | $G_DISTRO_NAME (ID=$G_DISTRO${G_RASPBIAN:+,RASPBIAN=$G_RASPBIAN})
- Kernel version | \`$(uname -a)\`
- Architecture | \`$(dpkg --print-architecture)\`
- Hardware model | $G_HW_MODEL_NAME (ID=$G_HW_MODEL)
- Power supply | (EG: RAVPower 5V 1A)
- SD card | (EG: SanDisk Ultra 16 GB)"
# - Add image creator and pre-image info if given
if [[ -f '/boot/dietpi/.prep_info' ]]
then
image_creator=$(mawk 'NR==1' /boot/dietpi/.prep_info)
[[ ${image_creator:-0} == 0 ]] || echo "- Image creator | $image_creator"
preimage_name=$(mawk 'NR==2' /boot/dietpi/.prep_info)
[[ $preimage_name ]] && echo "- Pre-image | $preimage_name"
fi
echo '#### Steps to reproduce:
<!-- Explain how to reproduce the issue -->
1. ...
2. ...
#### Expected behaviour:
<!-- What SHOULD happen? -->
- ...
#### Actual behaviour:
<!-- What IS happening? -->
- ...
#### Extra details:
<!-- Please post any extra details that might help solve the issue -->
- ...
#### Additional logs:
```'
# - Add log if given
[[ -f '/tmp/G_EXEC_LOG' ]] && cat '/tmp/G_EXEC_LOG' || echo '<!-- Please paste logs or related console output here -->'
echo '```'
}

#-----------------------------------------------------------------------------------
# Error handled command execution wrapper
#-----------------------------------------------------------------------------------
Expand Down Expand Up @@ -867,60 +924,17 @@ $grey─────────────────────────
# Retry non-interactively if current $attempt is <= $G_EXEC_RETRIES
[[ $attempt -le $G_EXEC_RETRIES ]] && { ((attempt++)) && continue; }

# Print command output if not done already
[[ $G_EXEC_OUTPUT != 1 ]] && cat "$fp_log"

# Print FAILED, append raw command string if $G_EXEC_DESC is given
G_DIETPI-NOTIFY 1 "${G_EXEC_DESC:+$G_EXEC_DESC\n - Command: }$ecommand"

# Exit retry loop if $G_EXEC_NOHALT=1 is given
[[ $G_EXEC_NOHALT == 1 ]] && break

# Prepare error handler menu and GitHub issue template
local fp_error_report='/tmp/G_EXEC_ERROR_REPORT' log_content=$(<"$fp_log") image_creator preimage_name dietpi_version="v$G_DIETPI_VERSION_CORE.$G_DIETPI_VERSION_SUB.$G_DIETPI_VERSION_RC ($G_GITOWNER/$G_GITBRANCH)" last_whip_menu_item sent_bug_report
if [[ -f '/boot/dietpi/.prep_info' ]]; then

image_creator=$(mawk 'NR==1' /boot/dietpi/.prep_info)
[[ $image_creator == 0 ]] && image_creator='DietPi Core Team'
preimage_name=$(mawk 'NR==2' /boot/dietpi/.prep_info)

fi

# Create GitHub issue template if error was produced by one of our scripts
[[ ${G_PROGRAM_NAME,,} == 'dietpi-'* ]] && echo -e "\e[41m
---------------------------------------------------------------------
- DietPi has encountered an error -
- Please create a ticket: https://github.com/MichaIng/DietPi/issues -
- Copy and paste only the BLUE lines below into the ticket -
---------------------------------------------------------------------\e[44m
#### Details:
- Date | $(date)
- DietPi version | $dietpi_version
- Image creator | $image_creator
- Pre-image | $preimage_name
- Hardware | $G_HW_MODEL_NAME (ID=$G_HW_MODEL)
- Kernel version | \`$(uname -a)\`
- Distro | $G_DISTRO_NAME (ID=$G_DISTRO${G_RASPBIAN:+,RASPBIAN=$G_RASPBIAN})
- Command | \`$ecommand\`
- Exit code | $exit_code
- Software title | $G_PROGRAM_NAME
#### Steps to reproduce:
<!-- Explain how to reproduce the issue -->
1. ...
2. ...
#### Expected behaviour:
<!-- What SHOULD happen? -->
- ...
#### Actual behaviour:
<!-- What IS happening? -->
- ...
#### Extra details:
<!-- Please post any extra details that might help solve the issue -->
- ...
#### Additional logs:
\`\`\`
$log_content
\`\`\`\e[41m
---------------------------------------------------------------------\e[0m" > "$fp_error_report"

# Enter error handler menu loop in interactive mode
local last_whip_menu_item sent_bug_report fp_error_report='/tmp/G_EXEC_ERROR_REPORT' dietpi_version="v$G_DIETPI_VERSION_CORE.$G_DIETPI_VERSION_SUB.$G_DIETPI_VERSION_RC ($G_GITOWNER/$G_GITBRANCH)"
[[ $G_INTERACTIVE == 1 ]] && while :
do
G_WHIP_MENU_ARRAY=('Retry' ': Re-run the last command that failed')
Expand All @@ -929,8 +943,13 @@ $log_content
# Allow to open DietPi-Config if this error was not produced within DietPi-Config
pgrep -cf 'dietpi-config' &> /dev/null || G_WHIP_MENU_ARRAY+=('DietPi-Config' ': Edit network, APT/NTP mirror settings etc')
G_WHIP_MENU_ARRAY+=('Open subshell' ': Open a subshell to investigate or solve the issue')
# Allow to send bug report, if it was produced by one of our scripts
[[ ${G_PROGRAM_NAME,,} == 'dietpi-'* && $G_PROGRAM_NAME != 'DietPi-Installer' ]] && G_WHIP_MENU_ARRAY+=('Send report' ': Uploads bugreport containing system info to DietPi')

# Allow to send bug report if it was produced by one of our scripts, excluding DietPi-Installer
[[ ${G_PROGRAM_NAME,,} == 'dietpi-'* && $G_PROGRAM_NAME != 'DietPi-Installer' ]] && G_WHIP_MENU_ARRAY+=('Send report' ': Upload bug report including system info to DietPi')

# Allow to print bug report template if it was produced by one of our scripts
[[ ${G_PROGRAM_NAME,,} == 'dietpi-'* ]] && G_WHIP_MENU_ARRAY+=('Print report' ': Print bug report template for GitHub or forum')

G_WHIP_MENU_ARRAY+=('' '●─ Devs only ')
G_WHIP_MENU_ARRAY+=('Change command' ': Adjust and rerun the command')

Expand All @@ -940,8 +959,8 @@ $log_content
G_WHIP_MENU "${G_EXEC_DESC:+$(mawk '{gsub("\\\e[[0-9][;0-9]*m","");print}' <<< "$G_EXEC_DESC")\n} - Command: ${acommand[*]}
- Exit code: $exit_code
- DietPi version: $dietpi_version | HW_MODEL: $G_HW_MODEL | HW_ARCH: $G_HW_ARCH | DISTRO: $G_DISTRO
${image_creator:+ - Image creator: $image_creator\n}${preimage_name:+ - Pre-image: $preimage_name\n} - Error log:
$log_content" || break # Exit error handler menu loop on cancel
- Error log:
$(<"$fp_log")" || break # Exit error handler menu loop on cancel

last_whip_menu_item=$G_WHIP_RETURNED_VALUE

Expand All @@ -968,10 +987,34 @@ $log_content" || break # Exit error handler menu loop on cancel

elif [[ $G_WHIP_RETURNED_VALUE == 'Send report' ]]; then

# Store error details to append to bug report upload
G_BUG_REPORT -c "${acommand[*]}" -? "$exit_code" > "$fp_error_report"

# Send report
/boot/dietpi/dietpi-bugreport 1 && sent_bug_report=1
read -rp '
Press any key to continue...'

elif [[ $G_WHIP_RETURNED_VALUE == 'Print report' ]]; then

echo -e '\e[41m---------------------------------------------------------------------
- DietPi bug report template for GitHub or forum -
- Please report at: https://github.com/MichaIng/DietPi/issues -
or: https://dietpi.com/forum/c/troubleshooting/10 -
- Copy and paste ONLY the BLUE lines below, replacing the template! -
---------------------------------------------------------------------\e[44m'
# Add bug report ID if sent already
if [[ $sent_bug_report == 1 ]]
then
sed --follow-symlinks -i "/^- Date | /a\- Bug report | $G_HW_UUID" "$fp_error_report"
cat "$fp_error_report"
else
G_BUG_REPORT -c "${acommand[*]}" -? "$exit_code"
fi
echo -e '\e[41m---------------------------------------------------------------------\e[0m'
read -rp '
Press any key to continue...'

elif [[ $G_WHIP_RETURNED_VALUE == 'Change command' ]]; then

G_WHIP_DEFAULT_ITEM=${acommand[*]}
Expand All @@ -997,14 +1040,7 @@ Press any key to continue...'
fi
done

# Error has not been solved, print GitHub issue template if it was produced and exit error handler menu loop
if [[ -f $fp_error_report ]]; then

# Add bug report ID if it was sent
[[ $sent_bug_report == 1 ]] && sed --follow-symlinks -i "/^- Date | /a\- Bug report | $G_HW_UUID" "$fp_error_report"
cat "$fp_error_report"

fi
# Error has not been solved, exit error handler menu loop
break
done

Expand Down

0 comments on commit 7f5ece1

Please sign in to comment.