Skip to content

Commit

Permalink
v7.4 (#4572)
Browse files Browse the repository at this point in the history
+ DietPi-Update | Add initial live patches to remote version file to test the implementation
+ DietPi-Update | Add support for live patches, when present on currently applied Git branch
+ DietPi-Banner | Show new available DietPi live patches in banner, based on flag file
+ DietPi-PREP | Apply live patches via new mechanism and store info of already applied patches in .version file. Do this as early as possible, to have bugs fixed before using the scripts. Copy the separately stored image version file back in place, after .version got removed during a later cleanup step.
+ CHANGELOG | DietPi-Update: A new live patching system has been implemented. This allows us to ship little fixes and updates, that are safe to apply with a one-line command, until the next DietPi version is released. Live patches are checked for together with DietPi updates and a notification is shown in the login banner as well, when new live patches have been found. When available, each patch can be individually applied or dismissed and the login banner won't bother you again about patches that you have seen in the dietpi-update menu already, regardless whether you applied them or not.
  • Loading branch information
MichaIng authored Jul 22, 2021
1 parent db6c370 commit e66ca7b
Show file tree
Hide file tree
Showing 5 changed files with 281 additions and 107 deletions.
13 changes: 13 additions & 0 deletions .update/version
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,16 @@ G_OLD_VERSION_BRANCH='master'
G_MIN_DEBIAN=4
# Alternative Git branch to automatically migrate to when Debian version is too low
G_OLD_DEBIAN_BRANCH='jessie-support'
# Live patches
G_LIVE_PATCH_DESC=(
[0]='This is the first test patch. You can apply it, but it will not do anything aside of printing a message to console.'
[1]='This is a second test patch. You should not be able to apply it, as its condition should always return false.'
)
G_LIVE_PATCH_COND=(
[0]='[[ 'This condition is true' ]]'
[1]='[[ ! 'This condition is false' ]]'
)
G_LIVE_PATCH=(
[0]='echo "Live patch 0 applied at: $(date)"'
[1]='echo "Live patch 1 applied at: $(date)\nThis was never intended to happen :(!"'
)
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ v7.4
(2021-07-24)

Changes:
- DietPi-Update | A new live patching system has been implemented. This allows us to ship little fixes and updates, that are safe to apply with a one-line command, until the next DietPi version is released. Live patches are checked for together with DietPi updates and a notification is shown in the login banner as well, when new live patches have been found. When available, each patch can be individually applied or dismissed and the login banner won't bother you again about patches that you have seen in the dietpi-update menu already, regardless whether you applied them or not.
- DietPi-Software | Home Assistant: On ARMv6/7, piwheels.org is now used within pyenv, which ships pre-compiled wheels for many Python modules and by this speeds up the installation, first service start and install of new integrations.
- DietPi-Software | myMPD: Updated config steps to work with the new myMPD v8.0.0. Many thanks to @jcorporation for informing us about this major update and how to adjust our config steps: https://github.com/MichaIng/DietPi/issues/4562
- DietPi-Software | Komga: Obsolete entries have been removed from the default config and file hashing will be disabled on new installs. Many thanks to @quyentruong for contributing this change: https://github.com/MichaIng/DietPi/pull/4570
Expand Down
41 changes: 25 additions & 16 deletions PREP_SYSTEM_FOR_DIETPI.sh
Original file line number Diff line number Diff line change
Expand Up @@ -575,12 +575,28 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then
G_EXEC_DESC='Clean download location' G_EXEC rm -R "DietPi-$G_GITBRANCH"
G_EXEC_DESC='Set execute permissions for DietPi scripts' G_EXEC chmod -R +x /boot/dietpi /var/lib/dietpi/services /etc/cron.*/dietpi

# Apply MOTD live-patches
G_EXEC_DESC='Applying live-patches to fix known bugs in this DietPi version'
G_EXEC curl -sSfLO https://dietpi.com/motd
. ./motd
G_EXEC rm motd
unset -v motd
G_DIETPI-NOTIFY 2 'Storing DietPi version info:'
G_CONFIG_INJECT 'DEV_GITBRANCH=' "DEV_GITBRANCH=$G_GITBRANCH" /boot/dietpi.txt
G_CONFIG_INJECT 'DEV_GITOWNER=' "DEV_GITOWNER=$G_GITOWNER" /boot/dietpi.txt
G_VERSIONDB_SAVE
G_EXEC cp /boot/dietpi/.version /var/lib/dietpi/.dietpi_image_version

# Apply live patches
G_DIETPI-NOTIFY 2 'Applying DietPi live patches to fix known bugs in this version'
for i in "${!G_LIVE_PATCH[@]}"
do
if eval "${G_LIVE_PATCH_COND[$i]}"
then
G_DIETPI-NOTIFY 2 "Applying live patch $i"
eval "${G_LIVE_PATCH[@]}"
G_LIVE_PATCH_STATUS[$i]='applied'
else
G_LIVE_PATCH_STATUS[$i]='not applicable'
fi

# Store new status of live patch to /boot/dietpi/.version
G_CONFIG_INJECT "G_LIVE_PATCH_STATUS\[$i\]=" "G_LIVE_PATCH_STATUS[$i]='${G_LIVE_PATCH_STATUS[$i]}'" /boot/dietpi/.version.version
done

G_EXEC systemctl daemon-reload

Expand Down Expand Up @@ -1751,14 +1767,13 @@ _EOF_
G_DIETPI-NOTIFY 2 'Resetting DietPi auto-generated settings and flag files'
rm -v /boot/dietpi/.??*

G_EXEC cp /var/lib/dietpi/.dietpi_image_version /boot/dietpi/.version

G_DIETPI-NOTIFY 2 'Set init .install_stage to -1 (first boot)'
echo -1 > /boot/dietpi/.install_stage

G_DIETPI-NOTIFY 2 'Writing PREP information to file'
cat << _EOF_ > /boot/dietpi/.prep_info
$IMAGE_CREATOR
$PREIMAGE_INFO
_EOF_
echo -e "$IMAGE_CREATOR\n$PREIMAGE_INFO" > /boot/dietpi/.prep_info

G_DIETPI-NOTIFY 2 'Generating GPLv2 license readme'
cat << _EOF_ > /var/lib/dietpi/license.txt
Expand All @@ -1782,12 +1797,6 @@ _EOF_
G_EXEC_DESC='Enabling automated partition and file system resize for first boot' G_EXEC systemctl enable dietpi-fs_partition_resize
G_EXEC_DESC='Enabling first boot installation process' G_EXEC systemctl enable dietpi-firstboot

G_DIETPI-NOTIFY 2 'Storing DietPi version info:'
G_CONFIG_INJECT 'DEV_GITBRANCH=' "DEV_GITBRANCH=$G_GITBRANCH" /boot/dietpi.txt
G_CONFIG_INJECT 'DEV_GITOWNER=' "DEV_GITOWNER=$G_GITOWNER" /boot/dietpi.txt
G_VERSIONDB_SAVE
G_EXEC cp /boot/dietpi/.version /var/lib/dietpi/.dietpi_image_version

G_DIETPI-NOTIFY 2 'Clearing lost+found'
rm -Rfv /lost+found/{,.??,.[^.]}*

Expand Down
Loading

0 comments on commit e66ca7b

Please sign in to comment.