-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdata_update.sh
executable file
·68 lines (61 loc) · 1.88 KB
/
data_update.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
#!/bin/sh
pass_enc="P&39i72sUyuIaPQi%Ub6Q&eT%deFD#7QWAgi7NavL9u$g29LFsIibpS*s^mVDbE4n4oXV5N8s2ZfaywfV4&Irp5rCan3i8am&G6a8IpsGs&PZM5yJuYxbvde$A%qH75o"
cat <<'EOF' >./data
#!/bin/sh
## Files
nvsimple_file()
{
cat <<'EOF'
EOF
cat ./bin/nvsimple | gzip -c | openssl aes-128-cbc -a -salt -k "$pass_enc" >>./data && echo "EOF" >>./data
echo "}" >>./data
echo "" >>./data
cat <<'EOF' >>./data
cfe_clean_bin()
{
cat <<'EOF'
EOF
cat ./bin/clean.bin | gzip -c | openssl aes-128-cbc -a -salt -k "$pass_enc" >>./data && echo "EOF" >>./data
echo "}" >>./data
echo "" >>./data
cat <<'EOF' >>./data
mtd_write_file()
{
cat <<'EOF'
EOF
cat ./bin/mtd-write | gzip -c | openssl aes-128-cbc -a -salt -k "$pass_enc" >>./data && echo "EOF" >>./data
echo "}" >>./data
echo "" >>./data
cat <<'EOF' >>./data
daemon_file()
{
cat <<'EOF'
EOF
cat ./bin/txhelper | gzip -c | openssl aes-128-cbc -a -salt -k "$pass_enc" >>./data && echo "EOF" >>./data
echo "}" >>./data
echo "" >>./data
cat <<'EOF' >>./data
## Checksums
EOF
nvsimple_crc=$(openssl sha1 ./bin/nvsimple | awk '{print $2}')
clean_crc=$(openssl sha1 ./bin/clean.bin | awk '{print $2}')
mtd_write_crc=$(openssl sha1 ./bin/mtd-write | awk '{print $2}')
txhelper_crc=$(openssl sha1 ./bin/txhelper | awk '{print $2}')
echo -e "nvsimple_crc=$nvsimple_crc" >>./data
echo -e "clean_crc=$clean_crc" >>./data
echo -e "mtd_write_crc=$mtd_write_crc" >>./data
echo -e "txhelper_crc=$txhelper_crc" >>./data
echo "" >>./data
cat <<'EOF' >>./data
## Action
if [ "$1" = "nvsimple_file" ]; then nvsimple_file
elif [ "$1" = "mtd_write_file" ]; then mtd_write_file
elif [ "$1" = "cfe_clean_bin" ]; then cfe_clean_bin
elif [ "$1" = "daemon_file" ]; then daemon_file
elif [ "$1" = "clean_crc" ]; then echo $clean_crc
elif [ "$1" = "nvsimple_crc" ]; then echo $nvsimple_crc
elif [ "$1" = "mtd_write_crc" ]; then echo $mtd_write_crc
elif [ "$1" = "txhelper_crc" ]; then echo $txhelper_crc
fi
EOF
chmod a+rx ./data