Skip to content

Commit

Permalink
v8.18 (#6401)
Browse files Browse the repository at this point in the history
- CI | Squeezelite: Update/align workflow and add RISC-V support
  • Loading branch information
MichaIng authored May 31, 2023
1 parent 8769e0a commit 7456ef4
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 238 deletions.
2 changes: 1 addition & 1 deletion .build/software/shairport-sync/container_build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ do
esac
shift
done
[[ $DISTRO =~ ^'buster'|'bullseye'|'bookworm'$ ]] || { G_DIETPI-NOTIFY 1 "Invalid distro \"$DISTRO\" passed, aborting..."; exit 1; }
[[ $DISTRO =~ ^('buster'|'bullseye'|'bookworm')$ ]] || { G_DIETPI-NOTIFY 1 "Invalid distro \"$DISTRO\" passed, aborting..."; exit 1; }
case $ARCH in
'armv6l') image="DietPi_Container-ARMv6-${DISTRO^}" arch=1;;
'armv7l') image="DietPi_Container-ARMv7-${DISTRO^}" arch=2;;
Expand Down
12 changes: 10 additions & 2 deletions .build/software/squeezelite/build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,21 @@ DEPS_APT_VERSIONED=${DEPS_APT_VERSIONED%,}
# shellcheck disable=SC2001
grep -q 'raspbian' /etc/os-release && DEPS_APT_VERSIONED=$(sed 's/+rp[it][0-9]\+[^)]*)/)/g' <<< "$DEPS_APT_VERSIONED") || DEPS_APT_VERSIONED=$(sed 's/+b[0-9]\+)/)/g' <<< "$DEPS_APT_VERSIONED")

# - Obtain version
version="$(mawk -F\" '/MAJOR_VERSION/{print $2;exit}' squeezelite-master/squeezelite.h).$(mawk -F\" '/MINOR_VERSION/{print $2;exit}' squeezelite-master/squeezelite.h)-$(mawk -F\" '/MICRO_VERSION/{print $2;exit}' squeezelite-master/squeezelite.h)"
G_EXEC curl -sSfo package.deb "https://dietpi.com/downloads/binaries/$G_DISTRO_NAME/squeezelite_$G_HW_ARCH_NAME.deb"
old_version=$(dpkg-deb -f package.deb Version)
G_EXEC rm package.deb
suffix=${old_version#*-dietpi}
[[ $old_version == "$version-"* ]] && suffix="dietpi$((suffix+1))" || suffix="dietpi1"

# - control
cat << _EOF_ > "$DIR/DEBIAN/control"
Package: squeezelite
Version: $(mawk -F\" '/MAJOR_VERSION/{print $2;exit}' squeezelite-master/squeezelite.h).$(mawk -F\" '/MINOR_VERSION/{print $2;exit}' squeezelite-master/squeezelite.h)-$(mawk -F\" '/MICRO_VERSION/{print $2;exit}' squeezelite-master/squeezelite.h)-dietpi1
Version: $version-$suffix
Architecture: $(dpkg --print-architecture)
Maintainer: MichaIng <[email protected]>
Date: $(date '+%a, %d %b %Y %T %z')
Date: $(date -u '+%a, %d %b %Y %T %z')
Standards-Version: 4.6.2.0
Installed-Size: $(du -sk "$DIR" | mawk '{print $1}')
Depends:$DEPS_APT_VERSIONED
Expand Down
25 changes: 10 additions & 15 deletions .build/software/squeezelite/container_build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,21 @@ do
esac
shift
done
case $DISTRO in
5) distro='buster';;
6) distro='bullseye';;
7) distro='bookworm';;
*) G_DIETPI-NOTIFY 1 "Invalid distro \"$DISTRO\" passed, aborting..."; exit 1;;
esac
[[ $DISTRO =~ ^('buster'|'bullseye'|'bookworm')$ ]] || { G_DIETPI-NOTIFY 1 "Invalid distro \"$DISTRO\" passed, aborting..."; exit 1; }
case $ARCH in
1) image="DietPi_Container-ARMv6-${distro^}" arch='armv6l';;
2) image="DietPi_Container-ARMv7-${distro^}" arch='armv7l';;
3) image="DietPi_Container-ARMv8-${distro^}" arch='aarch64';;
10) image="DietPi_Container-x86_64-${distro^}" arch='x86_64';;
11) image='DietPi_Container-RISC-V-Sid' arch='riscv64';;
'armv6l') image="DietPi_Container-ARMv6-${DISTRO^}" arch=1;;
'armv7l') image="DietPi_Container-ARMv7-${DISTRO^}" arch=2;;
'aarch64') image="DietPi_Container-ARMv8-${DISTRO^}" arch=3;;
'x86_64') image="DietPi_Container-x86_64-${DISTRO^}" arch=10;;
'riscv64') image='DietPi_Container-RISC-V-Sid' arch=11;;
*) G_DIETPI-NOTIFY 1 "Invalid architecture \"$ARCH\" passed, aborting..."; exit 1;;
esac

##########################################
# Dependencies
##########################################
apackages=('7zip' 'parted' 'fdisk' 'systemd-container')
(( $G_HW_ARCH == $ARCH || ( $G_HW_ARCH < 10 && $G_HW_ARCH > $ARCH ) )) || apackages+=('qemu-user-static' 'binfmt-support')
(( $G_HW_ARCH == $arch || ( $G_HW_ARCH < 10 && $G_HW_ARCH > $arch ) )) || apackages+=('qemu-user-static' 'binfmt-support')
G_AG_CHECK_INSTALL_PREREQ "${apackages[@]}"

##########################################
Expand Down Expand Up @@ -92,7 +87,7 @@ G_EXEC mount "${FP_LOOP}p1" rootfs
G_CONFIG_INJECT 'AUTO_SETUP_AUTOMATED=' 'AUTO_SETUP_AUTOMATED=1' rootfs/boot/dietpi.txt

# Force ARMv6 arch on Raspbian
(( $ARCH == 1 )) && echo 'sed -i -e '\''/^G_HW_ARCH=/c\G_HW_ARCH=1'\'' -e '\''/^G_HW_ARCH_NAME=/c\G_HW_ARCH_NAME=armv6l'\'' /boot/dietpi/.hw_model' > rootfs/boot/Automation_Custom_PreScript.sh
(( $arch == 1 )) && echo 'sed -i -e '\''/^G_HW_ARCH=/c\G_HW_ARCH=1'\'' -e '\''/^G_HW_ARCH_NAME=/c\G_HW_ARCH_NAME=armv6l'\'' /boot/dietpi/.hw_model' > rootfs/boot/Automation_Custom_PreScript.sh

# Avoid DietPi-Survey uploads to not mess with the statistics
G_EXEC rm rootfs/root/.ssh/known_hosts
Expand All @@ -109,13 +104,13 @@ cat << _EOF_ > rootfs/boot/Automation_Custom_Script.sh || exit 1
#!/bin/dash
echo '[ INFO ] Running Squeezelite build script...'
bash -c "\$(curl -sSf 'https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.build/software/squeezelite/build.bash')"
mv -v '/tmp/squeezelite_$arch.deb' /
mv -v '/tmp/squeezelite_$ARCH.deb' /
poweroff
_EOF_

##########################################
# Boot container
##########################################
systemd-nspawn -bD rootfs
[[ -f rootfs/squeezelite_$arch.deb ]] || exit 1
[[ -f rootfs/squeezelite_$ARCH.deb ]] || exit 1
}
Loading

0 comments on commit 7456ef4

Please sign in to comment.