-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathentrypoint.sh
More file actions
38 lines (32 loc) · 1.05 KB
/
Copy pathentrypoint.sh
File metadata and controls
38 lines (32 loc) · 1.05 KB
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/sh
# Create content directory if it doesn't exist, then fix permissions
mkdir -p /app/content
chown -R nonograph:nonograph /app/content
mkdir -p /var/lib/tor/hidden_service
chown -R debian-tor:debian-tor /var/lib/tor/hidden_service
chmod 700 /var/lib/tor/hidden_service
# Start Tor as debian-tor user
sudo -u debian-tor tor -f /etc/tor/torrc &
# Wait for the .onion hostname file to appear
echo "Waiting for Tor hidden service to be ready..."
ONION_FILE="/var/lib/tor/hidden_service/hostname"
i=0
while [ ! -f "$ONION_FILE" ]; do
sleep 1
i=$((i + 1))
if [ $i -ge 60 ]; then
echo "Tor hidden service did not start within 60 seconds, check logs above."
break
fi
done
if [ -f "$ONION_FILE" ]; then
ONION=$(cat "$ONION_FILE" 2>/dev/null)
echo ""
echo "========================================="
echo " Your .onion address:"
echo " http://$ONION"
echo "========================================="
echo ""
fi
# Drop to nonograph user and launch the app
exec su -s /bin/sh -c 'exec /app/nonograph' nonograph