2020-01-29 21:54:53 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2020-01-30 13:36:45 +00:00
|
|
|
if [ ! "@SUNSHINE_UNDEFINED_VARIABLE@" = "" ]; then
|
|
|
|
echo "Please run gen-deb generated by cmake inside the build directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-01-29 21:54:53 +00:00
|
|
|
if [ -d package-deb ]; then
|
|
|
|
echo "package-deb already exists: It will be replaced"
|
|
|
|
rm -rf package-deb
|
|
|
|
fi
|
|
|
|
|
2021-07-03 16:13:05 +00:00
|
|
|
export DEBIAN=@CMAKE_CURRENT_BINARY_DIR@/package-deb/sunshine/DEBIAN
|
|
|
|
export RULES=@CMAKE_CURRENT_BINARY_DIR@/package-deb/sunshine/etc/udev/rules.d
|
|
|
|
export BIN=@CMAKE_CURRENT_BINARY_DIR@/package-deb/sunshine/usr/bin
|
|
|
|
export SERVICE=@CMAKE_CURRENT_BINARY_DIR@/package-deb/sunshine/usr/lib/systemd/user
|
|
|
|
export ASSETS=@CMAKE_CURRENT_BINARY_DIR@/package-deb/sunshine/etc/sunshine
|
2020-01-29 21:54:53 +00:00
|
|
|
|
|
|
|
mkdir -p $DEBIAN
|
|
|
|
mkdir -p $RULES
|
|
|
|
mkdir -p $BIN
|
2021-07-03 16:13:05 +00:00
|
|
|
mkdir -p $ASSETS/shaders
|
|
|
|
mkdir -p $SERVICE
|
2020-01-29 21:54:53 +00:00
|
|
|
|
|
|
|
if [ ! -f sunshine ]; then
|
|
|
|
echo "Error: Can't find sunshine"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cat << 'EOF' > $DEBIAN/conffiles
|
|
|
|
/etc/sunshine/sunshine.conf
|
|
|
|
/etc/sunshine/apps_linux.json
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat << 'EOF' > $DEBIAN/control
|
|
|
|
Package: sunshine
|
|
|
|
Architecture: amd64
|
|
|
|
Maintainer: @loki
|
|
|
|
Priority: optional
|
2021-08-21 18:28:14 +00:00
|
|
|
Version: 0.10.2
|
2021-09-04 23:30:55 +00:00
|
|
|
Depends: libssl1.1, libavdevice58, libboost-thread1.67.0 | libboost-thread1.71.0, libboost-filesystem1.67.0 | libboost-filesystem1.71.0, libboost-log1.67.0 | libboost-log1.71.0, libpulse0, libopus0, libxcb-shm0, libxcb-xfixes0, libxtst6, libevdev2, libdrm2, libcap2
|
2020-01-29 21:54:53 +00:00
|
|
|
Description: Gamestream host for Moonlight
|
|
|
|
EOF
|
|
|
|
|
2021-07-22 19:14:36 +00:00
|
|
|
cat << 'EOF' > $DEBIAN/preinst
|
|
|
|
#Store backup for old config files to prevent it from being overwritten
|
|
|
|
if [ -f /etc/sunshine/sunshine.conf ]; then
|
|
|
|
cp /etc/sunshine/sunshine.conf /etc/sunshine/sunshine.conf.old
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f /etc/sunshine/apps_linux.json ]; then
|
|
|
|
cp /etc/sunshine/apps_linux.json /etc/sunshine/apps_linux.json.old
|
|
|
|
fi
|
|
|
|
EOF
|
|
|
|
|
2020-01-29 21:54:53 +00:00
|
|
|
cat << 'EOF' > $DEBIAN/postinst
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
export GROUP_INPUT=input
|
|
|
|
|
|
|
|
if [ -f /etc/group ]; then
|
|
|
|
if ! grep -q $GROUP_INPUT /etc/group; then
|
|
|
|
echo "Creating group $GROUP_INPUT"
|
|
|
|
|
|
|
|
groupadd $GROUP_INPUT
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Warning: /etc/group not found"
|
|
|
|
fi
|
2021-06-16 14:06:36 +00:00
|
|
|
|
2021-07-22 19:14:36 +00:00
|
|
|
if [ -f /etc/sunshine/sunshine.conf.old ]; then
|
|
|
|
echo "Restoring old sunshine.conf"
|
|
|
|
mv /etc/sunshine/sunshine.conf.old /etc/sunshine/sunshine.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f /etc/sunshine/apps_linux.json.old ]; then
|
|
|
|
echo "Restoring old apps_linux.json"
|
|
|
|
mv /etc/sunshine/apps_linux.json.old /etc/sunshine/apps_linux.json
|
|
|
|
fi
|
|
|
|
|
2021-06-16 14:06:36 +00:00
|
|
|
# Update permissions on config files for Web Manager
|
|
|
|
if [ -f /etc/sunshine/apps_linux.json ]; then
|
|
|
|
echo "chmod 666 /etc/sunshine/apps_linux.json"
|
|
|
|
chmod 666 /etc/sunshine/apps_linux.json
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f /etc/sunshine/sunshine.conf ]; then
|
|
|
|
echo "chmod 666 /etc/sunshine/sunshine.conf"
|
|
|
|
chmod 666 /etc/sunshine/sunshine.conf
|
|
|
|
fi
|
2021-08-19 20:16:02 +00:00
|
|
|
|
2021-08-20 20:21:13 +00:00
|
|
|
# Ensure Sunshine can grab images from KMS
|
|
|
|
path_to_setcap=$(which setcap)
|
|
|
|
if [ -x "$path_to_setcap" ] ; then
|
2021-09-04 09:45:57 +00:00
|
|
|
echo "$path_to_setcap cap_sys_admin+p /usr/bin/sunshine"
|
|
|
|
$path_to_setcap cap_sys_admin+p /usr/bin/sunshine
|
2021-08-20 20:21:13 +00:00
|
|
|
fi
|
2020-01-29 21:54:53 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
cat << 'EOF' > $RULES/85-sunshine-rules.rules
|
|
|
|
KERNEL=="uinput", GROUP="input", MODE="0660"
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cp sunshine $BIN/sunshine
|
|
|
|
cp @CMAKE_CURRENT_SOURCE_DIR@/assets/apps_linux.json $ASSETS/apps_linux.json
|
|
|
|
cp @CMAKE_CURRENT_SOURCE_DIR@/assets/sunshine.conf $ASSETS/sunshine.conf
|
2021-07-03 16:13:05 +00:00
|
|
|
cp @CMAKE_CURRENT_BINARY_DIR@/sunshine.service $SERVICE/sunshine.service
|
2021-06-15 19:56:32 +00:00
|
|
|
cp -r @CMAKE_CURRENT_SOURCE_DIR@/assets/web $ASSETS/web
|
|
|
|
cp -r @CMAKE_CURRENT_SOURCE_DIR@/assets/shaders/opengl $ASSETS/shaders/opengl
|
2020-01-29 21:54:53 +00:00
|
|
|
|
|
|
|
chmod 755 $DEBIAN/postinst
|
2021-07-22 19:14:36 +00:00
|
|
|
chmod 755 $DEBIAN/preinst
|
2020-01-29 21:54:53 +00:00
|
|
|
chmod 755 $BIN/sunshine
|
|
|
|
chmod 644 $RULES/85-sunshine-rules.rules
|
2021-06-16 14:06:36 +00:00
|
|
|
chmod 666 $ASSETS/apps_linux.json
|
|
|
|
chmod 666 $ASSETS/sunshine.conf
|
2020-01-29 21:54:53 +00:00
|
|
|
|
|
|
|
cd package-deb
|
|
|
|
if fakeroot dpkg-deb --build sunshine; then
|
|
|
|
echo "generated debian package: @CMAKE_CURRENT_BINARY_DIR@/package-deb/sunshine.deb"
|
|
|
|
fi
|
|
|
|
cd ..
|
|
|
|
|