-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartup_script.sh
More file actions
36 lines (26 loc) · 988 Bytes
/
startup_script.sh
File metadata and controls
36 lines (26 loc) · 988 Bytes
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
#!/bin/sh
# EmergencyBox Auto-Start Script for DD-WRT
# This script should be added to DD-WRT via Web Interface:
# Administration → Commands → Startup → Save Startup
# Wait for system to fully boot
sleep 5
# Wait for USB devices to be detected
while [ ! -b /dev/sda2 ]; do sleep 1; done
# Create mount points
mkdir -p /tmp/mnt/sda1 /tmp/mnt/sda2
# Mount USB partitions (if not already mounted by automount)
mount /dev/sda2 /tmp/mnt/sda2 2>/dev/null
mount /dev/sda1 /tmp/mnt/sda1 2>/dev/null
# KEY FIX: Use mount --bind to overlay /opt directory
# This works even when root filesystem is read-only
mount --bind /tmp/mnt/sda2 /opt
# Create symlink for web files
mkdir -p /opt/share
ln -sfn /tmp/mnt/sda1/www /opt/share/www
# Start Entware services
/opt/etc/init.d/rc.unslung start
# Wait for services to initialize
sleep 3
# Start lighttpd web server
/opt/sbin/lighttpd -f /opt/etc/lighttpd/lighttpd.conf &
# EmergencyBox should now be accessible at http://192.168.1.1:8080