rendered paste body#!/bin/bash
# *
# * Copyright © Kendall Hopkins and Malcolm Jarvis
# * This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 license.
# * For more details, see http://creativecommons.org/licenses/by-nc-sa/3.0/
# *
cd `dirname "$0"`
cd ./binary
cat ./etc/lighttpd-template.conf > ./etc/lighttpd-step1.conf
#set up lighttpd for ssl
echo '
$SERVER["socket"] == ":9092" {
ssl.engine = "enable"
ssl.pemfile = "~basedir~/etc/server.pem"
}' >> ./etc/lighttpd-step1.conf
cd ./etc
#create .pem file
openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes -config ../../data/openssl-autogen.conf 2> /dev/null
cd ../
#allows lighttpd to be run without a "set" directory
BASEDIR=`pwd`; sed "s,~basedir~,$BASEDIR,g" ./etc/lighttpd-step1.conf > ./etc/lighttpd.conf
rm ./etc/lighttpd-step1.conf
#make sure no other lighttpd and transmission-daemon are running
killall lighttpd > /dev/null
#link to the dynamic libraries
export DYLD_LIBRARY_PATH="$rootdir/lib/:`pwd`/lib:$DYLD_LIBRARY_PATH"
#set up socket location
printf ~/Library/Application\ Support/Transmission/daemon/socket > ./www/remote/data/socket.txt
#run webserver and transmission-daemon
./sbin/lighttpd -f ./etc/lighttpd.conf
./bin/transmission-daemon
echo "Server has started"
#Apparently we are loading the page before the daemon is ready
sleep 3
open "https://localhost:9092/"