-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
67 lines (53 loc) · 1.5 KB
/
entrypoint.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
#!/bin/bash
set -e
# Set hostname default value
HOSTNAME=${HOSTNAME:-"nfs-smb-tailscale-alpine"}
# Set the container hostname
hostname $HOSTNAME
# Check if TAILSCALE_AUTH_KEY is provided
if [[ -z "${TAILSCALE_AUTH_KEY}" ]]; then
echo "TAILSCALE_AUTH_KEY environment variable is required."
exit 1
fi
# Start the NFS server
# Check if the NFS service is already running or starting
# NFS_STATUS=$(rc-service nfs status)
# if [[ $NFS_STATUS == *"stopped"* ]]; then
# # Start the NFS server
# rc-service nfs start
# else
# echo "NFS service is already running or starting."
# fi
# # Start the Samba server
# rc-service samba start
# # Enable Samba server at boot
# rc-update add samba default
# Start the NFS server
# echo "Starting NFS server..."
# /usr/sbin/rpcbind
# /usr/sbin/rpc.nfsd
# /usr/sbin/exportfs -r
# Start the Samba server
echo "Starting Samba server..."
/usr/sbin/nmbd -D
/usr/sbin/smbd -D
# Authenticate and start
# Check if NFS mount is working
# echo "Checking NFS mount status..."
# sleep 3
# SHOWMOUNT_OUTPUT=$(showmount -e 127.0.0.1)
# if [[ $SHOWMOUNT_OUTPUT == *"/exports"* ]]; then
# echo "NFS mount is working. Available exports:"
# echo "$SHOWMOUNT_OUTPUT"
# else
# echo "NFS mount is not working. Exiting."
# exit 1
# fi
# Start tailscaled in the background
echo "Starting tailscaled..."
tailscaled > /dev/null 2>&1 &
sleep 5
# Authenticate and start Tailscale
tailscale up --hostname=$HOSTNAME --authkey $TAILSCALE_AUTH_KEY
# Keep the container running
tail -f /dev/null