Use more source checksums
[termux-packages] / packages / termux-api / termux-camera-photo
... / ...
CommitLineData
1#!/bin/sh
2set -e -u
3
4SCRIPTNAME=termux-camera-photo
5show_usage () {
6 echo "Usage: termux-camera-photo [-c camera-id] output-file"
7 echo "Take a photo and save it to a file in JPEG format."
8 echo " -c camera-id ID of the camera to use (see termux-camera-info), default: 0"
9 exit 0
10}
11
12
13PARAMS=""
14while getopts :hc: option
15do
16 case "$option" in
17 h) show_usage;;
18 c) PARAMS="--es camera $OPTARG";;
19 ?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
20 esac
21done
22shift $(($OPTIND-1))
23
24if [ $# = 0 ]; then echo "$SCRIPTNAME: missing file argument"; exit 1; fi
25if [ $# != 1 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi
26
27touch $1
28PARAMS="$PARAMS --es file `realpath $1`"
29
30@TERMUX_API@ CameraPhoto $PARAMS