-
-
Notifications
You must be signed in to change notification settings - Fork 499
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- GMediaRender | Updated to version 0.0.9 and aligned service name with Debian and upstream service and executable name. The update can be applied via reinstall: dietpi-software reinstall 163 - CI | Fix vaultwarden builds on emulated aarch64: rust-lang/cargo#10583 - Other minor updates to new software packages
- Loading branch information
Showing
11 changed files
with
621 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
#!/bin/bash | ||
{ | ||
. /boot/dietpi/func/dietpi-globals | ||
|
||
G_AGUP | ||
G_AGDUG | ||
|
||
# Build deps | ||
G_AGI automake pkg-config gcc libc6-dev make libgstreamer1.0-dev libupnp-dev gstreamer1.0-alsa gstreamer1.0-libav gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly | ||
|
||
# Download | ||
version='0.0.9' # https://github.com/hzeller/gmrender-resurrect/releases | ||
G_DIETPI-NOTIFY 2 "Downloading GMediaRender version \e[33m$version" | ||
G_EXEC cd /tmp | ||
G_EXEC curl -sSfLO "https://github.com/hzeller/gmrender-resurrect/archive/v$version.tar.gz" | ||
[[ -d gmrender-resurrect-$version ]] && G_EXEC rm -R "gmrender-resurrect-$version" | ||
G_EXEC tar xf "v$version.tar.gz" | ||
G_EXEC rm "v$version.tar.gz" | ||
|
||
# Build | ||
G_DIETPI-NOTIFY 2 'Compiling GMediaRender' | ||
G_EXEC cd "gmrender-resurrect-$version" | ||
G_EXEC_OUTPUT=1 G_EXEC ./autogen.sh | ||
CFLAGS='-g0 -O3' G_EXEC_OUTPUT=1 G_EXEC ./configure --prefix='/usr' | ||
G_EXEC_OUTPUT=1 G_EXEC make | ||
G_EXEC strip --remove-section=.comment --remove-section=.note src/gmediarender | ||
|
||
# Preparing DEB package | ||
G_DIETPI-NOTIFY 2 'Building GMediaRender DEB package' | ||
G_EXEC cd /tmp | ||
grep -q 'raspbian' /etc/os-release && DIR='gmediarender_armv6l' || DIR="gmediarender_$G_HW_ARCH_NAME" | ||
[[ -d $DIR ]] && G_EXEC rm -R "$DIR" | ||
G_EXEC mkdir -p "$DIR/"{DEBIAN,usr/{bin,share/{,doc/}gmediarender},lib/systemd/system,etc/default} | ||
|
||
# Binary | ||
G_EXEC mv "gmrender-resurrect-$version/src/gmediarender" "$DIR/usr/bin/" | ||
|
||
# Copyright | ||
G_EXEC cp "gmrender-resurrect-$version/COPYING" "$DIR/usr/share/doc/gmediarender/copyright" | ||
|
||
# Cleanup | ||
G_EXEC rm -R "gmrender-resurrect-$version" | ||
|
||
# Icons | ||
> "$DIR/usr/share/gmediarender/grender-64x64.png" | ||
> "$DIR/usr/share/gmediarender/grender-128x128.png" | ||
|
||
# systemd service | ||
cat << '_EOF_' > "$DIR/lib/systemd/system/gmediarender.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 | ||
[Service] | ||
User=gmediarender | ||
EnvironmentFile=/etc/default/gmediarender | ||
ExecStart=/usr/bin/gmediarender $ARGS | ||
[Install] | ||
WantedBy=multi-user.target | ||
_EOF_ | ||
|
||
# Environment file | ||
cat << '_EOF_' > "$DIR/etc/default/gmediarender" | ||
# GMediaRender command-line arguments: https://github.com/hzeller/gmrender-resurrect/blob/master/INSTALL.md#commandline-options | ||
ARGS='-u UUID -f HOSTNAME -I eth0 --gstout-audiosink=alsasink --gstout-audiodevice=default --logfile=stdout' | ||
_EOF_ | ||
|
||
# postinst | ||
cat << '_EOF_' > "$DIR/DEBIAN/postinst" | ||
#!/bin/bash | ||
if [[ -d '/run/systemd/system' ]] | ||
then | ||
if [[ -f '/etc/default/gmediarender' ]] && grep -q '\-u UUID -f HOSTNAME -I eth0' /etc/default/gmediarender | ||
then | ||
echo 'Setting up environment file /etc/default/gmediarender ...' | ||
[[ ! -f '/boot/dietpi/.hw_model' ]] || . /boot/dietpi/.hw_model | ||
UUID=${G_HW_UUID:-$(</proc/sys/kernel/random/uuid)} | ||
INTERFACE=$(ip r l 0/0 | awk '{print $5;exit}') | ||
[[ $INTERFACE ]] || INTERFACE=$(ip -br a | awk '$2=="UP"{print $1;exit}') | ||
[[ $INTERFACE ]] || exit 1 | ||
sed -i "s/-u UUID -f HOSTNAME -I eth0/-u $UUID -f $HOSTNAME -I $INTERFACE/" /etc/default/gmediarender | ||
fi | ||
if getent passwd gmediarender > /dev/null | ||
then | ||
echo 'Configuring GMediaRender service user ...' | ||
usermod -aG audio -d /nonexistent -s /usr/sbin/nologin gmediarender | ||
else | ||
echo 'Creating GMediaRender service user ...' | ||
useradd -rMU -G audio -d /nonexistent -s /usr/sbin/nologin gmediarender | ||
fi | ||
echo 'Configuring GMediaRender systemd service ...' | ||
systemctl unmask gmediarender | ||
systemctl enable --now gmediarender | ||
fi | ||
_EOF_ | ||
|
||
# prerm | ||
cat << '_EOF_' > "$DIR/DEBIAN/prerm" | ||
#!/bin/sh | ||
if [ "$1" = 'remove' ] && [ -d '/run/systemd/system' ] && [ -f '/lib/systemd/system/gmediarender.service' ] | ||
then | ||
echo 'Deconfiguring GMediaRender systemd service ...' | ||
systemctl unmask gmediarender | ||
systemctl disable --now gmediarender | ||
fi | ||
_EOF_ | ||
|
||
# postrm | ||
cat << '_EOF_' > "$DIR/DEBIAN/postrm" | ||
#!/bin/sh | ||
if [ "$1" = 'purge' ] | ||
then | ||
if [ -d '/etc/systemd/system/gmediarender.service.d' ] | ||
then | ||
echo 'Removing GMediaRender systemd service overrides ...' | ||
rm -Rv /etc/systemd/system/gmediarender.service.d | ||
fi | ||
if getent passwd gmediarender > /dev/null | ||
then | ||
echo 'Removing GMediaRender service user ...' | ||
userdel gmediarender | ||
fi | ||
if getent group gmediarender > /dev/null | ||
then | ||
echo 'Removing GMediaRender service group ...' | ||
groupdel gmediarender | ||
fi | ||
fi | ||
_EOF_ | ||
G_EXEC chmod +x "$DIR/DEBIAN/"{postinst,prerm,postrm} | ||
|
||
# conffiles | ||
echo '/etc/default/gmediarender' > "$DIR/DEBIAN/conffiles" | ||
|
||
# md5sums | ||
find "$DIR" ! \( -path "$DIR/DEBIAN" -prune \) -type f -exec md5sum {} + | sed "s|$DIR/||" > "$DIR/DEBIAN/md5sums" | ||
|
||
# Add dependencies | ||
adeps=('libc6' 'gstreamer1.0-alsa' 'gstreamer1.0-libav' 'gstreamer1.0-plugins-good' 'gstreamer1.0-plugins-bad' 'gstreamer1.0-plugins-ugly' 'libupnp13') | ||
DEPS_APT_VERSIONED= | ||
for i in "${adeps[@]}" | ||
do | ||
DEPS_APT_VERSIONED+=" $i (>= $(dpkg-query -Wf '${VERSION}' "$i"))," | ||
done | ||
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") | ||
|
||
# control | ||
cat << _EOF_ > "$DIR/DEBIAN/control" | ||
Package: gmediarender | ||
Version: $version-dietpi1 | ||
Architecture: $(dpkg --print-architecture) | ||
Maintainer: MichaIng <micha@dietpi.com> | ||
Date: $(date -u '+%a, %d %b %Y %T %z') | ||
Standards-Version: 4.6.1.1 | ||
Installed-Size: $(du -sk "$DIR" | mawk '{print $1}') | ||
Depends:$DEPS_APT_VERSIONED | ||
Section: sound | ||
Priority: optional | ||
Homepage: https://github.com/hzeller/gmrender-resurrect | ||
Vcs-Git: https://github.com/hzeller/gmrender-resurrect.git | ||
Vcs-Browser: https://github.com/hzeller/gmrender-resurrect | ||
Description: Minimalist UPNP AV renderer | ||
gmrender-resurrect is a minimalist UPNP AV renderer that can be used to | ||
play music controlled by a UPNP AV control point. This package contains | ||
only a renderer and will therefore require these things to be installed | ||
either on this device or another device on the local network in order to | ||
be usable. gmrender-resurrect usese GStreamer to provide the | ||
infrastructure for playing music. | ||
_EOF_ | ||
G_CONFIG_INJECT 'Installed-Size: ' "Installed-Size: $(du -sk "$DIR" | mawk '{print $1}')" "$DIR/DEBIAN/control" | ||
|
||
# Build DEB package | ||
[[ -f $DIR.deb ]] && G_EXEC rm -R "$DIR.deb" | ||
G_EXEC_OUTPUT=1 G_EXEC dpkg-deb -b "$DIR" | ||
G_EXEC rm -R "$DIR" | ||
|
||
exit 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
#!/bin/bash | ||
# Created by MichaIng / micha@dietpi.com / dietpi.com | ||
{ | ||
########################################## | ||
# Load DietPi-Globals | ||
########################################## | ||
if [[ -f '/boot/dietpi/func/dietpi-globals' ]] | ||
then | ||
. /boot/dietpi/func/dietpi-globals | ||
else | ||
curl -sSf "https://raw.githubusercontent.com/${G_GITOWNER:=MichaIng}/DietPi/${G_GITBRANCH:=master}/dietpi/func/dietpi-globals" -o /tmp/dietpi-globals || exit 1 | ||
# shellcheck disable=SC1091 | ||
. /tmp/dietpi-globals | ||
G_EXEC_NOHALT=1 G_EXEC rm /tmp/dietpi-globals | ||
export G_GITOWNER G_GITBRANCH G_HW_ARCH_NAME=$(uname -m) | ||
fi | ||
case $G_HW_ARCH_NAME in | ||
'armv6l') export G_HW_ARCH=1;; | ||
'armv7l') export G_HW_ARCH=2;; | ||
'aarch64') export G_HW_ARCH=3;; | ||
'x86_64') export G_HW_ARCH=10;; | ||
*) G_DIETPI-NOTIFY 1 "Unsupported host system architecture \"$G_HW_ARCH_NAME\" detected, aborting..."; exit 1;; | ||
esac | ||
readonly G_PROGRAM_NAME='DietPi-GMediaRender_container_setup' | ||
G_CHECK_ROOT_USER | ||
G_CHECK_ROOTFS_RW | ||
readonly FP_ORIGIN=$PWD # Store origin dir | ||
G_INIT | ||
G_EXEC cd "$FP_ORIGIN" # Process everything in origin dir instead of /tmp/$G_PROGRAM_NAME | ||
|
||
########################################## | ||
# Process inputs | ||
########################################## | ||
DISTRO= | ||
ARCH= | ||
while (( $# )) | ||
do | ||
case $1 in | ||
'-d') shift; DISTRO=$1;; | ||
'-a') shift; ARCH=$1;; | ||
*) G_DIETPI-NOTIFY 1 "Invalid input \"$1\", aborting..."; exit 1;; | ||
esac | ||
shift | ||
done | ||
distro= | ||
case $DISTRO in | ||
5) distro='buster';; | ||
6) distro='bullseye';; | ||
7) distro='bookworm';; | ||
*) G_DIETPI-NOTIFY 1 "Invalid distro \"$DISTRO\" passed, aborting..."; exit 1;; | ||
esac | ||
image= | ||
arch= | ||
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';; | ||
*) 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_AG_CHECK_INSTALL_PREREQ "${apackages[@]}" | ||
|
||
########################################## | ||
# Prepare container | ||
########################################## | ||
# Download | ||
G_EXEC curl -sSfO "https://dietpi.com/downloads/images/$image.7z" | ||
G_EXEC 7zz e "$image.7z" "$image.img" | ||
G_EXEC rm "$image.7z" | ||
G_EXEC truncate -s $((2*1024**3)) "$image.img" | ||
|
||
# Loop device | ||
FP_LOOP=$(losetup -f) | ||
G_EXEC losetup "$FP_LOOP" "$image.img" | ||
G_EXEC partprobe "$FP_LOOP" | ||
G_EXEC partx -u "$FP_LOOP" | ||
G_EXEC_OUTPUT=1 G_EXEC e2fsck -fp "${FP_LOOP}p1" | ||
G_EXEC_OUTPUT=1 G_EXEC eval "sfdisk -fN1 '$FP_LOOP' <<< ',+'" | ||
G_EXEC partprobe "$FP_LOOP" | ||
G_EXEC partx -u "$FP_LOOP" | ||
G_EXEC_OUTPUT=1 G_EXEC resize2fs "${FP_LOOP}p1" | ||
G_EXEC_OUTPUT=1 G_EXEC e2fsck -fp "${FP_LOOP}p1" | ||
G_EXEC mkdir rootfs | ||
G_EXEC mount "${FP_LOOP}p1" rootfs | ||
|
||
# Automated build | ||
cat << _EOF_ > rootfs/etc/rc.local || exit 1 | ||
#!/bin/dash | ||
infocmp "\$TERM" > /dev/null 2>&1 || TERM='dumb' | ||
if grep -q 'raspbian' /etc/os-release | ||
then | ||
sed -i '/^G_HW_ARCH=/c\G_HW_ARCH=1' /boot/dietpi/.hw_model | ||
sed -i '/^G_HW_ARCH_NAME=/c\G_HW_ARCH_NAME=armv6l' /boot/dietpi/.hw_model | ||
fi | ||
echo '[ INFO ] Running GMediaRender build script...' | ||
bash -c "\$(curl -sSf 'https://raw.githubusercontent.com/$G_GITOWNER/DietPi/$G_GITBRANCH/.build/software/gmediarender/build.bash')" | ||
mv -v '/tmp/gmediarender_$arch.deb' '/gmediarender_$arch.deb' | ||
poweroff | ||
_EOF_ | ||
G_EXEC chmod +x rootfs/etc/rc.local | ||
|
||
# Assure that build starts after DietPi-PostBoot | ||
[[ -d 'rootfs/etc/systemd/system/rc-local.service.d' ]] || G_EXEC mkdir rootfs/etc/systemd/system/rc-local.service.d | ||
G_EXEC eval 'echo -e '\''[Unit]\nAfter=dietpi-postboot.service'\'' > rootfs/etc/systemd/system/rc-local.service.d/dietpi.conf' | ||
|
||
########################################## | ||
# Boot container | ||
########################################## | ||
systemd-nspawn -bD rootfs --bind="$FP_LOOP"{,p1} --bind=/dev/disk | ||
[[ -f rootfs/gmediarender_$arch.deb ]] || exit 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.