CCCPaste

Core File System image of TinyCore

#!/bin/bash

img=tinycore.img
tmp=tiny
mnt=mnt

#check if root user
if [[ $EUID -ne 0 ]]; then
  echo "You must be a root user"
  echo "Trying to restart script as sudo"
  sudo $0
  exit 
fi

mkdir $tmp
mkdir $mnt
cd $tmp

wget "http://tinycorelinux.net/5.x/armv7/Allwinner-A10/uCore"
dd if=uCore of=tiny.gz bs=1 skip=64 
zcat tiny.gz|cpio -i -H newc -d

rm tiny.gz uCore
cd ../
dd bs=512 count=500000 if=/dev/zero of=$img
mkfs.ext2 $img
mount -o loop $img $mnt
cp -pfr $tmp/* $mnt/ 

umount $mnt
rm -fr $tmp $mnt