Skip to content

Commit

Permalink
v7.7 (#4836)
Browse files Browse the repository at this point in the history
+ General | The /boot/dietpi/func/obtain_network_details script has been removed, including the related /run/dietpi/.network file to obtain network details. All uses of these files have been replaced with the new DietPi-Globals G_GET_NET function.
+ DietPi-Patches | Remove obsolete /boot/dietpi/func/obtain_network_details
+ DietPi-Patches | GMediaRender: Patch service
+ DietPi-Config | Enter WiFi adapter menu after it has been enabled
+ DietPi-Config | Do not copy /etc/network/interfaces to /tmp to read interface info from tmpfs but read it from disk location directly. After first access this file is in filesystem cache so that reading it is as fast as from tmpfs.
+ DietPi-Patches | Extend wg0 patch to replace previous patches and remove those in turn.
  • Loading branch information
MichaIng authored Oct 14, 2021
1 parent f085acb commit d6ef16f
Show file tree
Hide file tree
Showing 18 changed files with 210 additions and 361 deletions.
32 changes: 32 additions & 0 deletions .update/patches
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,38 @@ Patch_7_7()
[[ -f '/etc/apt/trusted.gpg.d/dietpi-mono.gpg' ]] || G_EXEC curl -sSfL 'https://download.mono-project.com/repo/xamarin_ring.gpg' -o /etc/apt/trusted.gpg.d/dietpi-mono.gpg
[[ -f '/etc/apt/trusted.gpg' ]] && G_EXEC apt-key --keyring /etc/apt/trusted.gpg del '3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF'
fi

# WireGuard: Patch config
if [[ -f '/etc/wireguard/wg0.conf' ]]
then
G_DIETPI-NOTIFY 2 'Updating WireGuard wg0 configuration'
G_EXEC sed -i '\|/boot/dietpi/func/obtain_network_details|d' /etc/wireguard/wg0.conf
G_EXEC sed -Ei "s#mawk .NR==3. /(run|boot|DietPi)/dietpi/.network#ip r l 0/0 | mawk '{print \$5;exit}'#g" /etc/wireguard/wg0.conf
fi

# GMediaRender: Patch service
if [[ -f '/boot/dietpi/.installed' ]] && grep -q '^[[:blank:]]*aSOFTWARE_INSTALL_STATE\[163\]=2' /boot/dietpi/.installed
then
G_DIETPI-NOTIFY 2 'Updating GMediaRender service'
cat << _EOF_ > /etc/systemd/system/gmrender.service
[Unit]
Description=GMediaRender (DietPi)
Documentation=https://github.com/hzeller/gmrender-resurrect/blob/master/INSTALL.md#commandline-options
Wants=network-online.target
After=network-online.target sound.target dietpi-boot.service
[Service]
User=gmrender
ExecStartPre=+/bin/bash -c '. /boot/dietpi/func/dietpi-globals; systemctl set-environment ACTIVE_IP=\$(G_GET_NET ip)'
ExecStart=/usr/local/bin/gmediarender -u '$G_HW_UUID' -f '$(</etc/hostname)' --gstout-audiosink=alsasink --gstout-audiodevice=default --logfile=stdout -I "\$ACTIVE_IP"
[Install]
WantedBy=multi-user.target
_EOF_
fi

# Remove obsolete /boot/dietpi/func/obtain_network_details
[[ -f '/boot/dietpi/func/obtain_network_details' ]] && G_EXEC rm /boot/dietpi/func/obtain_network_details
}

# v6.35 => v7 migration
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ Removed software:
- CouchPotato | Sadly, the CouchPotato project is not maintained anymore and has been abandoned. In turn we removed it from DietPi. The instance installed on your system will remain, but it cannot be installed, reinstalled or uninstalled anymore. We recommend to migrate to an alternative project, like Radarr, which can be found in DietPi-Software was well. Manual CouchPotato uninstall instructions: https://github.com/MichaIng/DietPi/issues/4323#issuecomment-927128724

