Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable nfs mode, can run without sdcard #183

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions data/etc/scripts/01-network → bootstrap/S01-network.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/sh

source /etc/fang_hacks.cfg
source /media/mmcblk0p2/data/etc/profile

NETWORK_MODE=${NETWORK_MODE:-0}
DISABLE_CLOUD=${DISABLE_CLOUD:-0}
Expand Down Expand Up @@ -55,7 +54,7 @@ start()
kill_network

wpa_supplicant -B -i wlan0 \
-c /media/mmcblk0p2/data/etc/wpa_supplicant.conf \
-c ${CFG_WPA} \
-P /var/run/wpa_supplicant.pid 2>&1
rc=$?
if [ $rc -eq 0 ]; then
Expand All @@ -82,11 +81,11 @@ start()
if [ $? -ne 0 ]; then
echo "Failed to set IP $ap_addr"; return 1;
fi
hostapd -B -P /var/run/hostapd.pid /media/mmcblk0p2/data/etc/hostapd.conf 2>&1
hostapd -B -P /var/run/hostapd.pid ${CFG_AP} 2>&1
if [ $? -ne 0 ]; then
echo "Failed to start hostapd"; return 1;
fi
udhcpd -f /media//mmcblk0p2/data/etc/udhcpd.conf >>/tmp/hacks.log 2>&1 &
udhcpd -f ${CFG_DHCPD} >>/tmp/hacks.log 2>&1 &
if [ $? -ne 0 ]; then
echo "Failed to start udhcpd"; return 1;
fi
Expand Down Expand Up @@ -191,4 +190,4 @@ else
$1 "$@"
;;
esac
fi
fi
19 changes: 19 additions & 0 deletions bootstrap/S02-mount.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
source /etc/fang_hacks.cfg

start()
{
for p in $MOUNTS;do
mkdir -p $p
done
mount -a
}

status()
{
mount
}

case $1 in start|status)
$1 "$@"
;;
esac
8 changes: 7 additions & 1 deletion bootstrap/fang_hacks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ if [ "$DISABLE_CLOUD" -eq 0 ]; then
logmsg "Starting boa webserver..."
# Copy to /tmp as a workaround for weird boa error (can't open boa.conf)
cp /usr/boa/* /tmp
mkdir -p /tmp/cgi-bin
/tmp/boa >/dev/null 2>&1
fi

Expand All @@ -105,11 +106,16 @@ else
logmsg "Starting boa webserver..."
# Copy to /tmp as a workaround for weird boa error (can't open boa.conf)
cp /usr/boa/* /tmp
mkdir -p /tmp/www/cgi-bin
/tmp/boa >/dev/null 2>&1
fi

# Link cgi files again if available (/tmp is volatile)
CGI_FILES="/media/mmcblk0p1/bootstrap/www"
if [ -d "${HACKS_HOME}/www" ]; then
CGI_FILES="${HACKS_HOME}/www"
else
CGI_FILES=/media/mmcblk0p1/bootstrap/www
fi
if [ -d "$CGI_FILES" ]; then
for i in $CGI_FILES/*; do
if [ ! -e "/tmp/www/cgi-bin/$(basename $i)" ]; then
Expand Down
2 changes: 2 additions & 0 deletions bootstrap/www/action
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ apply()
apply_file "/media/mmcblk0p1/bootstrap/rcS" "/etc/init.d/rcS" 755
apply_file "/media/mmcblk0p1/bootstrap/fang_hacks.sh" "/etc/fang_hacks.sh" 755
apply_file "/media/mmcblk0p1/bootstrap/fang_hacks.cfg" "/etc/fang_hacks.cfg" 644
apply_file "/media/mmcblk0p1/bootstrap/S01-network.sh" "/etc/init.d/S01-network.sh" 755
apply_file "/media/mmcblk0p1/bootstrap/S02-mount.sh" "/etc/init.d/S02-mount.sh" 755

if [ -x "/etc/fang_hacks.sh" ]; then
echo "Running fang_hacks.sh...<br/>"
Expand Down
12 changes: 7 additions & 5 deletions bootstrap/www/scripts
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,18 @@ button, input[type=submit] { background-color: #ddeaff; }
<hr/>
EOF

SCRIPT_HOME="/media/mmcblk0p2/data/etc/scripts"
source "/media/mmcblk0p2/data/etc/profile" >/dev/null 2>&1
source /etc/fang_hacks.cfg
HACKS_HOME=${HACKS_HOME:-/media/mmcblk0p2/data}
SCRIPT_HOME="${HACKS_HOME}/etc/scripts"
source "${HACKS_HOME}/etc/profile" >/dev/null 2>&1
if [ -n "$F_script" ]; then
script="${F_script##*/}"
if [ -e "$SCRIPT_HOME/$script" ]; then
case "$F_cmd" in
start)
echo "Running script '$script'...<br/>"
echo "<pre>$($SCRIPT_HOME/$script 2>&1)</pre>"
;;
;;
disable)
echo "Disable script '$script'...<br/>"
chmod a-x "$SCRIPT_HOME/$script" 2>&1
Expand Down Expand Up @@ -80,7 +82,7 @@ else
if [ $? -eq 0 ]; then
if [ -n "$status" ]; then
bgcolor="green";
else
else
bgcolor="orange";
fi
else
Expand Down Expand Up @@ -127,4 +129,4 @@ cat << EOF
<hr/>
</body>
</html>
EOF
EOF