#!/bin/sh
# /etc/init.d/local.sh - Local startup commands.
#
# All commands here will be executed at boot time.
#
. /etc/init.d/rc.functions
echo "Starting local startup commands... "
#!/bin/sh
#are we root?
#if test $(id -u) != 0 ; then
# echo -e "\nThis program requires being run as root.\n"
# exit 0
#fi
#i check for the standard location of rootfs.gz or
#i mount my usbkey by label - put your label instead of mine if you
#have unusual setup
if [ ! -e /rootfs ]; then
LABEL=CH32
USER=`ls /home/`
if [ -e /home/$USER/boot/rootfs.gz ]; then
MOUNT_POINT=/home/$USER
else
MOUNT_POINT=/media/$LABEL
if [ ! -e $MOUNT_POINT ]; then mkdir $MOUNT_POINT; fi
if [ ! -e $MOUNT_POINT/boot/rootfs.gz ]; then mount /dev/disk/by-label/$LABEL $MOUNT_POINT; fi
fi
#unzlma rootfs.gz
cp $MOUNT_POINT/boot/rootfs.gz /
mv /rootfs.gz /rootfs.lzma
unlzma /rootfs.lzma
fi
#remove previous missing.txt
if [ -e /missing.txt ]; then
rm /missing.txt
fi
cd /
(
IFS=$'\n'
cpio -t < rootfs | grep -v /dev | sed '$d' > list.txt
for i in `cat list.txt`
do
if [ ! -e $i ]; then
echo $i >> missing.txt
fi
done
#restore missings from missing.txt
for i in `cat missing.txt`
do
if [ ! -e $i ]; then
cpio -i < rootfs $i
fi
done
)
rm /rootfs
rm /list.txt
It looks like you're new here. If you want to get involved, click one of these buttons!