#!/bin/bash dir=$PWD img="slitaz_arm.img" url="http://mirror.switch.ch/ftp/mirror/slitaz/arm/rpi/slitaz-rpi-base-20140329.tar.bz2" pkg_url="http://cook.slitaz.org/cross/arm/packages/" spk_version="$(wget $pkg_url -q -O-|grep spk|cut -d\" -f4 )" bz2="slitaz_arm.tar.bz2" mnt="mnt" tmp="slitaz-rpi-base-20140329" tmp2="tmp" img_size=400000 #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 echo "checking if ARM emulation is available" if [ ! -f /usr/bin/qemu-arm-static ] then apt-get install binfmt-support qemu qemu-user-static -y fi echo "Downloading Slitaz Arm" wget "$url" -O $bz2 tar xvjf $bz2 echo "Creating empty img file..." dd bs=512 count=$img_size if=/dev/zero of=$img mkfs.ext2 $img echo "Mounting IMG..." mkdir $mnt mount $img $mnt echo "Moving File System to IMG..." cp -pfr $tmp/rootfs/* $mnt echo "Added DNS to /etc/resolv.conf" echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf echo "Adding ARM Emulation for x86..." cp /usr/bin/qemu-arm-static $mnt/usr/bin echo "Updating SPK Package Manager..." mkdir $tmp2 cd $tmp2 wget ${pkg_url}${spk_version} -O spk.tazpkg cat spk.tazpkg|cpio -i -H newc -d unlzma fs.cpio.lzma cat fs.cpio|cpio -i -H newc -d cp -pvfr ./fs/* ../$mnt cd $dir clear echo """ Welcome to your ARM system. Make Changes that you want. When you exit the IMG file can be copied to your phone. Package Manager is spk. examples: spk-up spk --add nmap """ chroot $mnt sh echo "Clean Up..." umount $mnt rm -fr $tmp $tmp2 $mnt rm $bz2 echo """ ARM IMG of Slitaz has been created. Please place $img on your Phone or Tablet for Chrooting. Mount with a command like this: busybox mount -o loop slitaz_img.img slitaz Other useful info: export PATH=$PATH:/usr/bin:/bin busybox mount --bind /dev slitaz/dev mount -t devpts devpts slitaz/dev/pts mount -t proc proc slitaz/proc mount -t sysfs sysfs slitaz/sys """