Skip to content

Commit

Permalink
Fix helptext function of scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
petergeneric committed Mar 31, 2020
1 parent 658318f commit 4f8ec83
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
23 changes: 17 additions & 6 deletions scripts/prepare.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
#!/bin/bash

UBVINFO=/usr/share/unifi-protect/app/node_modules/.bin/ubnt_ubvinfo
if [ -z "$UBVINFO" ] ; then
UBVINFO=/usr/share/unifi-protect/app/node_modules/.bin/ubnt_ubvinfo
fi

function helptext() {
echo "Usage: $0 *_0_rotating_*.ubv"
}

if [ -z "$1" ] ; then
helptext

exit 1
elif [ "$1" == "--help" ] ; then
helptext

if [ [ -z "$1" ] -or [ "$1" = "--help" ] ] ; then
echo "Usage: $0 *_0_rotating_*.ubv" >&2
exit 2
exit 0
fi


while [ -n "$1" ]
do
$UBVINFO -t 7 -P -f "$1"
$UBVINFO -t 7 -P -f "$1" > "$1.txt"
if [ "$?" != "0" ] ; then
echo "ubnt_ubvinfo invocation failed!" >&2
exit 1
fi

shift
done
done
16 changes: 11 additions & 5 deletions scripts/remux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@

NATIVE_CMD=./Remux

if [ [ -z "$1" ] -or [ "$1" = "--help" ] ] ; then
echo "Usage: $0 [file1] [file2] [etc]" >&2
exit 2
fi
function helptext() {
echo "Usage: $0 [file1] [file2] [etc]"
}

if [ -z "$1" ] ; then
helptext
exit 1
elif [ "$1" = "--help" ] ; then
helptext
exit 0
fi

while [ -n "$1" ]
do
Expand All @@ -29,4 +35,4 @@ do
echo "Extraction of primitive stream failed for ${ubv}." >&2
exit 1
fi
done
done

0 comments on commit 4f8ec83

Please sign in to comment.