Skip to content

Commit 8ff3c78

Browse files
vers4cedogi
authored andcommitted
streamline autorunonce (fixes #481) (#480)
1 parent 021f7bd commit 8ff3c78

File tree

1 file changed

+43
-19
lines changed

1 file changed

+43
-19
lines changed

autorunonce

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,63 @@
11
#!/bin/bash
22

3+
#Local variables
4+
configtor="false"
5+
configdocker="true"
6+
updateplanet="false"
7+
38
treehouses rename treehouses
49
treehouses expandfs
510
treehouses button bluetooth
611

12+
#Uncomment the appropriate line for your connection
13+
714
#treehouses wifi <wifiname> [password]
815
#treehouses ap internet <hotspotname> [password]
916
treehouses ap internet treehouses
1017
#treehouses ap local <hotspotname> [password]
1118
#treehouses bridge <wifiname> <hotspotname> [wifipassword] [hotspotpassword]
1219

13-
#have internet and wanna latest planet? - please uncomment
14-
#docker pull treehouses/planet:latest
15-
#docker pull treehouses/planet:db-init
16-
#docker tag treehouses/planet:latest treehouses/planet:local
17-
#docker tag treehouses/planet:db-init treehouses/planet:db-init-local
20+
# Start tor service
21+
if [ $configtor = "true" ]; then
22+
treehouses tor add 22
23+
sleep 10
24+
sync
25+
treehouses tor start
26+
treehouses tor notice on
27+
sync
28+
sleep 10
29+
fi
1830

19-
{
20-
echo "#!/bin/sh"
21-
echo
22-
echo "sleep 1"
23-
echo
24-
echo "if [ -f /srv/planet/pwd/credentials.yml ]; then"
25-
echo " docker-compose -f /srv/planet/planet.yml -f /srv/planet/volumes.yml -f /srv/planet/pwd/credentials.yml -p planet up -d"
26-
echo "else"
27-
echo " docker-compose -f /srv/planet/planet.yml -f /srv/planet/volumes.yml -p planet up -d"
28-
echo "fi"
29-
} > /boot/autorun
31+
# Update planet if there is an internet connection
32+
if [ $updateplanet = "true" ]; then
33+
docker pull treehouses/planet:latest
34+
docker pull treehouses/planet:db-init
35+
docker tag treehouses/planet:latest treehouses/planet:local
36+
docker tag treehouses/planet:db-init treehouses/planet:db-init-local
37+
fi
3038

31-
mv /srv/tenalp /srv/planet
39+
# Starts docker container
40+
if [ $configdocker = "true" ]; then
41+
{
42+
echo "#!/bin/sh"
43+
echo
44+
echo "sleep 1"
45+
echo
46+
echo "if [ -f /srv/planet/pwd/credentials.yml ]; then"
47+
echo " docker-compose -f /srv/planet/planet.yml -f /srv/planet/volumes.yml -f /srv/planet/pwd/credentials.yml -p planet up -d"
48+
echo "else"
49+
echo " docker-compose -f /srv/planet/planet.yml -f /srv/planet/volumes.yml -p planet up -d"
50+
echo "fi"
51+
} > /boot/autorun
3252

33-
sync;sync;sync
53+
mv /srv/tenalp /srv/planet
3454

35-
docker-compose -f /srv/planet/planet.yml -f /srv/planet/volumes.yml -p planet up -d
55+
sync;sync;sync
56+
57+
docker-compose -f /srv/planet/planet.yml -f /srv/planet/volumes.yml -p planet up -d
58+
fi
3659

60+
# Reset if RPiZero or RPi3A
3761
case "$(treehouses detectrpi)" in
3862
RPIZW|RPI3A+)
3963
treehouses bootoption console

0 commit comments

Comments
 (0)