From bdfefe139bfc2fdd26e753f3245f285129dbc580 Mon Sep 17 00:00:00 2001
From: Antonio Ospite <ao2@ao2.it>
Date: Sat, 24 Nov 2018 19:16:44 +0100
Subject: [PATCH] Make the shell scripts more standard compliant

Remove the bashism "source" and add a check before including the default
config file, because POSIX compliant shells would abort when a dot
script is not found.
---
 v4l2-settings-restore.sh | 7 +++----
 v4l2-settings-save.sh    | 7 +++----
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/v4l2-settings-restore.sh b/v4l2-settings-restore.sh
index bae3450..b255da8 100755
--- a/v4l2-settings-restore.sh
+++ b/v4l2-settings-restore.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # v4l2-settings-restore.sh - restore v4l2 device settings
 #
@@ -15,9 +15,8 @@
 [ "$DEBUG" = "true" ] && set -x
 set -e
 
-source /etc/default/v4l2-persistent-settings || :
-
-: "${SETTINGS_DIR:=/tmp}"
+SETTINGS_DIR="/tmp"
+[ -f /etc/default/v4l2-persistent-settings ] && . /etc/default/v4l2-persistent-settings
 
 SETTINGS_FILE="${SETTINGS_DIR}/${ID_V4L_PRODUCT}.conf"
 
diff --git a/v4l2-settings-save.sh b/v4l2-settings-save.sh
index 0c519d4..246290e 100755
--- a/v4l2-settings-save.sh
+++ b/v4l2-settings-save.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # v4l2-settings-save.sh - save v4l2 device settings
 #
@@ -17,9 +17,8 @@ set -e
 
 DEVNAME="$1"
 
-source /etc/default/v4l2-persistent-settings || :
-
-: "${SETTINGS_DIR:=/tmp}"
+SETTINGS_DIR="/tmp"
+[ -f /etc/default/v4l2-persistent-settings ] && . /etc/default/v4l2-persistent-settings
 
 : "${ID_V4L_PRODUCT:=$(v4l2-ctl -d "$DEVNAME" --info | grep "Card type" | cut -d ':' -f 2 | sed 's/^[[:space:]]//' | tr -d '\n')}"
 
-- 
2.1.4