Skip to content

Commit

Permalink
v9.6
Browse files Browse the repository at this point in the history
- General | Since we provide all kernel, bootloader and firmware packages from our own APT repository now, the Armbian APT repository is removed form all systems. In case you use an SBC which is not officially supported by DietPi, as generic device, it is however preserved.
  • Loading branch information
MichaIng committed Jun 21, 2024
1 parent 7982c24 commit 3815d2c
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 80 deletions.
16 changes: 8 additions & 8 deletions .build/images/dietpi-build
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ PTTYPE='msdos'
FSTYPE='ext4'
ITYPE=
VMTYPE=
GITBRANCH='master'
GITBRANCH='apt'
GITOWNER='MichaIng'
EDITION=
SUFFIX=
Expand Down Expand Up @@ -412,8 +412,8 @@ packages='apt,bash-completion,bzip2,ca-certificates,cron,curl,fdisk,gpg,htop,ipu
[[ $HW_MODEL == 75 ]] && packages+='iproute2' || packages+='console-setup,dropbear,ethtool,fake-hwclock,ifupdown,isc-dhcp-client,kmod,rfkill,systemd-timesyncd,usbutils'
# - "--skip=check/empty" to ignore /etc/fstab, boot and tmpfs mounts we added above
# - "--skip=check/qemu" to skip arch test, which requires the "arch-test" package. We however assure emulation support out end.
# - Bullseye/Jammy host mmdebstrap seems to not support "--skip=check/empty,check/qemu".
G_EXEC_OUTPUT=1 G_EXEC mmdebstrap --debug --mode=root --format=dir --skip=check/empty --skip=check/qemu --variant=minbase --include="$packages" --arch="$parch" --keyring="$keyring" "$distro" ./rootfs "$repo"
# - Bullseye/Jammy host mmdebstrap does not support "--skip=check/empty,check/qemu".
G_EXEC_OUTPUT=1 G_EXEC mmdebstrap --mode=root --format=dir --skip=check/empty --skip=check/qemu --variant=minbase --include="$packages" --arch="$parch" --keyring="$keyring" "$distro" ./rootfs "$repo"
G_EXEC umount rootfs/dev rootfs/run rootfs/var/cache/apt rootfs/var/lib/apt/lists rootfs/var/log

##########################################
Expand All @@ -431,15 +431,15 @@ _EOF_
cat << _EOF_ >> rootfs/etc/rc.local
export GITOWNER='$GITOWNER' GITBRANCH='$GITBRANCH' HW_MODEL='$HW_MODEL' IMAGE_CREATOR=0 PREIMAGE_INFO=0 WIFI_REQUIRED=1 DISTRO_TARGET=$DISTRO TEST_KERNEL=$TEST_KERNEL TEST_UBOOT=$TEST_UBOOT
echo '[ INFO ] Running DietPi-Installer for $G_GITOWNER/$G_GITBRANCH'
bash -c "\$(curl -sSf 'https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.build/images/dietpi-installer')" || poweroff
bash -c "\$(curl -sSf 'https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.build/images/dietpi-installer')" || { echo '[FAILED] DietPi-Installer failed, shutting down ...'; journalctl -n 25; df -h; free -h; poweroff; exit 1; }
_EOF_

