Skip to content

Instantly share code, notes, and snippets.

@bonelifer
Last active January 2, 2025 02:51
Show Gist options
  • Save bonelifer/e17bcea920d3bb2b8c211ed20f48f33d to your computer and use it in GitHub Desktop.
Save bonelifer/e17bcea920d3bb2b8c211ed20f48f33d to your computer and use it in GitHub Desktop.
#!/usr/bin/bash
# Description: This script builds and installs RadioTray-NG on Ubuntu by cloning the repository (if not already cloned),
# building the package, installing it, and cleaning up the build directory afterwards.
# Ensure dependencies are installed before proceeding with the build process.
# Install necessary libraries and tools for building RadioTray-NG.
sudo apt-get update
sudo apt-get install -y \
libcurl4-openssl-dev \
libjsoncpp-dev \
libxdg-basedir-dev \
libnotify-dev \
libboost-filesystem-dev \
libgstreamer1.0-dev \
libappindicator3-dev \
libboost-log-dev \
libboost-program-options-dev \
libgtk-3-dev \
lsb-release \
libbsd-dev \
libncurses5-dev \
libglibmm-2.4-dev \
libwxgtk3.0-gtk3-dev \
libwxgtk3.0-gtk3-0v5 \
cmake
# Check if the radiotray-ng directory exists.
if [ ! -d "$HOME/CODE/radiotray-ng" ]; then
# If it doesn't exist, clone the repository.
mkdir -p "$HOME/CODE/"
cd "$HOME/CODE/"
git clone https://github.com/ebruck/radiotray-ng.git
else
# If it exists, just cd into the directory.
cd "$HOME/CODE/radiotray-ng"
fi
# Check if the build directory exists, clean it if necessary.
if [ -d "build" ]; then
# If build directory exists, clean it up.
echo "Cleaning up the existing build directory..."
rm -rf build
fi
# Create a fresh build directory inside the radiotray-ng directory.
mkdir -p build
cd build
# Run cmake and build the package.
cmake .. -DCMAKE_BUILD_TYPE=Release
make package
# Install the package.
filename=$(find . -maxdepth 1 -name "radiotray-ng*.deb" | sed -e 's/.\///g')
# Uncomment the next line if you want to debug the filename.
# echo $filename
sudo dpkg -i ./$filename
# Resolve any missing dependencies.
sudo apt-get install -f
# Cleanup the build directory after installation.
cd "$HOME/CODE/radiotray-ng"
rm -rf build
echo "Build directory cleaned up."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment