Added .7z compression as option. ZIP remain default

https://github.com/igorpecovnik/lib/issues/209
This commit is contained in:
Igor Pecovnik 2016-03-22 20:56:55 +01:00
parent 34a4d8f798
commit 979686839d
3 changed files with 22 additions and 6 deletions

View File

@ -494,15 +494,22 @@ create_image()
mv -f $CACHEDIR/$VERSION.raw $DEST/images/$VERSION.raw
display_alert "Done building" "$DEST/images/$VERSION.raw" "info"
else
display_alert "Signing and compressing" "$VERSION.zip" "info"
display_alert "Signing and compressing" "Please wait!" "info"
# stage: sign with PGP
if [[ -n $GPG_PASS ]]; then
echo $GPG_PASS | gpg --passphrase-fd 0 --armor --detach-sign --batch --yes $VERSION.raw
echo $GPG_PASS | gpg --passphrase-fd 0 --armor --detach-sign --batch --yes armbian.txt
fi
zip -FSq $DEST/images/$VERSION.zip $VERSION.raw* armbian.txt
if [[ $SEVENZIP == yes ]]; then
FILENAME=$DEST/images/$VERSION.7z
7za a -t7z -bd -m0=lzma2 -mx=4 -mfb=64 -md=32m -ms=on $FILENAME $VERSION.raw* armbian.txt >/dev/null 2>&1
else
FILENAME=$DEST/images/$VERSION.zip
zip -FSq $FILENAME $VERSION.raw* armbian.txt
fi
rm -f $VERSION.raw *.asc armbian.txt
display_alert "Done building" "$DEST/images/$VERSION.zip" "info"
FILESIZE=$(ls -l --b=M $FILENAME | cut -d " " -f5)
display_alert "Done building" "$FILENAME [$FILESIZE]" "info"
fi
} #############################################################################

View File

@ -292,14 +292,22 @@ if [[ $GPG_PASS != "" ]] ; then
echo $GPG_PASS | gpg --passphrase-fd 0 --armor --detach-sign --batch --yes imagewriter.exe
echo $GPG_PASS | gpg --passphrase-fd 0 --armor --detach-sign --batch --yes armbian.txt
fi
display_alert "Create and sign" "$VERSION.zip" "info"
display_alert "Signing and compressing" "Please wait!" "info"
mkdir -p $DEST/images
if [[ $COMPRESS_OUTPUTIMAGE == no ]]; then
rm -f *.asc imagewriter.* armbian.txt
mv *.raw $DEST/images/
else
zip -FSq $DEST/images/$VERSION.zip $VERSION.raw* armbian.txt imagewriter.*
rm -f $VERSION.raw *.asc imagewriter.* armbian.txt
if [[ $SEVENZIP == yes ]]; then
FILENAME=$DEST/images/$VERSION.7z
7za a -t7z -bd -m0=lzma2 -mx=4 -mfb=64 -md=32m -ms=on $FILENAME $VERSION.raw* armbian.txt imagewriter.* >/dev/null 2>&1
else
FILENAME=$DEST/images/$VERSION.zip
zip -FSq $FILENAME $VERSION.raw* armbian.txt imagewriter.*
fi
rm -f $VERSION.raw *.asc armbian.txt
FILESIZE=$(ls -l --b=M $FILENAME | cut -d " " -f5)
display_alert "Done building" "$FILENAME [$FILESIZE]" "info"
fi
}

View File

@ -68,6 +68,7 @@ Run the script
- **FORCE_USE_RAMDISK** (yes|no): overrides autodetect for using tmpfs in new debootstrap and image creation process. Takes effect only if `EXTENDED_DEBOOTSTRAP` is set to "yes"
- **FIXED_IMAGE_SIZE** (integer): create image file of this size (in megabytes) instead of minimal. Takes effect only if `EXTENDED_DEBOOTSTRAP` is set to "yes"
- **COMPRESS_OUTPUTIMAGE** (**yes**|no): create zip archive with image file and GPG signature for redistribution
- **SEVENZIP** (yes|**no**): create .7z archive with extreme compression ratio instead of .zip
- **ROOTFS_TYPE** (**ext4**|f2fs|btrfs|nfs|fel): create image with different root filesystems instead of default ext4. Requires setting FIXED_IMAGE_SIZE to actual size of your SD card for F2FS and BTRFS. Takes effect only if `EXTENDED_DEBOOTSTRAP` is set to "yes"
### Supplying options via command line parameters