forked from CIRCL/Circlean
-
Notifications
You must be signed in to change notification settings - Fork 1
/
copy_to_final.sh
executable file
·52 lines (37 loc) · 1.22 KB
/
copy_to_final.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# To make debugging easier
echo "KittenGroomer: in copy_to_final.sh" 1>&2
set -e
set -x
if [ -z "$1" ]; then
echo "Path to the mounted image needed."
exit
fi
CHROOT_PATH=${1}
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_filecheck/ .
tar -xzf backup.tar.gz -C ${CHROOT_PATH}/
chown root:root ${CHROOT_PATH}/etc/sudoers
if [ -f deb/led ]; then
cp deb/led ${CHROOT_PATH}/usr/sbin/led
fi
cp -rf midi ${CHROOT_PATH}/opt/
# 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
#e2fsck -f /dev/loop0
#resize2fs /dev/loop0
#losetup -d /dev/loop0
#sudo dd bs=4M if=FINAL_2013-09-10-wheezy-raspbian.img of=/dev/sdd
# /!\ 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
# not lose the data).
# See resize_img.md
# It is also a good idea to run raspi-config once and enable the console login (allow debugging)
# To make debugging easier
echo "KittenGroomer: done with copy_to_final.sh" 1>&2