#!/bin/bash
echo "[-----------------------------------------------------------------------------]"
echo "[-----------------------------------------------------------------------------]"
echo -e "[-----------------] \033[32m>>> ПРОВЕРКА ЗАВИСИМОСТЕЙ <<<\033[0m [-----------------]"
echo "[-----------------------------------------------------------------------------]"
echo "[-----------------------------------------------------------------------------]"
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y software-properties-common curl wget gnupg2 unzip
sudo add-apt-repository multiverse
sudo apt update
sudo apt install -y \
libgcc1 libc6:i386 libstdc++6:i386 libbz2-dev:i386 lib32gcc-s1 libgl1:i386 libgl1-mesa-dri:i386 libgl1-mesa-glx:i386 libgl1-mesa-dri:i386 libgtk2.0-0:i386 \
libpulse0:i386 libx11-6:i386 libxext6:i386 libxrandr2:i386 libxss1:i386 libxi6:i386 libxinerama1:i386 libxcursor1:i386 libavformat58:i386 \
libfreetype6:i386 libasound2:i386 libudev1:i386 libdbus-1-3:i386 libsdl2-2.0-0:i386 libcurl4-gnutls-dev:i386 libcurl4:i386 \
libjpeg8:i386 libfontconfig1:i386 libxcomposite1:i386 libxdamage1:i386 libxfixes3:i386 \
libsm6:i386 libxtst6:i386 libpciaccess0:i386 libcap2:i386 libglib2.0-0:i386 libgbm1:i386 libegl1:i386 \
libdrm2:i386 libpng16-16:i386 libexpat1:i386 libavresample-dev:i386 libswscale-dev:i386
sudo apt install -y \
libc6 libstdc++6 libbz2-dev libgcc1 libgl1-mesa-glx libgl1-mesa-dri libnode-dev libgtk2.0-0 \
libpulse0 libx11-6 libxext6 libxrandr2 libxss1 libxi6 libxinerama1 libxcursor1 libavformat58 \
libfreetype6 libasound2 libudev1 libdbus-1-3 libsdl2-2.0-0 libcurl4-gnutls-dev libcurl4 \
libjpeg8 libfontconfig1 libxcomposite1 libxdamage1 libxfixes3 xterm \
libsm6 libxtst6 libpciaccess0 libcap2 libglib2.0-0 libegl1 libgbm1 libgl1-mesa-dri  libgl1  \
libdrm2 libpng16-16 libexpat1 libavresample-dev libswscale-dev libutempter0
mkdir -p ~/Downloads >/dev/null 2>&1
cd ~/Downloads
echo "[-----------------------------------------------------------------------------]"
echo "[-----------------------------------------------------------------------------]"
echo -e "[----------------] \033[32m>>> ЗАГРУЗКА УСТАН. ФАЙЛОВ! <<<\033[0m [----------------]"
echo "[-----------------------------------------------------------------------------]"
echo "[-----------------------------------------------------------------------------]"
wget https://posixbit.net/pub/steamdowngrade/linux/steam-launcher_1.0.0.75_all.deb
wget https://posixbit.net/pub/steamdowngrade/linux/steam_1.0.0.75_i386.deb
wget https://posixbit.net/pub/steamdowngrade/linux/steam-libs-i386_1.0.0.75_i386.deb
wget https://posixbit.net/pub/steamdowngrade/linux/steam-libs-amd64_1.0.0.75_amd64.deb
wget https://posixbit.net/pub/steamdowngrade/linux/1676336721.tar
wget https://posixbit.net/pub/steamdowngrade/linux/OG-Steam-1.0.13a.zip
wget https://github.com/TiberiumFusion/FixedSteamFriendsUI/releases/download/Release-v5.0.0/PatchPayload_v5.0.0-36b8a64e-0825-4226-9edb-52527018f6b6.zip
echo "[-----------------------------------------------------------------------------]"
echo "[-----------------------------------------------------------------------------]"
echo -e "[----------------] \033[32m>>> УСТАНОВКА STEAM ВЕРСИИ 14.02.2023 <<<\033[0m [----------------]"
echo "[-----------------------------------------------------------------------------]"
echo "[-----------------------------------------------------------------------------]"
sudo apt install -y ./steam-launcher_1.0.0.75_all.deb
sudo apt install -y ./steam_1.0.0.75_i386.deb
sudo apt install -y ./steam-libs-i386_1.0.0.75_i386.deb
sudo apt install -y ./steam-libs-amd64_1.0.0.75_amd64.deb
tar xvf 1676336721.tar
unzip OG-Steam-1.0.13a.zip
unzip PatchPayload_v5.0.0-36b8a64e-0825-4226-9edb-52527018f6b6.zip
#rm -rf ~/.local/share/Steam/package
#cp -rTf ~/Downloads/package ~/.local/share/Steam/package
#cp -rTf steam_client_ubuntu12 ~/.local/share/Steam/package
#cp -rTf steam_client_ubuntu12.manifest ~/.local/share/Steam/package
sudo touch /lib/steam/start.sh
sudo chmod a+x /lib/steam/start.sh
sudo sed -i 's#Exec=/usr/bin/steam %U#Exec=/lib/steam/start.sh %U#' /usr/share/applications/steam.desktop
sudo tee /lib/steam/start.sh > /dev/null << 'EOF'
#!/bin/bash
export LIBGL_ALWAYS_SOFTWARE=1
export MESA_GL_VERSION_OVERRIDE=2.1
export MESA_GLSL_VERSION_OVERRIDE=120
steam -overridepackageurl https://posixbit.net/pub/steamdowngrade/client -vgui -nofriendsui -no-browser -noreactlogin -cef-disable-gpu -cef-disable-gpu-compositing -no-cef-sandbox -no-cef -no-sandbox steam://open/minigameslist
EOF
echo "[-----------------------------------------------------------------------------]"
echo "[-----------------------------------------------------------------------------]"
echo -e "[----------------] \033[32m>>> ОБНОВЛЕНИЕ RUNTIME ДО 14.02.2023! <<<\033[0m [----------------]"
echo "[-----------------------------------------------------------------------------]"
echo "[-----------------------------------------------------------------------------]"
export LIBGL_ALWAYS_SOFTWARE=1
export MESA_GL_VERSION_OVERRIDE=2.1
export MESA_GLSL_VERSION_OVERRIDE=120
steam -forcesteamupdate -forcepackagedownload -overridepackageurl https://posixbit.net/pub/steamdowngrade/client -vgui -no-browser -noreactlogin -cef-disable-gpu -cef-disable-gpu-compositing -no-cef-sandbox -no-cef -no-sandbox -exitsteam
cp -rTf ~/Downloads/OG-Steam-1.0.13a/OG-Steam ~/.local/share/Steam
rm ~/.local/share/Steam/clientui/friends.js
mv -f clientui/friends.js ~/.local/share/Steam/clientui/
mv -f clientui/steam-chat.com-snapshot-mod-{36b8a64e-0825-4226-9edb-52527018f6b6} ~/.local/share/Steam/clientui
cp steam.cfg ~/.local/share/Steam/
cp --remove-destination steam.cfg ~/.local/share/Steam/
echo "[-----------------------------------------------------------------------------]"
echo "[-----------------------------------------------------------------------------]"
echo -e "[----------------] \033[32m>>> ЗАПУСТИТЕ STEAM С ПОМОЩЬЮ ЯРЛЫКА! <<<\033[0m [----------------]"
echo "[-----------------------------------------------------------------------------]"
echo "[-----------------------------------------------------------------------------]"