-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathcompress_hampi_image.sh
executable file
·36 lines (27 loc) · 1.29 KB
/
compress_hampi_image.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
#!/bin/bash
echo -n "HamPi Packaging started at: "
start_time=`date`
echo $start_time
# Compute the seconds since epoch for start date
t1=`date --date="$start_time" +%s`
VERSION=3.0
# Compress image using XZ format
pxz "HamPi v${VERSION} by W3DJS/HamPi_v${VERSION}.img"
# Generate SHA256SUM
sha256sum "HamPi v${VERSION} by W3DJS/HamPi_v${VERSION}.img.xz" > "HamPi v${VERSION} by W3DJS/HamPi_v${VERSION}.img.xz.sha256sum"
# Create archive using smaller xz format:
result=`nice -n 19 tar --dereference \
-cvf "HamPi_v${VERSION}.tar" "HamPi v${VERSION} by W3DJS"`
# Display status
if (( $result == 0 )); then
espeak -s 150 -v en-us "Ham Pie image compression successful!" 2> /dev/null &
notify-send -i /usr/share/icons/Adwaita/scalable/status/checkbox-checked-symbolic.svg -t 60000 "Ham Pi" "Image compression successful" &
else
espeak -s 150 -v en-us "Ham Pie image compression unsuccessful!" 2> /dev/null &
notify-send -i /usr/share/icons/Adwaita/scalable/status/checkbox-checked-symbolic.svg -t 60000 "Ham Pi" "Image compression unsuccessful" &
fi
# Compute the seconds since epoch for end date
end_time=`date`
t2=`date --date="$end_time" +%s`
let "diff_time=$t2-$t1"
printf "Total time for HamPi Packaging: %02d:%02d:%02d\n" $((diff_time/3600)) $((diff_time%3600/60)) $((diff_time % 60))