From d4adb067f1c7822a6f79b31e83138a33cbc04ee6 Mon Sep 17 00:00:00 2001 From: Christophe SEGUINOT Date: Wed, 20 May 2020 14:00:50 +0200 Subject: [PATCH] Several fixes (#38) - GNU/Linux: fixed `install.sh` - GNU/Linux: fixed `uninstall.sh` - GNU/Linux: add more examples for `streamer` - Fixed the GPG file creation! --- gnu-linux/install.sh | 23 ++++++++++++++--------- gnu-linux/uninstall.sh | 2 +- pombo.conf | 2 ++ pombo.py | 4 ++-- 4 files changed, 19 insertions(+), 12 deletions(-) mode change 100644 => 100755 gnu-linux/uninstall.sh diff --git a/gnu-linux/install.sh b/gnu-linux/install.sh index b3008e9..f20d879 100755 --- a/gnu-linux/install.sh +++ b/gnu-linux/install.sh @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/bin/sh # # Installation script for Pombo. # @@ -11,15 +11,19 @@ fi inst_dir=/usr/local/bin [ -d ${inst_dir} ] || inst_dir=/usr/local/sbin -src_dir="" -[ -f pombo.py ] || src_dir="../" +script=$(readlink -f "$0") +# Absolute path install.sh script is in +src_dir=$(dirname "$script") +# Absolute path of Pombo main dir (without trailing /) +src_dir=$(dirname "$src_dir") + echo "\nInstalling (verbose) ..." [ -f /etc/pombo.conf ] && mv -fv /etc/pombo.conf /etc/pombo.conf.$(date '+%s') -install -v ${src_dir}pombo.conf /etc +install -v ${src_dir}/pombo.conf /etc echo "« chmod 600 /etc/pombo.conf »" chmod 600 /etc/pombo.conf -install -v ${src_dir}pombo.py ${inst_dir}/pombo +install -v ${src_dir}/pombo.py ${inst_dir}/pombo echo "« chmod +x ${inst_dir}/pombo »" chmod +x ${inst_dir}/pombo @@ -43,12 +47,13 @@ echo "Done." echo "\nChecking dependancies ..." ok=1 -for package in python gpg ifconfig iwlist traceroute streamer; do + +for package in python gpg ifconfig iwlist traceroute streamer; do test=$(which ${package}) - [ $? != 0 ] && echo " ! ${package} needed but not installed." && ok=0 + [ $? != 0 ] && echo " ! ${test}.... ${package} needed but not installed." && ok=0 done -python check-imports.py -[ $? != 0 ] && ok=0 +echo "Shell script uses Python $(python --version)" +python ${src_dir}/tools/check-imports.py case ${ok} in 1) echo "Done." ;; *) echo "Please install necessary tools before continuing." ;; diff --git a/gnu-linux/uninstall.sh b/gnu-linux/uninstall.sh old mode 100644 new mode 100755 index 891eafe..e57bfeb --- a/gnu-linux/uninstall.sh +++ b/gnu-linux/uninstall.sh @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/bin/sh # # Uninstallation script for Pombo. # diff --git a/pombo.conf b/pombo.conf index fc0e877..ad1520f 100644 --- a/pombo.conf +++ b/pombo.conf @@ -131,6 +131,8 @@ screenshot=yes ; Take webcam shot? ; will be replaced by a filename, do not customize (required). ; [W] yes or no +; [L] /usr/bin/streamer -q -t 1 -r 2 -o +; [L] /usr/bin/streamer -q -t 1 -r 2 -j 100 -s 640x480 -o ; [L] /usr/bin/streamer -q -w 3 -o ; [L] /usr/bin/streamer -q -j 100 -w 3 -s 640x480 -o ; [L] /usr/bin/gst-launch -q v4l2src num_buffers=1 decimate=70 ! pngenc ! filesink location= diff --git a/pombo.py b/pombo.py index 6abaf32..d39ae00 100644 --- a/pombo.py +++ b/pombo.py @@ -699,9 +699,9 @@ def snapshot(self, current_ip): "-r", self.configuration["gpgkeyid"], "-o", - output, - "-e", output + ".gpg", + "-e", + output, ] )