Changes:
- DietPi-Globals | G_GET_WAN_IP: We use our own GEO IP service now to show the systems WAN IP and location in the DietPi banner and DietPi-VPN. When Pi-hole was used, with a previous update, "freegeoip.app" was added to Pi-hole's whitlist, which is now not required anymore. You may hence remove that entry from the whitelist.
- General | The /boot/dietpi/func/obtain_network_details script has been removed, including the related /run/dietpi/.network file to obtain network details. All uses of these files have been replaced with the new DietPi-Globals G_GET_NET function (see below).
- DietPi-Globals | A new global function G_GET_NET has been added to print network interface details. Most importantly it prints info for the main interface, by following the priorities of /boot/dietpi/func/obtain_network_details: default gateway => state UP => IP assigned, but allows to additionally filter by IP family, type, interface name or print the default gateway explicitly. It aims to be a replacement for /boot/dietpi/func/obtain_network_details with more flexibility and to allow deriving always up-to-date interface info instead of depending on the correctness of a cache file.
- DietPi-Globals | G_GET_WAN_IP: We use our own GEO IP service now to show the systems WAN IP and location in the DietPi banner and DietPi-VPN. When Pi-hole was used, with a previous update, "freegeoip.app" was added to Pi-hole's whitlist, which is now not required anymore. You may hence remove that entry from the whitelist.
- DietPi-Globals | The global functions G_DEV_1 and G_DEV_BENCH have been removed, which did exist for testing and development only but are not used in our current workflows.
- DietPi-Login | The DietPi banner on login won't be shown anymore if ~/.hushlogin exists, which is a common method to prevent the shell from printing /etc/motd on login and should hence be respected for the DietPi banner as well. Many thanks to @dnknth for doing this suggestion: https://github.com/MichaIng/DietPi/issues/4786
- DietPi-JustBoom | Added the ability to enforce an output channel count, or to not enforce an audio format value to preserve the input stream format or leave conversion up to ALSA, which is now the default when resetting settings. Similarly the audio output buffer can now be unset to keep the MPD default. Generally, if not required for a specific reason, it is recommended to not convert the audio stream and keep these settings unchanged/default.
Expand All @@ -22,6 +23,7 @@ Fixes:
- DietPi-Backup | Resolved an issue where clearing the PATH cache via "hash" command did not work as of a wrong command line argument: https://github.com/MichaIng/DietPi/issues/4800
- DietPi-LetsEncrypt | Resolved an issue where the script failed when ownCloud or Nextcloud are were installed. Many thanks to @billouetaudrey for reporting this issue: https://github.com/MichaIng/DietPi/issues/4752
- DietPi-JustBoom | Resolved an issue where applying some MPD settings did not work. Many thanks to @elevader for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?t=9426
- DietPi-Config | Resolved an issue where the WiFi connection state could have been obtained falsely as accidentally the Ethernet interface index was used to derive it.
- DietPi-Software | Resolved an issue where software services failed with a cryptic error message, when an expected directory was not present. This was especially reported with Sonarr and Radarr, if their log directory was missing for some reason. When directories are missing, which are explicitly listed to be read-writeable within the systemd service, systemd prints "Failed at step NAMESPACE spawning", while Sonarr and Radarr themselves would print a clearer error message about the missing log directory. Many thanks to @stevewitz for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?t=9463
- DietPi-Software | Lighttpd: Resolved an issue where the upgrade from Buster to Bullseye, following our guide, fails if HTTPS was enabled via DietPi-LetsEncrypt before. Many thanks to @fhals for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?t=9477
- DietPi-Software | Kodi: Resolved an issue on RPi ARMv8/64-bit systems where Kodi fails to start when it was installed without a desktop. Many thanks to @Klola for reporting this issue: https://dietpi.com/phpbb/viewtopic.php?p=38079#p38079
Expand Down
5 changes: 0 additions & 5 deletions dietpi/boot
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@
# - Do not run before firstrun setup has finished, since related dietpi.txt settings are applied during first DietPi-Software run.
(( $G_DIETPI_INSTALL_STAGE > 1 )) && /boot/dietpi/func/run_ntpd 1
#----------------------------------------------------------------
# Write network details to /run/dietpi/.network
/boot/dietpi/func/obtain_network_details
# - Make file world-writeable initially, required for DietPi-Login to update it as non-root user
chmod 666 /run/dietpi/.network
#----------------------------------------------------------------
# Pre-installed image, 1st run
if (( $G_DIETPI_INSTALL_STAGE == 10 )); then

Expand Down
14 changes: 5 additions & 9 deletions dietpi/dietpi-cloudshell
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,8 @@
# Hostname
NETWORK_DETAILS_HOSTNAME=$(hostname)

# Active network adapater
NETWORK_DETAILS_ADAPTER=$(mawk 'NR==3' /run/dietpi/.network)
# Active network adapter
NETWORK_DETAILS_ADAPTER=$(G_GET_NET iface)

# Mode: DHCP/static
if grep -q "iface $NETWORK_DETAILS_ADAPTER inet dhcp" /etc/network/interfaces; then
Expand All @@ -528,14 +528,14 @@
fi

# IP / MAC addresses
NETWORK_DETAILS_IP_INT=$(mawk 'NR==4' /run/dietpi/.network)
NETWORK_DETAILS_IP_INT=$(G_GET_NET ip)
NETWORK_DETAILS_MAC_ADDRESS=$(<"/sys/class/net/$NETWORK_DETAILS_ADAPTER/address")

# Speed/Strength
# WiFi
if [[ $NETWORK_DETAILS_ADAPTER == *'wlan'* ]]; then
if [[ $NETWORK_DETAILS_ADAPTER == 'wlan'* ]]; then

NETWORK_DETAILS_SIGNAL_STRENGTH="$(iwconfig "$NETWORK_DETAILS_ADAPTER" | mawk '/Signal level=/{print $4}' | sed 's/level=//g' | cut -f1 -d "/")%"
NETWORK_DETAILS_SIGNAL_STRENGTH="$(iwconfig "$NETWORK_DETAILS_ADAPTER" | mawk '/Signal level=/{print $4}' | sed 's/level=//g' | cut -f1 -d '/')%"
NETWORK_DETAILS_DUPLEXSPEED="$(iwconfig "$NETWORK_DETAILS_ADAPTER" | mawk '/Bit Rate:/{print $2}' | sed 's/Rate://g')Mbit"

# Ethernet
Expand Down Expand Up @@ -1109,10 +1109,6 @@ _EOF_
# Ensure we have at least 1 scene (dietpi) enabled in the settings file.
[[ ${aEnabledScenes[*]} == *1* ]] || aEnabledScenes[4]=1 SCENE_CURRENT=4

#--------------------------------------------------------------------------------
# Update DietPi network shared data: https://github.com/MichaIng/DietPi/issues/359
/boot/dietpi/func/obtain_network_details

}

#/////////////////////////////////////////////////////////////////////////////////////
Expand Down
Loading

2 comments on commit d6ef16f

@ThomasKaiser
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is func/dietpi-benchmark in use to 'measure' CPU performance?

@MichaIng
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Among others, yes. Since it has nothing to do with this commit, have a look into the actual code: https://github.com/MichaIng/DietPi/blob/dev/dietpi/func/dietpi-benchmark#L99

Please sign in to comment.