-
Notifications
You must be signed in to change notification settings - Fork 128
/
create-image
executable file
·43 lines (39 loc) · 988 Bytes
/
create-image
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
#!/bin/bash
cd `dirname $0`
if [ "$1" == "" ]; then
VERSION=3
echo No version given, assuming Pi$VERSION
else
VERSION=$1
fi
BRDIR=`./brdir $VERSION`
echo "Building image from $BRDIR"
if [ "$2" != "" ]; then
echo "Using timestamp $2"
TS=$2
else
TS=`date +%Y%m%d`
fi
cd `dirname $0`
MYDIR=`pwd`
mkdir -p images
echo Copying $BRDIR/images/sdcard.img to images/hifiberryos-$TS-pi$VERSION.img
cp $BRDIR/images/sdcard.img images/hifiberryos-$TS-pi$VERSION.img
./fix-fs images/hifiberryos-$TS-pi$VERSION.img
pushd images
if [ -f hifiberryos-pi$VERSION.zip ]; then
rm hifiberryos-pi$VERSION.zip
fi
zip hifiberryos-pi$VERSION.zip hifiberryos-$TS-pi$VERSION.img
popd
TMPDIR=/tmp/$$
mkdir $TMPDIR
cp $BRDIR/images/zImage $BRDIR/images/rootfs.ext2 $TMPDIR
pushd $TMPDIR
pwd
ls
cp $MYDIR/scripts/updater.sh .
tar cvfz $MYDIR/images/updater-$TS-pi$VERSION.tar.gz updater.sh zImage rootfs.ext2
zip $MYDIR/images/updater-$TS-pi$VERSION.zip updater.sh zImage rootfs.ext2
popd
rm -rf $TMPDIR