forked from morfic/Samsung-logo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
createLogos.sh
executable file
·84 lines (80 loc) · 1.39 KB
/
createLogos.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
#
# createBootLogo.sh
#
# for use with morfic's Samsung-logo binary
# https://github.com/morfic/Samsung-logo/
#
# 2011 nubecoder
# http://www.nubecoder.com/
#
#
# g++ -o makelogo makelogo.cpp > /dev/null 2>&1
# ./makelogo > boot_logo.h
# cat boot_logo.h > logo_rgb24_wvga_portrait_custom.h
# cat charge_logo.h >> logo_rgb24_wvga_portrait_custom.h
#defines
DST_FILE="logo_rgb24_wvga_portrait_custom.h"
BOOT_LOGO="custom_boot_logo.h"
CHARGE_LOGO="charge_logo.h"
BOOT_BINARY="makebootlogo"
#functions
SPACER()
{
echo "*"
}
START_SCRIPT()
{
TIME_START=$(date +%s)
SPACER
}
SHOW_COMPLETED()
{
SPACER
echo "Script completed."
TIME_END=$(date +%s)
echo "Total time: $(($TIME_END - $TIME_START)) seconds."
SPACER
exit
}
BUILD_BINARY()
{
echo "Building $1 binary..."
# remove old files
rm -f $1
# build binary
local RESULT=$(g++ -o $1 $1.cpp 2>&1 >/dev/null)
# make binary executable
chmod +x $1
}
CREATE_LOGO()
{
echo "Creating $1..."
# remove old files
rm -f $1
# generate usable data
./$2 > $1
}
CREATE_DST_FILE()
{
echo "Creating $DST_FILE..."
# remove old files
rm -f $DST_FILE
# output to file
cat $1 > $DST_FILE
cat $2 >> $DST_FILE
}
CLEANUP()
{
echo "Cleaning up files..."
# remove files
rm -f $BOOT_LOGO
rm -f $BOOT_BINARY
}
#main
START_SCRIPT
BUILD_BINARY "$BOOT_BINARY"
CREATE_LOGO "$BOOT_LOGO" "$BOOT_BINARY"
CREATE_DST_FILE "$BOOT_LOGO" "$CHARGE_LOGO"
CLEANUP
SHOW_COMPLETED