% 18.1.2013 / mp
#############################################################################
# debian.img tiijoston luajindu
# PC: Debian Linux, Internet, ylikayttajan oigevuot, debootstrap
# Android: root, connectbot, sd-karti libo adb libo sshDroid, Hacker's keyboard
#############################################################################
# Etappu 1 PC:l ylikayttajanny
dd if=/dev/zero of=debian.img bs=1M count=2048
mkfs.ext2 -F debian.img
tune2fs -c0 debian.img #no automatic fsck
mkdir /mnt/debian
mount -t ext2 -o loop debian.img /mnt/debian
debootstrap --verbose --arch armel --foreign wheezy /mnt/debian http://ftp.debian.org/debian
umount /mnt/debian
# Siirra debian.img telefonah, 3 tabua:
# sd-kartil PC:spai telefonah
# libo adb push debian.img /sdcard/external_sd/debian/
# libo scp debian.img root@192.168.1.4:/sdcard/external_sd/debian/
##############################################################################
# Etappu 2 telefonas
# connectbot local su
echo "Avuan debian.img pakietan luvetteloh /data/local/debian"
mkdir /data/local/debian
busybox mknod /dev/block/loop254 b 7 254
busybox losetup /dev/block/loop254 /sdcard/external_sd/debian/debian.img
busybox mount -t ext2 /dev/block/loop254 /data/local/debian
echo "Chrooting into /data/local/debian"
busybox chroot /data/local/debian/ /bin/bash
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
export PS1='$USER@$HOSTNAME:${PWD-?} # '
echo "debootstrap loppussah"
sh /debootstrap/debootstrap --second-stage
/bin/bash
echo "nameserver 4.2.2.2" > /etc/resolv.conf
echo "127.0.0.1 localhost" > /etc/hosts
echo "deb http://ftp.debian.org/debian/ wheezy main contrib non-free" > /etc/apt/sources.list
echo "deb-src http://ftp.debian.org/debian/ wheezy main contrib non-free" >> /etc/apt/sources.list
apt-get update
apt-get install --no-install-recommends openssh-server sudo jed less psmisc deborphan locales 
dpkg-reconfigure locales
echo "Lizia kayttaitiijot"
echo "passwd root" #ylikayttajan peittosana
echo "adduser user" #toine kayttai user, pane peittosanakse hos debian
echo "adduser user sudo" #user voi ruadua ylikayttajan ruadoloi
echo "exit"
echo "Nygoi debian.img on valmis. Kayta debi komendol"
echo "to install software"
# exit libo jatka ohjelmien azendukseh
##############################################################################
# Etappu 3 telefonas. Ohjelmien liziandy Linuxas olles
apt-get install --no-install-recommends openbox xfonts-base tightvncserver
apt-get install --no-install-recommends obconf menu feh xvkbd tint2 lxterminal
apt-get install --no-install-recommends gpaint leafpad abiword gv
apt-get install --no-install-recommends openjdk-6-jdk djview4 kazehakase
apt-get install --no-install-recommends mplayer gnome-mplayer mozplugger
apt-get autoremove
apt-get clean
exit