mirror of https://github.com/CIRCL/Circlean
many small fixed to make it ready for an image
parent
38f934d91a
commit
fdba081e15
|
@ -1,20 +0,0 @@
|
||||||
Prerequisites
|
|
||||||
=============
|
|
||||||
|
|
||||||
Get the latest image: http://www.raspberrypi.org/downloads (the recommended one)
|
|
||||||
And write it on the SD Card:
|
|
||||||
dd bs=4M if=~/2013-02-09-wheezy-raspbian.img of=/dev/mmcblk0
|
|
||||||
|
|
||||||
Note: I had to unplug/replug the sd card in order to see the second partition.
|
|
||||||
|
|
||||||
On a debian/ubuntu host:
|
|
||||||
- http://burstcoding.blogspot.com/2012/12/qemu-user-mode-arm-for-raspbian-chroot.html (not tested)
|
|
||||||
On a gentoo host:
|
|
||||||
- app-emulation/qemu-user
|
|
||||||
|
|
||||||
Choot
|
|
||||||
=====
|
|
||||||
|
|
||||||
chroot
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
CHROOT_PATH='/mnt/arm_rPi'
|
||||||
|
|
||||||
|
if [ "$(id -u)" != "0" ]; then
|
||||||
|
echo "This script must be run as root" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# copy deb
|
||||||
|
cp deb/*.deb ${CHROOT_PATH}/
|
||||||
|
|
||||||
|
# prepare fs archive
|
||||||
|
tar -cvpzf backup.tar.gz -C fs/ .
|
||||||
|
tar -xzfv backup.tar.gz -C ${CHROOT_PATH}/
|
|
@ -5,3 +5,5 @@ useradd -m kitten
|
||||||
echo "Cmnd_Alias GROOMER_CMDS = /home/kitten/kitten_mount_src, \
|
echo "Cmnd_Alias GROOMER_CMDS = /home/kitten/kitten_mount_src, \
|
||||||
/home/kitten/kitten_mount_dst, /home/kitten/kitten_umount" >> /etc/sudoers
|
/home/kitten/kitten_mount_dst, /home/kitten/kitten_umount" >> /etc/sudoers
|
||||||
echo "kitten ALL=(ALL) NOPASSWD: GROOMER_CMDS" >> /etc/sudoers
|
echo "kitten ALL=(ALL) NOPASSWD: GROOMER_CMDS" >> /etc/sudoers
|
||||||
|
|
||||||
|
# /!\ REMOVE SUDO RIGHTS TO USER pi
|
|
@ -17,11 +17,9 @@ if [ "$_IP" ]; then
|
||||||
printf "My IP address is %s\n" "$_IP"
|
printf "My IP address is %s\n" "$_IP"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
||||||
|
|
||||||
if [ -e /dev/sda ]; then
|
if [ -e /dev/sda ]; then
|
||||||
if [ -e /dev/sdb ]; then
|
if [ -e /dev/sdb ]; then
|
||||||
/opt/groomer/groomer.sh
|
/opt/groomer/init.sh
|
||||||
/sbin/shutdown -h now
|
/sbin/shutdown -h now
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
|
@ -1,5 +1,5 @@
|
||||||
DEV_SRC='/dev/sdf'
|
DEV_SRC='/dev/sda'
|
||||||
DEV_DST='/dev/sdg1'
|
DEV_DST='/dev/sdb1'
|
||||||
# User allowed to do the following commands without password
|
# User allowed to do the following commands without password
|
||||||
USERNAME='kitten'
|
USERNAME='kitten'
|
||||||
HOME="/home/${USERNAME}"
|
HOME="/home/${USERNAME}"
|
|
@ -12,8 +12,7 @@ fi
|
||||||
|
|
||||||
clean(){
|
clean(){
|
||||||
echo Done, cleaning.
|
echo Done, cleaning.
|
||||||
# Only if running on a rPi
|
mount -o remount,rw /
|
||||||
# mount -o remount,rw /
|
|
||||||
${SYNC}
|
${SYNC}
|
||||||
# shutdown -h now
|
# shutdown -h now
|
||||||
}
|
}
|
||||||
|
@ -21,7 +20,7 @@ clean(){
|
||||||
trap clean EXIT TERM INT
|
trap clean EXIT TERM INT
|
||||||
|
|
||||||
# Remount the root filesystem in RO mode
|
# Remount the root filesystem in RO mode
|
||||||
# mount -o remount,ro /
|
mount -o remount,ro /
|
||||||
|
|
||||||
su ${USERNAME} -c ./groomer.sh
|
su ${USERNAME} -c ./groomer.sh
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# change locales to en_US.UTF-8
|
||||||
|
dpkg-reconfigure locales
|
||||||
|
|
||||||
|
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get dist-upgrade
|
apt-get dist-upgrade
|
||||||
apt-get autoremove
|
apt-get autoremove
|
||||||
apt-get install libreoffice
|
apt-get install libreoffice libfontforge1 p7zip-full
|
||||||
dpkg -i libpoppler28_0.20.5-3_armhf.deb libpoppler-private-dev_0.20.5-3_armhf.deb \
|
dpkg -i libpoppler28_0.20.5-3_armhf.deb pdf2htmlex_0.8-1~git201303011406r3bc73-0ubuntu1_armhf.deb
|
||||||
pdf2htmlex_0.8-1~git201303011406r3bc73-0ubuntu1_armhf.deb
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,18 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ "$(id -u)" != "0" ]; then
|
||||||
|
echo "This script must be run as root" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
ls /usr/bin/qemu*arm* > /dev/null 2>&1
|
||||||
|
if [ ! -e ${?} ]; then
|
||||||
|
echo "You need qemu user static binaries." 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
|
|
||||||
# If you use a partition...
|
# If you use a partition...
|
||||||
PARTITION_ROOTFS='/dev/mmcblk0p2'
|
PARTITION_ROOTFS='/dev/mmcblk0p2'
|
||||||
PARTITION_BOOT='/dev/mmcblk0p1'
|
PARTITION_BOOT='/dev/mmcblk0p1'
|
||||||
|
@ -46,9 +55,6 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# only needed at first chroot, but it does not hurt.
|
|
||||||
#resize2fs /dev/loop1
|
|
||||||
|
|
||||||
cp /usr/bin/qemu*arm* ${CHROOT_PATH}/usr/bin/
|
cp /usr/bin/qemu*arm* ${CHROOT_PATH}/usr/bin/
|
||||||
|
|
||||||
mount -o bind /dev ${CHROOT_PATH}/dev
|
mount -o bind /dev ${CHROOT_PATH}/dev
|
||||||
|
@ -59,6 +65,7 @@ mount -o bind /sys ${CHROOT_PATH}/sys
|
||||||
mount -o bind /tmp ${CHROOT_PATH}/tmp
|
mount -o bind /tmp ${CHROOT_PATH}/tmp
|
||||||
|
|
||||||
cp -pf /etc/resolv.conf ${CHROOT_PATH}/etc
|
cp -pf /etc/resolv.conf ${CHROOT_PATH}/etc
|
||||||
|
|
||||||
mv ${CHROOT_PATH}/etc/ld.so.preload ${CHROOT_PATH}/etc/ld.so.preload_bkp
|
mv ${CHROOT_PATH}/etc/ld.so.preload ${CHROOT_PATH}/etc/ld.so.preload_bkp
|
||||||
|
|
||||||
chroot ${CHROOT_PATH}
|
chroot ${CHROOT_PATH}
|
||||||
|
|
|
@ -1,26 +1,16 @@
|
||||||
dd if=/dev/zero bs=1024k count=2048 >> 2013-02-09-wheezy-raspbian.img
|
Add empty space to the image
|
||||||
|
============================
|
||||||
|
|
||||||
fdisk 2013-02-09-wheezy-raspbian.img
|
Add 2Gb
|
||||||
Command (m for help): m
|
|
||||||
Command action
|
|
||||||
a toggle a bootable flag
|
|
||||||
b edit bsd disklabel
|
|
||||||
c toggle the dos compatibility flag
|
|
||||||
d delete a partition
|
|
||||||
l list known partition types
|
|
||||||
m print this menu
|
|
||||||
n add a new partition
|
|
||||||
o create a new empty DOS partition table
|
|
||||||
p print the partition table
|
|
||||||
q quit without saving changes
|
|
||||||
s create a new empty Sun disklabel
|
|
||||||
t change a partition's system id
|
|
||||||
u change display/entry units
|
|
||||||
v verify the partition table
|
|
||||||
w write table to disk and exit
|
|
||||||
x extra functionality (experts only)
|
|
||||||
|
|
||||||
Command (m for help): p
|
> dd if=/dev/zero bs=1024k count=2048 >> 2013-02-09-wheezy-raspbian.img
|
||||||
|
|
||||||
|
Expend partition size
|
||||||
|
=====================
|
||||||
|
|
||||||
|
> fdisk 2013-02-09-wheezy-raspbian.img
|
||||||
|
|
||||||
|
Command (m for help): *p*
|
||||||
|
|
||||||
Disk 2013-02-09-wheezy-raspbian.img: 4087 MB, 4087349248 bytes
|
Disk 2013-02-09-wheezy-raspbian.img: 4087 MB, 4087349248 bytes
|
||||||
255 heads, 63 sectors/track, 496 cylinders, total 7983104 sectors
|
255 heads, 63 sectors/track, 496 cylinders, total 7983104 sectors
|
||||||
|
@ -31,24 +21,33 @@ Disk identifier: 0x00014d34
|
||||||
|
|
||||||
Device Boot Start End Blocks Id System
|
Device Boot Start End Blocks Id System
|
||||||
2013-02-09-wheezy-raspbian.img1 8192 122879 57344 c W95 FAT32 (LBA)
|
2013-02-09-wheezy-raspbian.img1 8192 122879 57344 c W95 FAT32 (LBA)
|
||||||
2013-02-09-wheezy-raspbian.img2 122880 3788799 1832960 83 Linux
|
2013-02-09-wheezy-raspbian.img2 *122880* 3788799 1832960 83 Linux
|
||||||
|
|
||||||
Command (m for help): d
|
Command (m for help): *d*
|
||||||
Partition number (1-4): 2
|
Partition number (1-4): *2*
|
||||||
|
|
||||||
Command (m for help): n
|
Command (m for help): *n*
|
||||||
Partition type:
|
Partition type:
|
||||||
p primary (1 primary, 0 extended, 3 free)
|
p primary (1 primary, 0 extended, 3 free)
|
||||||
e extended
|
e extended
|
||||||
Select (default p): p
|
Select (default p):
|
||||||
Partition number (1-4, default 2): 2
|
Partition number (1-4, default 2):
|
||||||
First sector (2048-7983103, default 2048): 122880
|
First sector (2048-7983103, default 2048): *122880*
|
||||||
Last sector, +sectors or +size{K,M,G} (122880-7983103, default 7983103):
|
Last sector, +sectors or +size{K,M,G} (122880-7983103, default 7983103):
|
||||||
Using default value 7983103
|
Using default value 7983103
|
||||||
|
|
||||||
Command (m for help): w
|
Command (m for help): *w*
|
||||||
The partition table has been altered!
|
The partition table has been altered!
|
||||||
|
|
||||||
Syncing disks.
|
Syncing disks.
|
||||||
|
|
||||||
|
Resize partition
|
||||||
|
================
|
||||||
|
|
||||||
|
> df | grep /mnt/arm
|
||||||
|
|
||||||
|
/dev/loop2 3927752 1955672 1794172 53% /mnt/arm_rPi
|
||||||
|
/dev/loop3 57288 18960 38328 34% /mnt/arm_rPi/boot
|
||||||
|
|
||||||
|
sudo resize2fs /dev/loop2
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue