forked from SharpAI/DeepCamera
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-on-mac.sh
executable file
·69 lines (62 loc) · 1.99 KB
/
run-on-mac.sh
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
set -x
#apt-get install avahi-daemon
IFNAME="eth0"
function gen_ro_serial()
{
UUIDFILE=./docker/workaipython/ro_serialno
MAC=''
if [ -e ${UUIDFILE} ];then
MAC=$(cat ${UUIDFILE})
if [ $MAC'x' == 'x' ] || [ ${#MAC} != 12 ];then
#不合法重新生成
MAC=''
else
#使用之前保存到文件的
echo ${MAC}
fi
fi
#get a uuid ######################################
if [ 'x'${MAC} = 'x' ]; then
MAC=$(ifconfig en1 | awk '/ether/{print $2}' | tr -d ':' )
if [ $MAC'x' == 'x' ] || [ ${#MAC} != 12 ];then
str1=$RANDOM
str2=$RANDOM
MAC='rd'$str1$str2
touch $UUIDFILE
echo $MAC > $UUIDFILE
else
touch $UUIDFILE
echo $MAC > $UUIDFILE
fi
fi
}
#YML=./docker-compose.yml
YML=./docker/docker-compose-x86.yml
if [ $1'x' == 'x' ];then
echo "usage: ./run-on-mac.sh start"
else
case $1 in
start ) echo "starting..."
gen_ro_serial
#docker-compose -f $YML stop
#docker-compose -f $YML up -d
docker-compose -f $YML stop
docker-compose -f $YML up
exit 0
;;
stop ) echo "stopping..."
docker-compose -f $YML stop
exit 0
;;
reload ) gen_ro_serial
echo "reloading..."
docker-compose -f $YML stop
docker-compose -f $YML up -d
exit 0
;;
* ) echo "usage: ./run-on-mac.sh start"
exit 1
esac
fi
exit 1