#############################################################This is the begining of the script!###############################################
#This script is made to install and configure xrdp and to have sound over xrdp on Debian 13 - trixie
#Most of the scripts and lines belongs to: https://github.com/neutrinolabs/pulse...
#https://github.com/lnee94/pulseaudio-... and https://www.c-nergy.be
#
#next lines are used for debian 13 - trixie in order to deactivate 'suspend' | added by - itadmintech - / @itadmintech
sudo sed -i 's/# sleep-inactive-ac-timeout=1200/sleep-inactive-ac-timeout=0/g' /etc/gdm3/greeter.dconf-defaults
sudo sed -i 's/# sleep-inactive-ac-type='\''suspend'\''/sleep-inactive-ac-type='\''nothing'\''/g' /etc/gdm3/greeter.dconf-defaults
#next lines are used in order to install xrdp | and are added by - itadmintech - / @itadmintech
sudo apt install xrdp -y
sudo adduser xrdp ssl-cert
sudo systemctl enable xrdp
#next scripts are used from official neutrionlabs https://github.com/neutrinolabs/pulse...
#although the .deb file is from a 3rd party which is not affiliated to the project https://github.com/lnee94/pulseaudio-...
cd ~/Downloads
wget https://github.com/lnee94/pulseaudio-...
sudo dpkg -i pulseaudio-headers-xrdb.deb
sudo apt install build-essential dpkg-dev libpulse-dev git autoconf libtool libltdl-dev -y
cd ~
git clone https://github.com/neutrinolabs/pulse...
cd pulseaudio-module-xrdp
#the next 2 lines to modify "install_pulseaudio_sources_apt.sh" are added by - itadmintech - / @itadmintech
sed -i 's/Debian-12/Debian-13/g' scripts/install_pulseaudio_sources_apt.sh
sed -i 's/bookworm/trixie/g' scripts/install_pulseaudio_sources_apt.sh
scripts/install_pulseaudio_sources_apt_wrapper.sh
./bootstrap && ./configure PULSE_DIR=$HOME/pulseaudio.src
make
sudo make install
#the script from below belongs to "https://www.c-nergy.be"
cd ~/Downloads
wget https://www.c-nergy.be/downloads/xRDP...
unzip xrdp-installer-1.5.4.zip
chmod +x xrdp-installer-1.5.4.sh
./xrdp-installer-1.5.4.sh -s
rm ~/Downloads/xrdp-installer-1.5.4.zip
rm ~/Downloads/xrdp-installer-1.5.4.sh
rm ~/Downloads/pulseaudio-headers-xrdb.deb
rm ~/pulseaudio.src -r
rm ~/pulseaudio-module-xrdp -f -r
###############################################################This is the end of the script!##################################################