-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathprepare_from_bins
104 lines (68 loc) · 1.64 KB
/
prepare_from_bins
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/sh
## hyphop ##
#= prepare & downloads some bins
RP=$(realpath $0); DP=$(dirname $RP); . $DP/conf/downloads.conf
TO=../share
CMD(){
echo "[#] $@" >&2
"$@"
}
LN(){
[ -f $1 ] && rm $1
CMD ln -sf $2 $1
}
A="Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101"
DL(){
[ -s "$2" ] && {
# add1="$add -c"
# add2="$add -C-"
true
}
# CMD curl -kL $add2 -o "$2" "$1"
[ -s "$2" ] && {
echo "[w] looks like downloaded already $2">&2
return
}
CMD wget $add1 -O "$2" "$1"
}
UNPACK(){
unpack=gzip
[ "$2" ] || exit 1
case $1 in
*.lzma)
unpack=lzma
;;
esac
echo "$unpack -dc $1 > $2">&2
$unpack -dc $1 > $2
}
cd $DP/$TO || {
echo "[e] change dir">&2
exit 1
}
echo "[i] preprate plz wait">&2
echo "[i] download to $RP/$TO">&2
T="$(basename $KERNEL_SRC)"
DL "$DOWNLOAD_BASE/$KERNEL_SRC" "$T" || {
T="$(basename ${KERNEL_SRC%.*})"
DL "$DOWNLOAD_BASE/${KERNEL_SRC%.*}" "$T"
}
[ -f "${T%.*}" ] || UNPACK "$T" "${T%.*}"
T="$(basename $U_BOOT_SRC)"
DL "$DOWNLOAD_BASE/$U_BOOT_SRC" "$T"
[ -f "${T%.*}" ] || UNPACK "$T" "${T%.*}"
T="$(basename $U_BOOT_SD_SRC)"
DL "$DOWNLOAD_BASE/$U_BOOT_SD_SRC" "$T"
[ -f "${T%.*}" ] || UNPACK "$T" "${T%.*}"
T="$(basename $DTB_SRC)"
DL "$DOWNLOAD_BASE/$DTB_SRC" "$T"
T="$(basename $INITRD_SRC)"
DL "$DOWNLOAD_BASE/$INITRD_SRC" "$T"
LN rescue .
LN Initrd $T
printf "" > 00_system_env.txt
LN 80_user_env.txt ../files/80_user_env.txt
LN boot.spi.cmd ../files/boot.spi.cmd
LN image.spi.bin /tmp/krescue.image.bin
LN splash.bmp.gz.make ../files/splash.bmp.gz.make
LN splash.svg ../files/splash.svg