From a9098a3b3e34b9620e71f3a44eb2efa20a626fcc Mon Sep 17 00:00:00 2001 From: Stefan Naumann Date: Sat, 29 Apr 2017 21:37:45 +0200 Subject: [PATCH] added setup-file --- fltk_exists.py | 4 +++ setup.sh | 65 ++++++++++++++++++++++++++++++++++ piplayer.py => src/piplayer.py | 2 +- 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 fltk_exists.py create mode 100644 setup.sh rename piplayer.py => src/piplayer.py (99%) diff --git a/fltk_exists.py b/fltk_exists.py new file mode 100644 index 0000000..86d4902 --- /dev/null +++ b/fltk_exists.py @@ -0,0 +1,4 @@ +from fltk import * + +def main () : + return 0; diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..154284f --- /dev/null +++ b/setup.sh @@ -0,0 +1,65 @@ +#! /bin/bash +# + +# please set the folders, archive and link accordingly +# should download this file for building pyFLTK +pyFLTKFolder=pyFltk-1.3.4.1 +pyFLTKFile=pyFltk-1.3.4.1_py3.tar.gz +pyFLTKLink=https://downloads.sourceforge.net/project/pyfltk/pyfltk/pyFltk-1.3.4.1/pyFltk-1.3.4.1_py3.tar.gz + +# installation places for dbusconfig.sh and piplayer source files +dbusconfig=/opt/piplayerdbus.sh +piplayer=/opt/piplayer/ + +function help () +{ + echo "Usage: bash setup.sh [install|prepare]" + echo "----" + echo " * install: copies dbuscontrol.sh and PiPlayer to a common place (needs root)" + echo " * prepare: install prerequisites (pyFLTK); GCC required" +} + +case $1 in +# install piplayer to a common place +install) + name=$(whoami) + #if [ "$name" != "root" ] + if [ 0 -eq 1 ] + then + echo "Please start as root" + echo "" + help + exit + fi + + if [ ! -f $dbusconfig ] + then + cp dbusconfig.sh $dbusconfig + fi + if [ ! -f $piplayer ] + then + mkdir $piplayer + cp src/* $piplayer + fi + ;; +# build and setup pyFLTK +prepare) + python fltk_exists.py &> /dev/null + val=$? + if [ $val -eq 0 ] + then + curl -L $pyFLTKLink > $pyFLTKFile + tar -xvf $pyFLTKFile + pushd . + cd $pyFLTKFolder + python setup.py build + sudo python setup.py install + popd + rm -rf $pyFLTKFolder + rm $pyFLTKFile + fi + ;; +*) + help + ;; +esac diff --git a/piplayer.py b/src/piplayer.py similarity index 99% rename from piplayer.py rename to src/piplayer.py index 8d2ee77..e2336a2 100644 --- a/piplayer.py +++ b/src/piplayer.py @@ -42,7 +42,7 @@ def startOMX ( argv ): def callDBus ( param ): try: - param.insert ( 0, "dbuscontrol.sh" ); + param.insert ( 0, "/opt/dbuscontrol.sh" ); param.insert ( 0, "bash" ); out = subprocess.check_output ( param ) return out;