Don't overwrite config files with debian package

This commit is contained in:
loki
2021-07-22 21:14:36 +02:00
parent 620c629bb4
commit 38915859ba
3 changed files with 26 additions and 4 deletions

View File

@ -17,13 +17,13 @@ Sunshine is a Gamestream host for Moonlight
Ubuntu 20.04: Ubuntu 20.04:
Install the following Install the following
``` ```
sudo apt install cmake libssl-dev libavdevice-dev libboost-thread-dev libboost-filesystem-dev libboost-log-dev libpulse-dev libopus-dev libxtst-dev libx11-dev libxrandr-dev libxfixes-dev libevdev-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev sudo apt install cmake gcc-10 g++-10 libssl-dev libavdevice-dev libboost-thread-dev libboost-filesystem-dev libboost-log-dev libpulse-dev libopus-dev libxtst-dev libx11-dev libxrandr-dev libxfixes-dev libevdev-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev
``` ```
### Compilation: ### Compilation:
- `git clone https://github.com/loki-47-6F-64/sunshine.git --recurse-submodules` - `git clone https://github.com/loki-47-6F-64/sunshine.git --recurse-submodules`
- `cd sunshine && mkdir build && cd build` - `cd sunshine && mkdir build && cd build`
- `cmake ..` - `cmake -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 ..`
- `make -j ${nproc}` - `make -j ${nproc}`

View File

@ -37,11 +37,22 @@ Package: sunshine
Architecture: amd64 Architecture: amd64
Maintainer: @loki Maintainer: @loki
Priority: optional Priority: optional
Version: 0.8.1 Version: 0.9.1
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 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
Description: Gamestream host for Moonlight Description: Gamestream host for Moonlight
EOF EOF
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
cat << 'EOF' > $DEBIAN/postinst cat << 'EOF' > $DEBIAN/postinst
#!/bin/sh #!/bin/sh
@ -57,6 +68,16 @@ else
echo "Warning: /etc/group not found" echo "Warning: /etc/group not found"
fi fi
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
# Update permissions on config files for Web Manager # Update permissions on config files for Web Manager
if [ -f /etc/sunshine/apps_linux.json ]; then if [ -f /etc/sunshine/apps_linux.json ]; then
echo "chmod 666 /etc/sunshine/apps_linux.json" echo "chmod 666 /etc/sunshine/apps_linux.json"
@ -81,6 +102,7 @@ cp -r @CMAKE_CURRENT_SOURCE_DIR@/assets/web $ASSETS/web
cp -r @CMAKE_CURRENT_SOURCE_DIR@/assets/shaders/opengl $ASSETS/shaders/opengl cp -r @CMAKE_CURRENT_SOURCE_DIR@/assets/shaders/opengl $ASSETS/shaders/opengl
chmod 755 $DEBIAN/postinst chmod 755 $DEBIAN/postinst
chmod 755 $DEBIAN/preinst
chmod 755 $BIN/sunshine chmod 755 $BIN/sunshine
chmod 644 $RULES/85-sunshine-rules.rules chmod 644 $RULES/85-sunshine-rules.rules
chmod 666 $ASSETS/apps_linux.json chmod 666 $ASSETS/apps_linux.json