# - VM: Generate tiny-initramfs with explicit kernel modules, as auto-detection doesn't work correctly within container and loop devices
[[ $HW_MODEL == 20 ]] && cat << _EOF_ >> rootfs/etc/rc.local
echo '[ INFO ] Rebuilding virtual machine initramfs to support all virtualizers...'
version=\$(dpkg --get-selections | mawk '\$1~/^linux-image-.*-$parch\$/{print \$1;exit}') || poweroff
version=\$(dpkg --get-selections | mawk '\$1~/^linux-image-.*-$parch\$/{print \$1;exit}') || { echo '[FAILED] Obtaining kernel version failed, shutting down ...'; journalctl -n 25; df -h; free -h; poweroff; exit 1; }
version=\${version#linux-image-}
mktirfs -m no -M no --include-modules='ahci,sd_mod,vmw_pvscsi,hv_storvsc,virtio_scsi,virtio_pci,BusLogic,$FSTYPE' -o "/boot/initrd.img-\$version" "\$version" || poweroff
mktirfs -m no -M no --include-modules='ahci,sd_mod,vmw_pvscsi,hv_storvsc,virtio_scsi,virtio_pci,BusLogic,$FSTYPE' -o "/boot/initrd.img-\$version" "\$version" || { echo '[FAILED] Generating initramfs failed, shutting down ...'; journalctl -n 25; df -h; free -h; poweroff; exit 1; }
_EOF_

cat << '_EOF_' >> rootfs/etc/rc.local
Expand All @@ -459,9 +459,9 @@ then
abind=("--bind=$FP_LOOP" '--bind=/dev/disk')
for i in "${FP_LOOP}p"*; do abind+=("--bind=$i"); done
fi
systemd-nspawn -bD rootfs "${abind[@]}" || { G_DIETPI-NOTIFY 1 'systemd-nspawn failed, aborting...'; journalctl -n 25; ss -tlpn; df -h; free -h; exit 1; }
systemd-nspawn -bD rootfs "${abind[@]}" || { G_DIETPI-NOTIFY 1 'systemd-nspawn failed, aborting ...'; journalctl -n 25; ss -tlpn; df -h; free -h; exit 1; }

[[ -f 'rootfs/success' ]] || { G_DIETPI-NOTIFY 1 'The container setup did not finish successfully, aborting...'; journalctl -n 25; ss -tlpn; df -h; free -h; exit 1; }
[[ -f 'rootfs/success' ]] || { G_DIETPI-NOTIFY 1 'The container setup did not finish successfully, aborting ...'; journalctl -n 25; ss -tlpn; df -h; free -h; exit 1; }
G_EXEC rm rootfs/success
G_EXEC rm -Rf rootfs/{dev,proc,run,sys,tmp,var/log}/{,.??,.[^.]}* # Failsafe: /var/log/journal was found despite tmpfs mount!
G_EXEC sync
Expand Down
82 changes: 38 additions & 44 deletions .build/images/dietpi-installer
Original file line number Diff line number Diff line change
Expand Up @@ -1035,8 +1035,17 @@ setenv rootuuid "true"' /boot/boot.cmd
# DietPi-Build with Armbian kernel/bootloader/firmware
elif (( $armbian_repo ))
then
# Prevent any unintended packages from being installed from Armbian's APT repository, like base-files: https://github.com/MichaIng/DietPi/issues/6227#issuecomment-1713688577
cat << '_EOF_' > /etc/apt/preferences.d/dietpi-armbian
# Remove obsolete combined keyring
[[ -f '/etc/apt/trusted.gpg' ]] && G_EXEC rm /etc/apt/trusted.gpg
[[ -f '/etc/apt/trusted.gpg~' ]] && G_EXEC rm '/etc/apt/trusted.gpg~'

# Remove obsolete lists
find /etc/apt/sources.list.d -mindepth 1 ! -name 'dietpi.list' -exec rm -Rf {} +

if [[ $G_GITBRANCH == 'master' ]]
then
# Prevent any unintended packages from being installed from Armbian's APT repository, like base-files: https://github.com/MichaIng/DietPi/issues/6227#issuecomment-1713688577
cat << '_EOF_' > /etc/apt/preferences.d/dietpi-armbian
Package: *
Pin: origin apt.armbian.com
Pin-Priority: -1
Expand All @@ -1045,29 +1054,23 @@ Package: armbian-firmware* linux-*
Pin: origin apt.armbian.com
Pin-Priority: 500
_EOF_
if dpkg --compare-versions "$(dpkg-query -Wf '${Version}' base-files)" gt 20
then
G_DIETPI-NOTIFY 2 'Enforcing downgrade of Armbian'\''s base-files package to Debian'\''s'
cat << '_EOF_' > /etc/apt/preferences.d/dietpi-armbian-tmp
if dpkg --compare-versions "$(dpkg-query -Wf '${Version}' base-files)" gt 20
then
G_DIETPI-NOTIFY 2 'Enforcing downgrade of Armbian'\''s base-files package to Debian'\''s'
cat << '_EOF_' > /etc/apt/preferences.d/dietpi-armbian-tmp
Package: base-files
Pin: release o=Debian
Pin-Priority: 1000
_EOF_
G_EXEC eval 'echo '\''APT::Get::Allow-Downgrades "1";'\'' > /etc/apt/apt.conf.d/dietpi-armbian'
fi

# Bootstrap Armbian repository
G_EXEC_RETRIES=2 G_EXEC eval 'curl -sSfL '\''https://apt.armbian.com/armbian.key'\'' | gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-armbian.gpg --yes'

# Remove obsolete combined keyring
[[ -f '/etc/apt/trusted.gpg' ]] && G_EXEC rm /etc/apt/trusted.gpg
[[ -f '/etc/apt/trusted.gpg~' ]] && G_EXEC rm '/etc/apt/trusted.gpg~'
G_EXEC eval 'echo '\''APT::Get::Allow-Downgrades "1";'\'' > /etc/apt/apt.conf.d/dietpi-armbian'
fi

# Remove obsolete lists
find /etc/apt/sources.list.d -mindepth 1 ! -name 'dietpi.list' -exec rm -Rf {} +
# Bootstrap Armbian repository
G_EXEC_RETRIES=2 G_EXEC eval 'curl -sSfL '\''https://apt.armbian.com/armbian.key'\'' | gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-armbian.gpg --yes'

# Add Armbian repository
G_EXEC eval "echo 'deb https://apt.armbian.com ${DISTRO_TARGET_NAME/bullseye/bookworm} main' > /etc/apt/sources.list.d/dietpi-armbian.list"
# Add Armbian repository
G_EXEC eval "echo 'deb https://apt.armbian.com ${DISTRO_TARGET_NAME/bullseye/bookworm} main' > /etc/apt/sources.list.d/dietpi-armbian.list"
fi

# Select kernel, device tree and U-Boot packages
local model='odroidn2' kernel='meson64' arch='arm64' branch='current' zstd=()
Expand Down Expand Up @@ -1367,14 +1370,7 @@ _EOF_
systemctl stop armbian-*

# Keep currently installed kernel and bootloader packages
local apackages=(

'linux-image-'
'linux-dtb-'
'linux-u-boot-'
)

for i in "${apackages[@]}"
for i in linux-{image,dtb,u-boot}-
do
while read -r line
do
Expand All @@ -1383,7 +1379,6 @@ _EOF_

done < <(dpkg-query -Wf '${Package}\n' | mawk -v pat="^$i" '$0~pat')
done
unset -v apackages

# Add initramfs-tools and u-boot-tools, required to convert initramfs images into u-boot format
aPACKAGES_REQUIRED_INSTALL+=('initramfs-tools' 'u-boot-tools')
Expand Down Expand Up @@ -1435,6 +1430,21 @@ _EOF_
G_EXEC rm -f /{initrd.img,vmlinuz}{,.old}
fi

if [[ -f '/boot/armbianEnv.txt' ]]
then
# Force legacy network interface names
G_CONFIG_INJECT 'extraargs=' 'extraargs=net.ifnames=0' /boot/armbianEnv.txt

# Disable bootsplash logo, as we removed the file above: https://github.com/MichaIng/DietPi/issues/3932#issuecomment-852376681
G_CONFIG_INJECT 'bootlogo=' 'bootlogo=false' /boot/armbianEnv.txt

# Reset default kernel log verbosity, reduced to "1" on most Armbian images
G_CONFIG_INJECT 'verbosity=' 'verbosity=4' /boot/armbianEnv.txt

# Disable Docker optimisations, since this has some performance drawbacks, enable on Docker install instead
G_CONFIG_INJECT 'docker_optimizations=' 'docker_optimizations=off' /boot/armbianEnv.txt
fi

# Generic kernel, device tree, bootloader and firmware package auto detect + initramfs-tools
elif (( $G_HW_MODEL != 75 ))
then
Expand Down Expand Up @@ -2180,22 +2190,6 @@ _EOF_
G_EXEC eval 'echo '\''sprdwl_ng'\'' > /etc/modules-load.d/dietpi-enable_wifi.conf'
fi

# Armbian
if [[ -f '/boot/armbianEnv.txt' ]]
then
# Force legacy network interface names
G_CONFIG_INJECT 'extraargs=' 'extraargs=net.ifnames=0' /boot/armbianEnv.txt

# Disable bootsplash logo, as we removed the file above: https://github.com/MichaIng/DietPi/issues/3932#issuecomment-852376681
G_CONFIG_INJECT 'bootlogo=' 'bootlogo=false' /boot/armbianEnv.txt

# Reset default kernel log verbosity, reduced to "1" on most Armbian images
G_CONFIG_INJECT 'verbosity=' 'verbosity=4' /boot/armbianEnv.txt

# Disable Docker optimisations, since this has some performance drawbacks, enable on Docker install instead
G_CONFIG_INJECT 'docker_optimizations=' 'docker_optimizations=off' /boot/armbianEnv.txt
fi

#------------------------------------------------------------------------------------------------
G_DIETPI-NOTIFY 3 "$G_PROGRAM_NAME" "[$SETUP_STEP] Finalise system for first boot of DietPi"; ((SETUP_STEP++))
#------------------------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dietpi-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ jobs:
urls="\"https://dietpi.com/downloads/images/testing/\""
for i in "$@"; do urls="$urls,\"https://dietpi.com/downloads/images/testing/${i##*/}\""; done
IFS=,
curl -T "{$*}" --key /root/.ssh/id_ed25519 '\''${{ secrets.UPLOAD_URL }}testing/'\''
curl -H '\''Authorization: Bearer ${{ secrets.CF_TOKEN }}'\'' -H '\''Content-Type: application/json'\'' -d "{\"files\":[$urls]}" '\''https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE }}/purge_cache'\''
#curl -T "{$*}" --key /root/.ssh/id_ed25519 '\''${{ secrets.UPLOAD_URL }}testing/'\''
#curl -H '\''Authorization: Bearer ${{ secrets.CF_TOKEN }}'\'' -H '\''Content-Type: application/json'\'' -d "{\"files\":[$urls]}" '\''https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE }}/purge_cache'\''
echo' | sudo tee upload.sh > /dev/null
sudo gpg --batch --import << _EOF_
${{ secrets.GPG_KEY }}
Expand Down
23 changes: 15 additions & 8 deletions .update/patches
Original file line number Diff line number Diff line change
Expand Up @@ -797,13 +797,6 @@ Patch_8_10()

