Skip to content

Commit

Permalink
Bumping version to 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Oct 10, 2018
1 parent e3cb39a commit 64d1568
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 22 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release Notes

## 0.3.0 - 2018-10-10
* Bundle firmware installer

## 0.2.4 - 2018-10-10
* Stream to Raspberry Pi

Expand Down
44 changes: 30 additions & 14 deletions build.fsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
open System.IO
#r "paket: groupref build //"
#load "./.fake/build.fsx/intellisense.fsx"

Expand Down Expand Up @@ -142,18 +143,18 @@ Target.create "SetReleaseNotes" (fun _ ->
System.IO.File.WriteAllLines("src/Client/ReleaseNotes.fs",lines)
)

Target.create "BundleClient" (fun _ ->
let dotnetOpts = install.Value (DotNet.Options.Create())
let result =
Process.execSimple (fun info ->
{ info with
FileName = dotnetOpts.DotNetCliPath
WorkingDirectory = serverPath
Arguments = "publish -c Release -o \"" + Path.getFullName deployDir + "\"" }) TimeSpan.MaxValue
if result <> 0 then failwith "Publish Server failed"
let copyInLinuxFormat target (files: seq<string>) =
files
|> Seq.iter (fun file ->
let fi = FileInfo file
let content = File.ReadAllText file
let content = content.Replace("\r\n","\n").Replace("\r","\n")
let targetFile = target </> fi.Name
File.WriteAllText(targetFile,content))

Target.create "CreateFirmware" (fun _ ->
let dotnetOpts = install.Value (DotNet.Options.Create())
let publish = piDeployDir </> "publish"

Shell.cleanDirs [publish]
let result =
Process.execSimple (fun info ->
Expand All @@ -163,13 +164,27 @@ Target.create "BundleClient" (fun _ ->
Arguments = "publish -c Release -r linux-arm -o \"" + Path.getFullName publish + "\"" }) TimeSpan.MaxValue
if result <> 0 then failwith "Publish PiServer failed"

[ piServerPath </> "PiServer"] |> Shell.copyFiles piDeployDir
!! (piServerPath </> "*.sh") |> Shell.copyFiles piDeployDir
[ piServerPath </> "PiServer"
"./README.md"
piServerPath </> "PiServer.defaults"
] |> copyInLinuxFormat piDeployDir
!! (piServerPath </> "*.sh") |> copyInLinuxFormat piDeployDir

!! (piServerPath </> "*.js") |> Shell.copyFiles publish
!! (piServerPath </> "*.js") |> Shell.copyFiles publish
!! (piServerPath </> "*.js") |> copyInLinuxFormat publish
!! (piServerPath </> "*.js") |> copyInLinuxFormat publish

System.IO.Compression.ZipFile.CreateFromDirectory(piDeployDir, currentFirmware)
)

Target.create "BundleClient" (fun _ ->
let dotnetOpts = install.Value (DotNet.Options.Create())
let result =
Process.execSimple (fun info ->
{ info with
FileName = dotnetOpts.DotNetCliPath
WorkingDirectory = serverPath
Arguments = "publish -c Release -o \"" + Path.getFullName deployDir + "\"" }) TimeSpan.MaxValue
if result <> 0 then failwith "Publish Server failed"

let clientDir = deployDir </> "client"
let publicDir = clientDir </> "public"
Expand Down Expand Up @@ -288,6 +303,7 @@ open Fake.Core.TargetOperators
==> "InstallClient"
==> "SetReleaseNotes"
==> "Build"
==> "CreateFirmware"
==> "BundleClient"
==> "CreateDockerImage"
==> "PrepareRelease"
Expand Down
5 changes: 4 additions & 1 deletion src/Client/ReleaseNotes.fs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
module internal ReleaseNotes

let Version = "0.2.4"
let Version = "0.3.0"

let IsPrerelease = false

let Notes = """
# Release Notes
## 0.3.0 - 2018-10-10
* Bundle firmware installer
## 0.2.4 - 2018-10-10
* Stream to Raspberry Pi
Expand Down
8 changes: 1 addition & 7 deletions src/PiServer/PiServer
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,14 @@
# placed in /etc/init.d.
### END INIT INFO

DESC="PiServer audio hub"
DESC="PiServer audio player"
NAME=PiServer
DAEMONHOME=/home/pi/PiServer/publish
DAEMON=$DAEMONHOME/$NAME
DAEMON_ARGS="--options args"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

[ -x "$DAEMON" ] || exit 0
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
. /lib/init/vars.sh
. /lib/lsb/init-functions


# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

Expand Down
6 changes: 6 additions & 0 deletions src/PiServer/PiServer.defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
NAME=PiServer
DAEMONHOME=/home/pi/PiServer/publish
DAEMON=$DAEMONHOME/$NAME
DAEMON_ARGS="--options args"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
25 changes: 25 additions & 0 deletions src/PiServer/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,46 @@

DOTNETREQ=2.1.5
SCRIPTROOT=`dirname "$0"`
SOURCEPATH=$SCRIPTROOT/bin
DEFAULTDAEMONHOME=/home/pi/PiServer/publish
DEFAULTS=/etc/default/PiServer

DAEMONHOME=$1
if [ "x$DAEMONHOME" = "x" ]; then
if [ -e $SCRIPTROOT/PiServer.defaults ]; then
. $SCRIPTROOT/PiServer.defaults
else
DAEMONHOME=$DEFAULTDAEMONHOME
fi
fi

sudo apt-get update
sudo apt-get install curl libunwind8 gettext apt-transport-https omxplayer pulseaudio-module-bluetooth

curl -sSL -o dotnet.tar.gz https://download.visualstudio.microsoft.com/download/pr/4d555219-1f04-47c6-90e5-8b3ff8989b9c/0798763e6e4b98a62846116f997d046e/dotnet-runtime-2.1.5-linux-arm.tar.gz
sudo mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnet
rm dotnet.tar.gz
sudo ln -s /opt/dotnet/dotnet /usr/local/bin

pulseaudio -k
pulseaudio --start

if [ -e $SCRIPTROOT/PiServer ]; then
if [ ! -e $DEFAULTS -a $SCRIPTROOT/PiServer.defaults ]; then
cat $SCRIPTROOT/PiServer.defaults | grep -v "DAEMONHOME=" > $DEFAULTS
echo DAEMONHOME=$DAEMONHOME >> $DEFAULTS
fi

if [ ! -d $DAEMONHOME ]; then
mkdir -p $DAEMONHOME
fi

cp -r $SOURCEPATH/. $DAEMONHOME
cp $SCRIPTROOT/PiServer /etc/init.d/
chmod +x /etc/init.d/PiServer
chmod +x $DAEMONHOME/$NAME
systemctl daemon-reload
systemctl enable PiServer
service PiServer start
service PiServer status
fi
57 changes: 57 additions & 0 deletions src/PiServer/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/sh

. /lib/lsb/init-functions

DOTNETREQ=2.1.5
SCRIPTROOT=`dirname "$0"`
DEFAULTS=/etc/default/PiServer
SOURCEPATH=$SCRIPTROOT/bin

if [ ! -e $DEFAULTS -a $SCRIPTROOT/PiServer.defaults ]; then
cp $SCRIPTROOT/PiServer.defaults $DEFAULTS
fi

if [ -e $DEFAULTS ]; then
log_action_begin_msg "Loading PiServer settings"
. /etc/default/PiServer
log_action_end_msg $?

if [ ! -e $DAEMON ]; then
log_failure_msg "PiServer not installed! Update "
exit 1
fi

if [ -e $SOURCEPATH/$NAME ]; then
log_action_begin_msg "Stop service"
service PiServer stop
retval=$?
log_action_end_msg $retval
if [ $retval -ne 0 ]; then
exit 2
fi

log_action_begin_msg "Updating"
log_action_cont_msg "Init script"
cp $SCRIPTROOT/PiServer /etc/init.d/
chmod +x /etc/init.d/PiServer
log_action_cont_msg "Reloading system.d"
systemctl daemon-reload
log_action_end_msg $?

log_action_begin_msg "Updating $DAEMONHOME"
rm -R $DAEMONHOME && cp -r $SOURCEPATH/. $DAEMONHOME
chmod +x $DAEMONHOME/$NAME
log_action_end_msg $?

if [ -e $DAEMON ]; then
log_action_begin_msg "Starting service"
service PiServer start
log_action_end_msg $?
fi
else
log_failure_msg "Update package corrupt?"
fi
else
log_failure_msg "Unable to load defaults"
fi

0 comments on commit 64d1568

Please sign in to comment.