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

Persist changes after reboot without sdcard #24

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
77 changes: 50 additions & 27 deletions sdcard/debug_cmd.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,53 @@
#!/bin/sh
#

cp /mnt/group /etc/group

# install updated version of busybox
cp /bin/busybox /bin/busybox-orig
cp /mnt/busybox-armv6l /bin/busybox
/bin/busybox --install -s

# setup and install dropbear ssh server
cp /mnt/dropbearmulti /bin/dropbearmulti
mkdir /etc/dropbear
cp /mnt/dropbear_ecdsa_host_key /etc/dropbear/dropbear_ecdsa_host_key
/bin/dropbearmulti dropbear

# update hosts file to prevent communication
cp /mnt/hosts.new /etc/hosts

# update the time
ntpd -q -p uk.pool.ntp.org

# wifi creds - currently doesn't work
#cp /mnt/wpa_supplicant.conf /home/wpa_supplicant.conf

# update wifi creds - currently doesn't work
#(sleep 20 && /mnt/mmc01/0/goke_p2pcam_param --wifissid=SSID --wifipass=WIFIPASSKEY ) &

# turn off high pitched noise
(sleep 20 && /mnt/mmc01/0/goke_volume -s 0 ) &
DIR="$(dirname "$0")"

if [ $DIR = /home/sdcard ]; then
cp "$DIR"/group /etc/group

# install updated version of busybox
cp /bin/busybox /bin/busybox-orig
cp "$DIR"/busybox-armv6l /bin/busybox
/bin/busybox --install -s

# setup and install dropbear ssh server
cp "$DIR"/dropbearmulti /bin/dropbearmulti
mkdir /etc/dropbear
cp "$DIR"/dropbear_ecdsa_host_key /etc/dropbear/dropbear_ecdsa_host_key
/bin/dropbearmulti dropbear

# update hosts file to prevent communication
cp "$DIR"/hosts.new /etc/hosts

# update the time
ntpd -q -p uk.pool.ntp.org

# wifi creds - currently doesn't work
#cp "$DIR"/wpa_supplicant.conf /home/wpa_supplicant.conf

# update wifi creds - currently doesn't work
#(sleep 20 && "$DIR"/goke_p2pcam_param --wifissid=SSID --wifipass=WIFIPASSKEY ) &

# turn off high pitched noise
(sleep 20 && "$DIR"/goke_volume -s 0 ) &
else
# make folder for storing files
# and backup original start.sh script
if [ ! -d /home/sdcard ]; then
mkdir /home/sdcard
cp /home/start.sh /home/sdcard/start_orig.sh
fi

# copy files over
cp "$DIR"/* /home/sdcard/

# Patch start.sh script to look in /home/sdcard/
"$DIR"/busybox-armv6l sed '\;/mnt/debug_cmd\.sh$;a\
elif [ -f "/home/sdcard/debug_cmd.sh" ]; then\
/home/sdcard/debug_cmd.sh' \
/home/sdcard/start_orig.sh > /home/start.sh

# call us again from the new location
exec /home/sdcard/debug_cmd.sh
fi