2015-02-11 16:58:54 -05:00
|
|
|
#!/bin/sh
|
|
|
|
# Credit thorsteneckel who made the how-to that is the basis for this
|
|
|
|
# script, see https://gist.github.com/thorsteneckel/c0610fb415c8d0486bce
|
|
|
|
|
|
|
|
echo "This script will install forked-daapd in FreeBSD 10.1. The script is not"
|
|
|
|
echo "very polished, so you might want to look through it before running it."
|
|
|
|
read -p "Continue? [y/N] " yn
|
|
|
|
if [ "$yn" != "y" ]; then
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
DEPS="gmake autoconf automake libtool gettext gperf glib pkgconf wget git \
|
|
|
|
ffmpeg libconfuse libevent2 mxml libgcrypt libunistring libiconv \
|
|
|
|
libplist avahi sqlite3"
|
|
|
|
echo "The script can install the following dependency packages for you:"
|
|
|
|
echo $DEPS
|
|
|
|
read -p "Should the script install these packages? [y/N] " yn
|
2015-02-12 16:50:04 -05:00
|
|
|
if [ "$yn" = "y" ]; then
|
2015-02-11 16:58:54 -05:00
|
|
|
sudo pkg install $DEPS;
|
|
|
|
fi
|
|
|
|
|
|
|
|
JRE="openjdk8-jre"
|
|
|
|
read -p "Should the script install $JRE for you? [y/N] " yn
|
2015-02-12 16:50:04 -05:00
|
|
|
if [ "$yn" = "y" ]; then
|
2015-02-11 16:58:54 -05:00
|
|
|
sudo pkg install $JRE;
|
|
|
|
read -p "Should the script add the mount points to /etc/fstab that $JRE requests? [y/N] " yn
|
2015-02-12 16:50:04 -05:00
|
|
|
if [ "$yn" = "y" ]; then
|
2015-02-11 16:58:54 -05:00
|
|
|
sudo sh -c 'echo "fdesc /dev/fd fdescfs rw 0 0" >> /etc/fstab'
|
|
|
|
sudo sh -c 'echo "proc /proc procfs rw 0 0" >> /etc/fstab'
|
|
|
|
sudo mount /dev/fd
|
|
|
|
sudo mount /proc
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
WORKDIR=~/forked-daapd_build
|
|
|
|
CONFIG=/usr/local/etc/forked-daapd.conf
|
|
|
|
read -p "Should the script create $WORKDIR and use it for building? [Y/n] " yn
|
2015-02-12 16:50:04 -05:00
|
|
|
if [ "$yn" = "n" ]; then
|
2015-02-11 16:58:54 -05:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
mkdir -p $WORKDIR
|
|
|
|
if [ ! -d $WORKDIR ]; then
|
|
|
|
echo "Error creating $WORKDIR"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
cd $WORKDIR
|
|
|
|
|
2015-02-14 15:02:25 -05:00
|
|
|
read -p "Should the script install antlr and libantlr3c? [y/N] " yn
|
2015-02-12 16:50:04 -05:00
|
|
|
if [ "$yn" = "y" ]; then
|
2015-02-14 17:52:56 -05:00
|
|
|
read -p "Should the script build libantlr3c for 64 bit? [Y/n] " yn
|
|
|
|
if [ "$yn" != "n" ]; then
|
|
|
|
ENABLE64BIT="--enable-64bit"
|
|
|
|
fi
|
|
|
|
|
2015-02-11 16:58:54 -05:00
|
|
|
wget --no-check-certificate https://github.com/antlr/website-antlr3/raw/gh-pages/download/antlr-3.4-complete.jar
|
|
|
|
wget --no-check-certificate https://github.com/antlr/website-antlr3/raw/gh-pages/download/C/libantlr3c-3.4.tar.gz
|
|
|
|
|
|
|
|
sudo mv antlr-3.4-complete.jar /usr/local/share/java
|
|
|
|
printf "#!/bin/sh
|
|
|
|
export CLASSPATH
|
2015-02-14 15:02:25 -05:00
|
|
|
CLASSPATH=\$CLASSPATH:/usr/local/share/java/antlr-3.4-complete.jar:/usr/local/share/java
|
|
|
|
/usr/local/bin/java org.antlr.Tool \$*
|
2015-02-11 16:58:54 -05:00
|
|
|
" > antlr3
|
|
|
|
chmod a+x antlr3
|
|
|
|
sudo mv antlr3 /usr/local/bin
|
|
|
|
|
|
|
|
tar xzf libantlr3c-3.4.tar.gz
|
|
|
|
cd libantlr3c-3.4
|
2015-02-14 17:52:56 -05:00
|
|
|
./configure $ENABLE64BIT && gmake && sudo gmake install
|
2015-02-11 16:58:54 -05:00
|
|
|
cd $WORKDIR
|
|
|
|
fi
|
|
|
|
|
|
|
|
read -p "Should the script build forked-daapd? [y/N] " yn
|
2015-02-12 16:50:04 -05:00
|
|
|
if [ "$yn" = "y" ]; then
|
2015-02-11 16:58:54 -05:00
|
|
|
git clone https://github.com/ejurgensen/forked-daapd.git
|
|
|
|
cd forked-daapd
|
|
|
|
|
|
|
|
#Cleanup in case this is a re-run
|
|
|
|
gmake clean
|
|
|
|
git clean -f
|
|
|
|
autoreconf -vi
|
|
|
|
|
|
|
|
#These should no longer be required, but if you run into trouble you can try enabling them
|
|
|
|
#export CC=cc
|
|
|
|
#export LIBUNISTRING_CFLAGS=-I/usr/include
|
|
|
|
#export LIBUNISTRING_LIBS=-L/usr/lib
|
|
|
|
#export ZLIB_CFLAGS=-I/usr/include
|
|
|
|
#export ZLIB_LIBS=-L/usr/lib
|
|
|
|
|
|
|
|
export CFLAGS="-march=native -g -Ofast -pipe -I/usr/local/include -I/usr/include"
|
|
|
|
export LDFLAGS="-L/usr/local/lib -L/usr/lib"
|
|
|
|
./configure --build=i386-portbld-freebsd10.1 && gmake
|
|
|
|
|
|
|
|
read -p "Should the script install forked-daapd and add service startup scripts? [y/N] " yn
|
2015-02-12 16:50:04 -05:00
|
|
|
if [ "$yn" = "y" ]; then
|
2015-02-11 16:58:54 -05:00
|
|
|
if [ -f $CONFIG ]; then
|
|
|
|
echo "Backing up old config file to $CONFIG.bak"
|
|
|
|
sudo cp "$CONFIG" "$CONFIG.bak"
|
|
|
|
fi
|
|
|
|
sudo gmake install
|
|
|
|
|
|
|
|
sudo sed -i -- 's/\/var\/cache/\/usr\/local\/var\/cache/g' $CONFIG
|
|
|
|
# Setup user and startup scripts
|
|
|
|
echo "daapd::::::forked-daapd:/nonexistent:/usr/sbin/nologin:" | sudo adduser -w no -D -f -
|
|
|
|
sudo chown -R daapd:daapd /usr/local/var/cache/forked-daapd
|
|
|
|
if [ ! -f scripts/freebsd_start_10.1.sh ]; then
|
|
|
|
echo "Could not find FreeBSD startup script"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
sudo cp scripts/freebsd_start_10.1.sh /usr/local/etc/rc.d/forked-daapd
|
|
|
|
sudo chmod a+x /usr/local/etc/rc.d/forked-daapd
|
|
|
|
|
|
|
|
service forked-daapd enabled
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
sudo sh -c 'echo "forked_daapd_enable=\"YES\"" >> /etc/rc.conf'
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd $WORKDIR
|
|
|
|
fi
|
|
|
|
|
|
|
|
read -p "Should the script enable and start dbus and avahi-daemon? [y/N] " yn
|
2015-02-12 16:50:04 -05:00
|
|
|
if [ "$yn" = "y" ]; then
|
2015-02-11 16:58:54 -05:00
|
|
|
service dbus enabled
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
sudo sh -c 'echo "dbus_enable=\"YES\"" >> /etc/rc.conf'
|
|
|
|
fi
|
|
|
|
sudo service dbus start
|
|
|
|
|
|
|
|
service avahi-daemon enabled
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
sudo sh -c 'echo "avahi_daemon_enable=\"YES\"" >> /etc/rc.conf'
|
|
|
|
fi
|
|
|
|
sudo service avahi-daemon start
|
|
|
|
fi
|
|
|
|
|
|
|
|
read -p "Should the script (re)start forked-daapd and display the log output? [y/N] " yn
|
2015-02-12 16:50:04 -05:00
|
|
|
if [ "$yn" = "y" ]; then
|
2015-02-11 16:58:54 -05:00
|
|
|
sudo service forked-daapd restart
|
|
|
|
tail -f /var/log/forked-daapd.log
|
|
|
|
fi
|