aboutsummaryrefslogtreecommitdiffstats
path: root/images/make_zip.sh
blob: 40ba61df557c2b7e7e410e61a8ea2488632a152f (plain)
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
#!/bin/bash
# Automatically run the make-zip-file process
# Check we're in the right directory and all is set:
if [ ! -e 'make_zip.sh' ]; then
    echo '[ERROR] Are you running this from the images/ directory?'
    exit 1
fi
if [ ! -e 'images' ]; then
    echo 'images subdirectory does not exist. Please create it and put all the images you want to package in there.'
    exit 1
fi

# Remove cruft before proceeding:
TAGFILES=`ls images/*.tag 2>/dev/null`
if [ -n "$TAGFILES" ]; then
	rm $TAGFILES
fi

# Copy LICENSE file
cp ../host/LICENSE images/

ARCHIVE_SUFFIX=$1
ARCHIVE_NAME="uhd-images_${ARCHIVE_SUFFIX}"
echo "Creating images archive: ${ARCHIVE_NAME}"

cp -r images $ARCHIVE_NAME

# Now zip 'em up:
echo "Creating ZIP archive..."
zip -r $ARCHIVE_NAME.zip $ARCHIVE_NAME
echo "Creating tar.gz archive..."
tar zcvf $ARCHIVE_NAME.tar.gz $ARCHIVE_NAME
echo "Creating tar.xz archive..."
tar Jcvf $ARCHIVE_NAME.tar.xz $ARCHIVE_NAME
ALL_ARCHIVES=`ls $ARCHIVE_NAME.*`
sha256sum $ALL_ARCHIVES > $ARCHIVE_NAME.sha256
md5sum $ALL_ARCHIVES > $ARCHIVE_NAME.md5

# Clean up archive directory
rm -r $ARCHIVE_NAME