Patch_8_11()
{
# Armbian mirror director now correctly handles HTTPS requests
if [[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' ]] && grep -q 'http://apt.armbian.com' /etc/apt/sources.list.d/dietpi-armbian.list
then
G_DIETPI-NOTIFY 2 'Connecting to apt.armbian.com via secure HTTPS since their router now handles HTTPS redirects reliably'
G_EXEC sed --follow-symlinks -i 's|http://apt.armbian.com|https://apt.armbian.com|' /etc/apt/sources.list.d/dietpi-armbian.list
fi

if (( $G_HW_MODEL == 56 ))
then
# Revert https://forum.armbian.com/topic/20133-nanopi-neo3-dtb-gone-since-linux-dtb-current-rockchip64-22021/ since dtb is available again
Expand Down Expand Up @@ -1651,8 +1644,15 @@ Patch_9_5()

Patch_9_6()
{
# Update DietPi APT list for several SBCs we added components to our repo for
if [[ $PATCH_9_3_RAN == 0 && $G_HW_MODEL =~ ^(42|43|46|47|52|55|58|68|72|73|76|77|86|87)$ ]]
then
/boot/dietpi/func/dietpi-set_software apt-mirror dietpi
G_AGUP
G_AGUG

# Orange Pi 5: Offer to flash new U-Boot image to solve random Ethernet MAC address: https://github.com/MichaIng/DietPi/issues/6663
if (( $G_HW_MODEL == 80 ))
elif (( $G_HW_MODEL == 80 ))
then
if G_WHIP_YESNO '[ INFO ] U-Boot update available to solve random Ethernet MAC address
\nIn case you are affected by a random Ethernet MAC address, which changes every boot, flashing the latest U-Boot image has shown to solve it: https://github.com/MichaIng/DietPi/issues/6663
Expand Down Expand Up @@ -1691,6 +1691,13 @@ Patch_9_6()
G_AGI zstd
fi

# Remove Armbian APT repository from all systems which have an "all" component for kernel/bootloader/firmware packages form our APT repository
if [[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' && -f '/etc/apt/sources.list.d/dietpi.list' ]] && grep -q 'dietpi.com/apt all' /etc/apt/sources.list.d/dietpi.list
then
G_DIETPI-NOTIFY 2 'Removing obsolete Armbian APT repository'
G_EXEC rm /etc/apt/sources.list.d/dietpi-armbian.list
fi

# Remove obsolete drop-in config: https://github.com/MichaIng/DietPi/issues/7104
[[ -d '/etc/systemd/system/ifup@.service.d' ]] && G_EXEC rm -R /etc/systemd/system/ifup@.service.d
}
Expand Down
7 changes: 7 additions & 0 deletions .update/pre-patches
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,13 @@ then
[[ ${apackages[0]} ]] && G_EXEC apt-mark unhold "${apackages[@]}"
unset -v apackages
fi

# Remove Armbian APT repository from all systems which have an "all" component for kernel/bootloader/firmware packages form our APT repository
if [[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' && -f '/etc/apt/sources.list.d/dietpi.list' ]] && grep -q 'dietpi.com/apt all' /etc/apt/sources.list.d/dietpi.list
then
G_DIETPI-NOTIFY 2 'Removing obsolete Armbian APT repository'
G_EXEC rm /etc/apt/sources.list.d/dietpi-armbian.list
fi
fi

exit 0
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ v9.6
(2024-07-06)

Enhancements:
- General | Since we provide all kernel, bootloader and firmware packages from our own APT repository now, the Armbian APT repository is removed form all systems. In case you use an SBC which is not officially supported by DietPi, as generic device, it is however preserved.
- Quartz64/Star64/VisionFive 2 | The extended attribute handler for ext4 security labels "CONFIG_EXT4_FS_SECURITY" has been enabled for these SBCs, required for some Docker containers. Many thanks to @gxsw for reporting this missing feature: https://github.com/MichaIng/DietPi/issues/7102
- Quartz64/Star64/VisionFive 2 | eBPF functionality for firewall and network monitoring software like Cilium has been added to our kernel builds for these SBCs. Many thanks to @kbrighton for reporting these missing features: https://github.com/MichaIng/DietPi/issues/6834
- Orange Pi 5 | Older U-Boot builds caused the Ethernet MAC address to be random and change on every boot. Recent U-Boot builds solve this, but they are not flashed automatically on package upgrades. We hence inform users and offer to flash the latest U-Boot image during the DietPi update. Many thanks to @thuehlinger for reporting and testing the case: https://github.com/MichaIng/DietPi/issues/6663
Expand Down
15 changes: 0 additions & 15 deletions dietpi/func/dietpi-globals
Original file line number Diff line number Diff line change
Expand Up @@ -1499,9 +1499,6 @@ Press any key to continue...'

G_CHECK_ROOT_USER 1

# Workaround for Armbian mirrors being out of sync regularly or throwing 5xx errors
[[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' ]] && G_EXEC_POST_FUNC(){ [[ $exit_code != 0 ]] && grep -q '^E: Failed to fetch .*armbian' "$fp_log" && G_EXEC_RETRIES=2 && unset -f G_EXEC_POST_FUNC; }

G_EXEC_DESC="\e[0mAPT install \e[33m$*\e[0m"
DEBIAN_FRONTEND=noninteractive G_EXEC_OUTPUT=1 G_EXEC_OUTPUT_COL='\e[90m' G_EXEC apt-get -y --allow-change-held-packages install "$@"
local exit_code=$?
Expand Down Expand Up @@ -1548,9 +1545,6 @@ Press any key to continue...'
{
G_CHECK_ROOT_USER 1

# Workaround for Armbian mirrors being out of sync regularly or throwing 5xx errors
[[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' ]] && G_EXEC_POST_FUNC(){ [[ $exit_code != 0 ]] && grep -q '^E: Failed to fetch .*armbian' "$fp_log" && G_EXEC_RETRIES=2 && unset -f G_EXEC_POST_FUNC; }

G_EXEC_DESC="\e[0mAPT fix${*:+ \e[33m$*\e[0m}"
DEBIAN_FRONTEND=noninteractive G_EXEC_OUTPUT=1 G_EXEC_OUTPUT_COL='\e[90m' G_EXEC apt-get -y --allow-change-held-packages -f install "$@"
local exit_code=$?
Expand All @@ -1575,9 +1569,6 @@ Press any key to continue...'
# Clean cache before every update, which can corrupt and gets fully rewritten anyway
G_EXEC_PRE_FUNC(){ apt-get clean; }

# Workaround for Armbian mirrors being out of sync regularly or throwing 5xx errors
[[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' ]] && G_EXEC_POST_FUNC(){ [[ $exit_code != 0 ]] && grep -q '^E: Failed to fetch .*armbian' "$fp_log" && G_EXEC_RETRIES=2 && unset -f G_EXEC_POST_FUNC; }

G_EXEC_DESC='\e[0mAPT update'
G_EXEC_OUTPUT=1 G_EXEC_OUTPUT_COL='\e[90m' G_EXEC apt-get -y -eany update
local exit_code=$?
Expand Down Expand Up @@ -1620,9 +1611,6 @@ Press any key to continue...'
{
G_CHECK_ROOT_USER 1

# Workaround for Armbian mirrors being out of sync regularly or throwing 5xx errors
[[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' ]] && G_EXEC_POST_FUNC(){ [[ $exit_code != 0 ]] && grep -q '^E: Failed to fetch .*armbian' "$fp_log" && G_EXEC_RETRIES=2 && unset -f G_EXEC_POST_FUNC; }

G_EXEC_DESC="\e[0mAPT upgrade${*:+ \e[33m$*\e[0m}"
DEBIAN_FRONTEND=noninteractive G_EXEC_OUTPUT=1 G_EXEC_OUTPUT_COL='\e[90m' G_EXEC apt-get -y --with-new-pkgs upgrade "$@"
local exit_code=$?
Expand All @@ -1639,9 +1627,6 @@ Press any key to continue...'
{
G_CHECK_ROOT_USER 1

# Workaround for Armbian mirrors being out of sync regularly or throwing 5xx errors
[[ -f '/etc/apt/sources.list.d/dietpi-armbian.list' ]] && G_EXEC_POST_FUNC(){ [[ $exit_code != 0 ]] && grep -q '^E: Failed to fetch .*armbian' "$fp_log" && G_EXEC_RETRIES=2 && unset -f G_EXEC_POST_FUNC; }

G_EXEC_DESC="\e[0mAPT dist-upgrade${*:+ \e[33m$*\e[0m}"
DEBIAN_FRONTEND=noninteractive G_EXEC_OUTPUT=1 G_EXEC_OUTPUT_COL='\e[90m' G_EXEC apt-get -y dist-upgrade "$@"
local exit_code=$?
Expand Down
Loading

0 comments on commit 3815d2c

Please sign in to comment.