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..1ddb860 100644 --- a/pombo.py +++ b/pombo.py @@ -629,8 +629,8 @@ def snapshot_sendto_server(self, filename, data): # Send to the webserver (HTTP POST). parameters = {"filename": filename, "filedata": filedata, "token": authtoken} + txt = "Sending file (%s) to %s" for distant in self.configuration["server_url"].split("|"): - txt = "Sending file (%s) to %s" self.log.info(txt, sizeof_fmt(len(filedata)), urlsplit(distant).netloc) self.request_url(distant, "post", parameters) @@ -699,9 +699,9 @@ def snapshot(self, current_ip): "-r", self.configuration["gpgkeyid"], "-o", - output, - "-e", output + ".gpg", + "-e", + output, ] ) @@ -842,13 +842,15 @@ def webcamshot(self, filename): ) cmd = self.configuration["camshot"].replace("", filepath) self.runprocess(cmd, useshell=True) - if os.path.isfile(filepath): - if self.configuration["camshot_filetype"] == "ppm": - full_path_ = os.path.join(temp, filename) - new_path_ = "{}_webcam.jpg".format(full_path_) - self.runprocess(["/usr/bin/convert", filepath, new_path_]) - os.unlink(filepath) - filepath = new_path_ + if ( + os.path.isfile(filepath) + and self.configuration["camshot_filetype"] == "ppm" + ): + full_path_ = os.path.join(temp, filename) + new_path_ = "{}_webcam.jpg".format(full_path_) + self.runprocess(["/usr/bin/convert", filepath, new_path_]) + os.unlink(filepath) + filepath = new_path_ if not os.path.isfile(filepath): return None