necouchman commented on code in PR #515: URL: https://github.com/apache/guacamole-server/pull/515#discussion_r1586190803
########## Depend-on/Bash.sh: ########## @@ -0,0 +1,221 @@ +#!/bin/bash + +identify_and_run() { + os=$(uname) + if [ "$os" = "Linux" ]; then + distro=$(lsb_release -si) + case "$distro" in + CentOS|RedHatEnterpriseServer) + if command -v dnf &>/dev/null; then + echo "The following packages will be installed:" + echo "FFmpeg" + echo "libavcodec-devel libavformat-devel libavutil-devel libswscale-devel" + echo "freerdp2-devel" + echo "pango-devel" + echo "libssh2-devel" + echo "libtelnet-devel" + echo "libvncserver-devel" + echo "libwebsockets-devel" + echo "pulseaudio-libs-devel" + echo "openssl-devel" + echo "libvorbis-devel" + echo "libwebp-devel" + + read -p "Do you understand? (yes/no): " choice + case "$choice" in + yes|YES|y|Y) + sudo dnf install -y FFmpeg + sudo dnf install -y libavcodec-devel libavformat-devel libavutil-devel libswscale-devel + sudo dnf install -y freerdp2-devel + sudo dnf install -y pango-devel + sudo dnf install -y libssh2-devel + sudo dnf install -y libtelnet-devel + sudo dnf install -y libvncserver-devel + sudo dnf install -y libwebsockets-devel + sudo dnf install -y pulseaudio-libs-devel + sudo dnf install -y openssl-devel + sudo dnf install -y libvorbis-devel + sudo dnf install -y libwebp-devel + ;; + *) + echo "Installation cancelled." + ;; + esac + elif command -v yum &>/dev/null; then + echo "The following packages will be installed:" + echo "FFmpeg" + echo "libavcodec-devel libavformat-devel libavutil-devel libswscale-devel" + echo "freerdp2-devel" + echo "pango-devel" + echo "libssh2-devel" + echo "libtelnet-devel" + echo "libvncserver-devel" + echo "libwebsockets-devel" + echo "pulseaudio-libs-devel" + echo "openssl-devel" + echo "libvorbis-devel" + echo "libwebp-devel" + + read -p "Do you understand? (yes/no): " choice + case "$choice" in + yes|YES|y|Y) + sudo yum install -y FFmpeg + sudo yum install -y libavcodec-devel libavformat-devel libavutil-devel libswscale-devel + sudo yum install -y freerdp2-devel + sudo yum install -y pango-devel + sudo yum install -y libssh2-devel + sudo yum install -y libtelnet-devel + sudo yum install -y libvncserver-devel + sudo yum install -y libwebsockets-devel + sudo yum install -y pulseaudio-libs-devel + sudo yum install -y openssl-devel + sudo yum install -y libvorbis-devel + sudo yum install -y libwebp-devel + ;; + *) + echo "Installation cancelled." + ;; + esac + else + echo "Neither dnf nor yum found. Unsupported package manager." + fi + ;; + Ubuntu|Debian) + if command -v apt-get &>/dev/null; then + echo "The following packages will be installed:" + echo "ffmpeg" + echo "libavcodec-dev libavformat-dev libavutil-dev libswscale-dev" + echo "freerdp2-dev" + echo "libpango1.0-dev" + echo "libssh2-1-dev" + echo "libtelnet-dev" + echo "libvncserver-dev" + echo "libwebsockets-dev" + echo "libpulse-dev" + echo "libssl-dev" + echo "libvorbis-dev" + echo "libwebp-dev" + + read -p "Do you understand? (yes/no): " choice + case "$choice" in + yes|YES|y|Y) + sudo apt-get install -y ffmpeg + sudo apt-get install -y libavcodec-dev libavformat-dev libavutil-dev libswscale-dev + sudo apt-get install -y freerdp2-dev + sudo apt-get install -y libpango1.0-dev + sudo apt-get install -y libssh2-1-dev + sudo apt-get install -y libtelnet-dev + sudo apt-get install -y libvncserver-dev + sudo apt-get install -y libwebsockets-dev + sudo apt-get install -y libpulse-dev + sudo apt-get install -y libssl-dev + sudo apt-get install -y libvorbis-dev + sudo apt-get install -y libwebp-dev + ;; + *) + echo "Installation cancelled." + ;; + esac + elif command -v dpkg &>/dev/null; then + echo "The following packages will be installed:" + echo "ffmpeg" + echo "libavcodec-dev libavformat-dev libavutil-dev libswscale-dev" + echo "freerdp2-dev" + echo "libpango1.0-dev" + echo "libssh2-1-dev" + echo "libtelnet-dev" + echo "libvncserver-dev" + echo "libwebsockets-dev" + echo "libpulse-dev" + echo "libssl-dev" + echo "libvorbis-dev" + echo "libwebp-dev" + + read -p "Do you understand? (yes/no): " choice + case "$choice" in + yes|YES|y|Y) + sudo dpkg -i <package.deb> + ;; + *) + echo "Installation cancelled." + ;; + esac + else + echo "Neither apt-get nor dpkg found. Unsupported package manager." + fi + ;; + *) Review Comment: My preference would be to create a "SuSE" section of the `case` statement above this `*` (default) handler, and put the SuSE commands in that section, and then use the `*` area to provide feedback that the distribution is either undetected or unsupported. Roughly, something like this: ``` case "distro" in CentOS|RedHatEnterpriseServer|Rocky) // Run EL commands here Debian|Ubuntu|Xubuntu) // Run Debian commands here SuSE) // Run SuSE commands here *) // Throw error output and exit - distro not detected, not supported, etc. esac ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@guacamole.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org