-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
config
executable file
·200 lines (185 loc) · 5.04 KB
/
config
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
#!/bin/bash
source lib/function/config
# builder and profile versions
BUILDER="6.11"
PROFILE="1.4"
# depends
if [[ `command -v curl` ]]; then :; else sudo apt install curl; fi
if [[ `curl -I https://github.com 2>&1 | grep 'HTTP/2 200'` ]]; then
:;
else
echo -e "The builder requires a internet connection."
exit 0
fi
# dynamic variable
MYNAME=`echo $USER | sed -e "s/\b\(.\)/\u\1/g"`
# userdata dot txt
NAME="$MYNAME"
USERNAME="$USER"
PASSWORD="board"
VERSION="6.6.y"
COMPILER="gcc"
CCACHE="1"
NETWORKMANAGER="1"
RTW88="1"
RTW88_DEVEL="0"
USERACCT="0"
USER_PKGS="htop libsensors-dev rsyslog"
LOCALE="en_US.UTF-8"
LOCALE_LC_ALL="C.UTF-8"
TIMEZONE="America/New_York"
NAMESERVER1="8.8.8.8"
NAMESERVER2="8.8.4.4"
# profile dot txt
if [[ -f "profile.txt" ]]; then
. profile.txt
if [[ -n "$USER_PROFILE" ]]; then :; else rm -f profile.txt; fi
if [[ "$PROFILE" == "$USER_PROFILE" ]]; then :; else profile_txt; fi
else
profile_txt
fi
HOSTNAME="default"
DISTRO="debian"
DISTRO_VERSION="bookworm"
UBOOT_VERSION="v2024.01"
BUILD_VERSION="1"
MENUCONFIG="0"
CUSTOM_DEFCONFIG="0"
MYCONFIG=""
LOGGING="1"
VERBOSE="0"
COMPRESS_IMG="0"
USCRIPTS="0"
# open fd
exec 3>&1
# store data to $VALUES variable
VALUES=$(dialog --ok-label "Submit" --no-cancel \
--backtitle "DEBIAN IMAGE BUILDER: CONFIG MENU" \
--title "" --form "" 0 40 0 \
" Name:" 1 1 "$NAME" 1 8 26 0 \
" Username:" 2 1 "$USERNAME" 2 12 22 0 \
" Password:" 3 1 "$PASSWORD" 3 12 22 0 \
" Hostname:" 4 1 "$HOSTNAME" 4 12 22 0 \
" " 5 1 "" 5 14 0 0 \
" Distribution" 6 1 "" 6 14 0 0 \
" Distro:" 7 1 "$DISTRO" 7 10 24 0 \
" Release:" 8 1 "$DISTRO_VERSION" 8 11 23 0 \
" Network Manager:" 9 1 "$NETWORKMANAGER" 9 19 3 0 \
" " 10 1 "" 10 14 0 0 \
" U-Boot:" 11 1 "$UBOOT_VERSION" 11 10 24 0 \
" Branch:" 12 1 "$VERSION" 12 10 24 0 \
" Build:" 13 1 "$BUILD_VERSION" 13 9 25 0 \
" Menuconfig:" 14 1 "$MENUCONFIG" 14 14 3 0 \
" Compiler:" 15 1 "$COMPILER" 15 12 22 0 \
" Ccache:" 16 1 "$CCACHE" 16 10 3 0 \
" " 17 1 "" 17 14 0 0 \
" Customize" 18 1 "" 18 14 0 0 \
" Defconfig:" 19 1 "$CUSTOM_DEFCONFIG" 19 13 3 0 \
" Name:" 20 1 "$MYCONFIG" 20 8 26 0 \
" " 21 1 "" 21 14 0 0 \
" User Options" 22 1 "" 22 14 0 0 \
" Logging:" 23 1 "$LOGGING" 23 11 3 0 \
" Verbosity:" 24 1 "$VERBOSE" 24 13 3 0 \
" Compress img:" 25 1 "$COMPRESS_IMG" 25 16 3 0 \
" User scripts:" 26 1 "$USCRIPTS" 26 16 3 0 \
" User service:" 27 1 "$USERACCT" 27 16 3 0 \
2>&1 1>&3)
# close fd
exec 3>&-
# convert into vars
echo "$VALUES" > tmp1
echo NAME='"' > tmp0
echo USERNAME='"' >> tmp0
echo PASSWORD='"' >> tmp0
echo HOSTNAME='"' >> tmp0
echo DISTRO='"' >> tmp0
echo DISTRO_VERSION='"' >> tmp0
echo NETWORKMANAGER= >> tmp0
echo UBOOT_VERSION='"' >> tmp0
echo VERSION='"' >> tmp0
echo BUILD_VERSION='"' >> tmp0
echo MENUCONFIG= >> tmp0
echo COMPILER='"' >> tmp0
echo CCACHE= >> tmp0
echo CUSTOM_DEFCONFIG= >> tmp0
echo MYCONFIG='"' >> tmp0
echo LOGGING= >> tmp0
echo VERBOSE= >> tmp0
echo COMPRESS_IMG= >> tmp0
echo USCRIPTS= >> tmp0
echo USERACCT= >> tmp0
echo 'DEVROOTFS="1"' >> tmp0
echo 'EMMC="0"' >> tmp0
echo 'ROOTPASSWD="0"' >> tmp0
echo USER_PKGS='"'${USER_PKGS}'"' >> tmp0
echo CORES=\`nproc\` >> tmp0
echo 'CFLAGS=""' >> tmp0
echo 'KBUSER="playboy"' >> tmp0
echo 'KBHOST="penguin"' >> tmp0
echo "RTW88=${RTW88}" >> tmp0
echo "RTW88_DEVEL=${RTW88_DEVEL}" >> tmp0
echo LOCALE='"'${LOCALE}'"' >> tmp0
echo LOCALE_LC_ALL='"'${LOCALE_LC_ALL}'"' >> tmp0
echo TIMEZONE='"'${TIMEZONE}'"' >> tmp0
echo NAMESERVER1='"'${NAMESERVER1}'"' >> tmp0
echo NAMESERVER2='"'${NAMESERVER2}'"' >> tmp0
echo BUILDER=${BUILDER} >> tmp0
echo '"' > tmp2
echo '"' >> tmp2
echo '"' >> tmp2
echo '"' >> tmp2
echo '"' >> tmp2
echo '"' >> tmp2
echo >> tmp2
echo '"' >> tmp2
echo '"' >> tmp2
echo '"' >> tmp2
echo >> tmp2
echo '"' >> tmp2
echo >> tmp2
echo >> tmp2
echo _defconfig'"' >> tmp2
paste -d '\0' tmp0 tmp1 tmp2 > userdata.txt
rm -f tmp0 tmp1 tmp2
# categories
sed -i '1i### USER INFORMATION' userdata.txt
sed -i '6i### DISTRIBUTION AND RELEASE' userdata.txt
sed -i '10i### UBOOT AND LINUX KERNEL' userdata.txt
sed -i '17i### CUSTOM' userdata.txt
sed -i '29i### COMPILER TUNING' userdata.txt
sed -i '32i### WHOAMI AND HOST' userdata.txt
sed -i '35i### EXTRA WIRELESS' userdata.txt
sed -i '38i### LOCALES TIMEZONE AND NAMESERVERS' userdata.txt
sed -i '44i### DO NOT EDIT BELOW THIS LINE' userdata.txt
# custom dot txt
if [[ -f "custom.txt" ]]; then
. custom.txt
if [[ "$CUSTOM" == "$BUILDER" ]]; then :; else custom_txt; fi
else
custom_txt
fi
# kernel preferences
if [[ -f "kernel.txt" ]]; then
. kernel.txt
if [[ "$KERNEL_PREFERENCES" == "$BUILDER" ]]; then :; else kernel_txt; fi
else
kernel_txt
fi
# rootfs / image mirrors
if [[ -f "mirror.txt" ]]; then
. mirror.txt
if [[ "$MIRROR_LIST" == "$BUILDER" ]]; then :; else mirror_txt; fi
else
mirror_txt
fi
# clear screen
clear -x
# finish formatting the user data file
if [[ -f "userdata.txt" ]]; then
sed -i 's/=0/="0"/g' userdata.txt
sed -i 's/=1/="1"/g' userdata.txt
sed -i '5G;9G;16G;28G;31G;34G;37G;43G' userdata.txt
echo -e "userdata.txt file created."
exit 0
fi
exit 0