summaryrefslogtreecommitdiff
path: root/packaging/atrace-bootup.sh
blob: a9acea7fae8591aca6c77d37e5598b868bc789aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash

SCRIPT=`basename ${BASH_SOURCE[0]}`

#Help function
function HELP {
  echo -e \\n"Help documentation for ${SCRIPT}."\\n
  echo -e "Basic usage: $SCRIPT file.ext"\\n
  echo -e "-h  --Displays this help message. No further functions are performed."\\n
  exit 1
}

CONF="/etc/ttrace.conf"

SPACE=" "
COMMAND="atrace --async_start"
DEFTAGS=""

NUMARGS=$#
if [ $NUMARGS -eq 0 ]; then
  COMMAND=$COMMAND$SPACE$DEFTAGS
else
	shift $((OPTIND-1))  #This tells getopts to move on to the next argument.
	while [ $# -ne 0 ]; do
		PARAM=$1
		COMMAND=$COMMAND$SPACE$PARAM
		shift
	done
fi

echo "COMMAND is: $COMMAND"
echo "$COMMAND" > "$CONF"

sync
sleep 1
reboot

exit 0