Skip to content

Instantly share code, notes, and snippets.

@zeroxia
Created May 12, 2015 13:02
Show Gist options
  • Save zeroxia/f5c111f892c82af386be to your computer and use it in GitHub Desktop.
Save zeroxia/f5c111f892c82af386be to your computer and use it in GitHub Desktop.
rcS file and my tweaking files for PogoPlug Series 4 box. The "rcS2" scripts aim to start the Samba service installed as optware on the mmcblkp0 device (the SD card slot).
#-*- 1. /etc/init.d/rcS changes -*-
#! /bin/sh
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devpts none /dev/pts
mount -t tmpfs none /tmp
mkdir /tmp/var
. /etc/cefs.conf
if /usr/local/cloudengines/bin/blparam | grep cedebug > /tmp/cedebug; then
. /tmp/cedebug
fi
rm -f /tmp/cedebug
echo "/tmp/core_%e_%t" > /proc/sys/kernel/core_pattern
hostname arwen
ifconfig lo 127.0.0.1
ifconfig eth0 up
# NB: Needs to start with "udhcpc -b " so hbplug_netmgr can find in /proc
udhcpc -b -i eth0 -H `hostname`
mount -t usbfs none /proc/bus/usb
/etc/init.d/db
if [ "x$cedebug" != "x" ]; then
telnetd
/usr/sbin/dropbear
fi
/etc/init.d/hbmgr.sh start
### zerox
sleep 2
nohup sh /etc/init.d/rcS2 >/tmp/rcS2.log &
#-*- /etc/init.d/rcS2 -*-
#!/bin/sh
sleep 1
MY_RCS='/opt/etc/init.d/rcS2'
CNT=0
while [ ! -f "$MY_RCS" ]; do
sleep 2
CNT=$((CNT + 1))
if [ $CNT -ge 10 ]; then
echo "Waiting for rcS2 timeout"
exit 1
fi
done
echo "rcS2 starting..."
sh "$MY_RCS"
#-*- /opt/etc/init.d/rcS2 -*-
#!/bin/sh
sleep 1
# /tmp/.cemnt/mmcblk0p1 on /tmp/.cemnt/mnt_mmcblk0p1 type ext3 (rw,nosuid,nodev,noatime,errors=continue,data=writeback)
echo "Check mmcblk0p1 mount:"
if ! mount | grep -E '(\(|,)noexec(,|\))' >/dev/null; then
echo "No such mount, quit"
exit 0
fi
if mount -o remount,exec /tmp/.cemnt/mmcblk0p1; then
echo "Remount as exec success"
else
echo "Remount as exec failed"
exit 1
fi
echo "Starting samba..."
/opt/etc/init.d/S08samba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment