#!/bin/bash
#
# Auto RTLSDR installed for Ubuntu 12 with SDR#
#
# By KJ4EHD ryan_turner
# Find help @ #sdrsharp and ##rtlsdr on freenode IRC.
# Current as of 28 OCT 2012
# Tested using
# * Ubuntu 12.10 64-bit
#
# This script works, as of today, grabbing the current versions automatically via apt-get, git, and svn:
# * rev 991 of SDRSharp
# * commit aad68f3a21f8507d5ad7b01dc9e980d2f0d7e327 of rtl-sdr
# * Debian 2.10.8.1-5ubuntu1 of mono
# * MonoDevelop 3.0.3.2
# * 19+svn20111121-1build1 of libportaudio2
# * icotool 0.30.0
sudo apt-get install subversion git mono-complete libportaudio2 monodevelop icoutils
cd /home/$(whoami)
# getting rtl-sdr working
mkdir rtl-sdr
cd rtl-sdr
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr/
mkdir build
cd build
cmake ../
make
sudo make install
sudo ldconfig
cd /home/$(whoami)
rm -rf rtl-sdr
# getting sdrsharp to work
svn checkout https://subversion.assembla.com/svn/sdrsharp/
cd sdrsharp/trunk
mdtool build -c:Release SDRSharp.sln
cd Release
ln -s /usr/lib/x86_64-linux-gnu/libportaudio.so.2 libportaudio.so
# modify config
sed -i '/SDRSharp.SoftRock.SoftRockIO,SDRSharp.SoftRock/d' SDRSharp.exe.config
sed -i '/SDRSharp.FUNcube.FunCubeIO,SDRSharp.FUNcube/d' SDRSharp.exe.config
sed -i '/SDRSharp.FUNcubeProPlus.FunCubeProPlusIO,SDRSharp.FUNcubeProPlus/d' SDRSharp.exe.config
sed -i '/SDRSharp.RTLTCP.RtlTcpIO,SDRSharp.RTLTCP/d' SDRSharp.exe.config
sed -i '/SDRSharp.SDRIQ.SdrIqIO,SDRSharp.SDRIQ/d' SDRSharp.exe.config
sed -i 's/<!-- <add key="RTL-SDR \/ USB" value="SDRSharp.RTLSDR.RtlSdrIO,SDRSharp.RTLSDR" \/> -->/<add key="RTL-SDR \/ USB" value="SDRSharp.RTLSDR.RtlSdrIO,SDRSharp.RTLSDR" \/>/' SDRSharp.exe.config
# "Install" it
mkdir /home/$(whoami)/.sdrsharp/
mv /home/$(whoami)/sdrsharp/trunk/Release/* /home/$(whoami)/.sdrsharp/
# Create PNG of icon
cd /home/$(whoami)/.sdrsharp/
icotool -x /home/$(whoami)/sdrsharp/trunk/SDRSharp/mixer.ico
chmod 0777 /home/$(whoami)/.sdrsharp/mixer_1_48x48x32.png
# Clean up
rm -rf /home/$(whoami)/sdrsharp/
# Make .desktop file
cd /home/$(whoami)/Desktop
touch prog-sdrsharp.desktop
echo "[Desktop Entry]" >> prog-sdrsharp.desktop
echo "Type=Application" >> prog-sdrsharp.desktop
echo "Encoding=UTF-8" >> prog-sdrsharp.desktop
echo "Name=SDR#" >> prog-sdrsharp.desktop
echo "Comment=SDRSharp" >> prog-sdrsharp.desktop
echo "Exec= mono /home/$(whoami)/.sdrsharp/SDRSharp.exe" >> prog-sdrsharp.desktop
echo "Icon= /home/$(whoami)/.sdrsharp/mixer_1_48x48x32.png" >> prog-sdrsharp.desktop
echo "Categories=Utility;Application;" >> prog-sdrsharp.desktop
echo "Terminal=false" >> prog-sdrsharp.desktop
sudo chmod +x /home/$(whoami)/Desktop/prog-sdrsharp.desktop
# Make the menu item
touch prog-sdrsharp.directory
echo [Desktop Entry] >> prog-sdrsharp.directory
echo Value=1.0 >> prog-sdrsharp.directory
echo Type=Directory >> prog-sdrsharp.directory
echo Encoding=UTF-8 >> prog-sdrsharp.directory
xdg-desktop-menu install prog-sdrsharp.directory prog-sdrsharp.desktop
xdg-desktop-menu forceupdate
#
# Auto RTLSDR installed for Ubuntu 12 with SDR#
#
# By KJ4EHD ryan_turner
# Find help @ #sdrsharp and ##rtlsdr on freenode IRC.
# Current as of 28 OCT 2012
# Tested using
# * Ubuntu 12.10 64-bit
#
# This script works, as of today, grabbing the current versions automatically via apt-get, git, and svn:
# * rev 991 of SDRSharp
# * commit aad68f3a21f8507d5ad7b01dc9e980d2f0d7e327 of rtl-sdr
# * Debian 2.10.8.1-5ubuntu1 of mono
# * MonoDevelop 3.0.3.2
# * 19+svn20111121-1build1 of libportaudio2
# * icotool 0.30.0
sudo apt-get install subversion git mono-complete libportaudio2 monodevelop icoutils
cd /home/$(whoami)
# getting rtl-sdr working
mkdir rtl-sdr
cd rtl-sdr
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr/
mkdir build
cd build
cmake ../
make
sudo make install
sudo ldconfig
cd /home/$(whoami)
rm -rf rtl-sdr
# getting sdrsharp to work
svn checkout https://subversion.assembla.com/svn/sdrsharp/
cd sdrsharp/trunk
mdtool build -c:Release SDRSharp.sln
cd Release
ln -s /usr/lib/x86_64-linux-gnu/libportaudio.so.2 libportaudio.so
# modify config
sed -i '/SDRSharp.SoftRock.SoftRockIO,SDRSharp.SoftRock/d' SDRSharp.exe.config
sed -i '/SDRSharp.FUNcube.FunCubeIO,SDRSharp.FUNcube/d' SDRSharp.exe.config
sed -i '/SDRSharp.FUNcubeProPlus.FunCubeProPlusIO,SDRSharp.FUNcubeProPlus/d' SDRSharp.exe.config
sed -i '/SDRSharp.RTLTCP.RtlTcpIO,SDRSharp.RTLTCP/d' SDRSharp.exe.config
sed -i '/SDRSharp.SDRIQ.SdrIqIO,SDRSharp.SDRIQ/d' SDRSharp.exe.config
sed -i 's/<!-- <add key="RTL-SDR \/ USB" value="SDRSharp.RTLSDR.RtlSdrIO,SDRSharp.RTLSDR" \/> -->/<add key="RTL-SDR \/ USB" value="SDRSharp.RTLSDR.RtlSdrIO,SDRSharp.RTLSDR" \/>/' SDRSharp.exe.config
# "Install" it
mkdir /home/$(whoami)/.sdrsharp/
mv /home/$(whoami)/sdrsharp/trunk/Release/* /home/$(whoami)/.sdrsharp/
# Create PNG of icon
cd /home/$(whoami)/.sdrsharp/
icotool -x /home/$(whoami)/sdrsharp/trunk/SDRSharp/mixer.ico
chmod 0777 /home/$(whoami)/.sdrsharp/mixer_1_48x48x32.png
# Clean up
rm -rf /home/$(whoami)/sdrsharp/
# Make .desktop file
cd /home/$(whoami)/Desktop
touch prog-sdrsharp.desktop
echo "[Desktop Entry]" >> prog-sdrsharp.desktop
echo "Type=Application" >> prog-sdrsharp.desktop
echo "Encoding=UTF-8" >> prog-sdrsharp.desktop
echo "Name=SDR#" >> prog-sdrsharp.desktop
echo "Comment=SDRSharp" >> prog-sdrsharp.desktop
echo "Exec= mono /home/$(whoami)/.sdrsharp/SDRSharp.exe" >> prog-sdrsharp.desktop
echo "Icon= /home/$(whoami)/.sdrsharp/mixer_1_48x48x32.png" >> prog-sdrsharp.desktop
echo "Categories=Utility;Application;" >> prog-sdrsharp.desktop
echo "Terminal=false" >> prog-sdrsharp.desktop
sudo chmod +x /home/$(whoami)/Desktop/prog-sdrsharp.desktop
# Make the menu item
touch prog-sdrsharp.directory
echo [Desktop Entry] >> prog-sdrsharp.directory
echo Value=1.0 >> prog-sdrsharp.directory
echo Type=Directory >> prog-sdrsharp.directory
echo Encoding=UTF-8 >> prog-sdrsharp.directory
xdg-desktop-menu install prog-sdrsharp.directory prog-sdrsharp.desktop
xdg-desktop-menu forceupdate