2013-03-28 15:28:27 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-10-09 18:22:55 +02:00
|
|
|
# To make debugging easier
|
|
|
|
echo "KittenGroomer: in copy_to_final.sh" 1>&2
|
|
|
|
|
|
|
|
|
2013-10-09 17:33:54 +02:00
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
2014-03-27 00:02:48 +01:00
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "Path to the mounted image needed."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
CHROOT_PATH=${1}
|
2013-03-28 15:28:27 +01:00
|
|
|
|
|
|
|
if [ "$(id -u)" != "0" ]; then
|
|
|
|
echo "This script must be run as root" 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# copy deb
|
2013-05-16 11:18:05 +02:00
|
|
|
#cp deb/*.deb ${CHROOT_PATH}/
|
2013-03-28 15:28:27 +01:00
|
|
|
|
|
|
|
# prepare fs archive
|
2015-11-06 17:40:33 +01:00
|
|
|
tar -cvpzf backup.tar.gz -C fs_filecheck/ .
|
2013-05-16 11:18:05 +02:00
|
|
|
tar -xzf backup.tar.gz -C ${CHROOT_PATH}/
|
2013-12-09 14:47:03 +01:00
|
|
|
chown root:root ${CHROOT_PATH}/etc/sudoers
|
2014-10-05 17:38:48 +02:00
|
|
|
if [ -f deb/led ]; then
|
|
|
|
cp deb/led ${CHROOT_PATH}/usr/sbin/led
|
|
|
|
fi
|
2013-10-09 17:33:54 +02:00
|
|
|
cp -rf midi ${CHROOT_PATH}/opt/
|
2013-03-28 18:04:29 +01:00
|
|
|
|
2013-09-18 15:38:17 +02:00
|
|
|
# needed just once, make sure the size of the partition is correct
|
|
|
|
#losetup -o $((122880 * 512)) /dev/loop0 FINAL_2013-09-10-wheezy-raspbian.img
|
2013-10-09 17:33:54 +02:00
|
|
|
#e2fsck -f /dev/loop0
|
|
|
|
#resize2fs /dev/loop0
|
2013-09-18 15:38:17 +02:00
|
|
|
#losetup -d /dev/loop0
|
2013-07-01 17:09:46 +02:00
|
|
|
|
2013-09-18 15:38:17 +02:00
|
|
|
#sudo dd bs=4M if=FINAL_2013-09-10-wheezy-raspbian.img of=/dev/sdd
|
2013-03-28 18:04:29 +01:00
|
|
|
|
2013-05-17 17:22:33 +02:00
|
|
|
# /!\ always try to mount the root partition on the SD, it is usually broken.
|
|
|
|
# if it is, use fdisk to remove the second partition and recreate it (you will
|
2013-05-25 00:33:58 +02:00
|
|
|
# not lose the data).
|
|
|
|
# See resize_img.md
|
2013-10-09 17:33:54 +02:00
|
|
|
|
|
|
|
|
|
|
|
# It is also a good idea to run raspi-config once and enable the console login (allow debugging)
|
2015-10-09 18:22:55 +02:00
|
|
|
|
|
|
|
# To make debugging easier
|
|
|
|
echo "KittenGroomer: done with copy_to_final.sh" 1>&2
|
|
|
|
|