1
1
#! /bin/bash
2
2
3
- # builder version
4
- BUILDER=" 6.0"
3
+ source lib/function/config
4
+ # builder and profile versions
5
+ BUILDER=" 6.1"
6
+ PROFILE=" 1.0"
5
7
6
- # script
8
+ # depends
9
+ if [[ ` command -v curl` ]]; then : ; else sudo apt install curl; fi
7
10
if [[ ` curl -I https://github.com 2>&1 | grep ' HTTP/2 200' ` ]]; then
8
11
: ;
9
12
else
10
13
echo -e " The builder requires a internet connection."
11
- exit 0;
14
+ exit 0
12
15
fi
16
+
17
+ # dynamic variables
13
18
URL=" https://kernel.org"
14
19
LTS1=$( curl -s $URL | grep -A1 longterm: -n1 | egrep -o ' >[^<]+' | egrep -o ' [^>]+' | grep -w " 5.15" )
15
20
LTS2=$( curl -s $URL | grep -A1 longterm: -n1 | egrep -o ' >[^<]+' | egrep -o ' [^>]+' | grep -w " 6.1" )
@@ -19,6 +24,7 @@ STABLE=$(curl -s $URL/releases.json | jq '.latest_stable.version' -r)
19
24
GCC=` ls -ls /usr/bin/gcc | sed ' s/.*\(..\)/\1/' | sed ' s/ //g' `
20
25
MYNAME=` echo $USER | sed -e " s/\b\(.\)/\u\1/g" `
21
26
27
+ # userdata dot txt
22
28
NAME=" $MYNAME "
23
29
USERNAME=" $USER "
24
30
PASSWORD=" board"
@@ -30,12 +36,17 @@ RTL88XXAU="1"
30
36
USERACCT=" 0"
31
37
USER_PKGS=" htop libsensors-dev"
32
38
LOCALE=" en_US.UTF-8"
39
+ LOCALE_LC_ALL=" C.UTF-8"
33
40
TIMEZONE=" America/New_York"
34
- USER_NAMESERVER1=" 8.8.8.8"
35
- USER_NAMESERVER2=" 8.8.4.4"
41
+ NAMESERVER1=" 8.8.8.8"
42
+ NAMESERVER2=" 8.8.4.4"
43
+ # profile dot txt
36
44
if [[ -f " profile.txt" ]]; then
37
- # source user profile
38
45
. profile.txt
46
+ if [[ -n " $USER_PROFILE " ]]; then : ; else rm -f profile.txt; fi
47
+ if [[ " $PROFILE " == " $USER_PROFILE " ]]; then : ; else profile_txt; fi
48
+ else
49
+ profile_txt
39
50
fi
40
51
HOSTNAME=" default"
41
52
DISTRO=" debian"
@@ -48,14 +59,13 @@ CUSTOM_DEFCONFIG="0"
48
59
MYCONFIG=" "
49
60
LOGGING=" 0"
50
61
VERBOSE=" 0"
51
- DEVROOTFS=" 1"
52
62
COMPRESS_IMG=" 0"
53
63
USCRIPTS=" 0"
54
64
55
65
# open fd
56
66
exec 3>&1
57
67
58
- # Store data to $VALUES variable
68
+ # store data to $VALUES variable
59
69
VALUES=$( dialog --ok-label " Submit" --no-cancel \
60
70
--backtitle " DEBIAN IMAGE BUILDER: CONFIG MENU" \
61
71
--title " " --form " " 0 40 0 \
@@ -83,10 +93,9 @@ VALUES=$(dialog --ok-label "Submit" --no-cancel \
83
93
" User Options" 22 1 " " 22 14 0 0 \
84
94
" Logging:" 23 1 " $LOGGING " 23 11 3 0 \
85
95
" Verbosity:" 24 1 " $VERBOSE " 24 13 3 0 \
86
- " Devel Rootfs:" 25 1 " $DEVROOTFS " 25 16 3 0 \
87
- " Compress img:" 26 1 " $COMPRESS_IMG " 26 16 3 0 \
88
- " User scripts:" 27 1 " $USCRIPTS " 27 16 3 0 \
89
- " User service:" 28 1 " $USERACCT " 28 16 3 0 \
96
+ " Compress img:" 25 1 " $COMPRESS_IMG " 25 16 3 0 \
97
+ " User scripts:" 26 1 " $USCRIPTS " 26 16 3 0 \
98
+ " User service:" 27 1 " $USERACCT " 27 16 3 0 \
90
99
2>&1 1>&3 )
91
100
92
101
# close fd
@@ -111,10 +120,10 @@ echo CUSTOM_DEFCONFIG= >> tmp0
111
120
echo MYCONFIG=' "' >> tmp0
112
121
echo LOGGING= >> tmp0
113
122
echo VERBOSE= >> tmp0
114
- echo DEVROOTFS= >> tmp0
115
123
echo COMPRESS_IMG= >> tmp0
116
124
echo USCRIPTS= >> tmp0
117
125
echo USERACCT= >> tmp0
126
+ echo ' DEVROOTFS="1"' >> tmp0
118
127
echo ' EMMC="0"' >> tmp0
119
128
echo ' ROOTPASSWD="0"' >> tmp0
120
129
echo USER_PKGS=' "' ${USER_PKGS} ' "' >> tmp0
@@ -124,20 +133,12 @@ echo 'KBUSER="playboy"' >> tmp0
124
133
echo ' KBHOST="penguin"' >> tmp0
125
134
echo " RTW88=${RTW88} " >> tmp0
126
135
echo " RTL88XXAU=${RTL88XXAU} " >> tmp0
127
- echo " set_locales(){" >> tmp0
128
- echo " apt install -y locales" >> tmp0
129
- echo " export LANGUAGE=${LOCALE} " >> tmp0
130
- echo " export LANG=${LOCALE} " >> tmp0
131
- echo " export LC_ALL=C.UTF-8" >> tmp0
132
- echo " locale-gen ${LOCALE} " >> tmp0
133
- echo " }" >> tmp0
134
- echo " set_timezone(){" >> tmp0
135
- echo " ln -snf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime" >> tmp0
136
- echo " echo -n '${TIMEZONE} ' > /etc/timezone" >> tmp0
137
- echo " }" >> tmp0
138
- echo NAMESERVER1=' "' ${USER_NAMESERVER1} ' "' >> tmp0
139
- echo NAMESERVER2=' "' ${USER_NAMESERVER2} ' "' >> tmp0
140
- echo builder=${BUILDER} >> tmp0
136
+ echo LOCALE=' "' ${LOCALE} ' "' >> tmp0
137
+ echo LOCALE_LC_ALL=' "' ${LOCALE_LC_ALL} ' "' >> tmp0
138
+ echo TIMEZONE=' "' ${TIMEZONE} ' "' >> tmp0
139
+ echo NAMESERVER1=' "' ${NAMESERVER1} ' "' >> tmp0
140
+ echo NAMESERVER2=' "' ${NAMESERVER2} ' "' >> tmp0
141
+ echo BUILDER=${BUILDER} >> tmp0
141
142
echo ' "' > tmp2
142
143
echo ' "' >> tmp2
143
144
echo ' "' >> tmp2
@@ -164,43 +165,13 @@ sed -i '17i### CUSTOM' userdata.txt
164
165
sed -i ' 29i### COMPILER TUNING' userdata.txt
165
166
sed -i ' 32i### WHOAMI AND HOST' userdata.txt
166
167
sed -i ' 35i### EXTRA WIRELESS' userdata.txt
167
- sed -i ' 38i### LOCALES' userdata.txt
168
- sed -i ' 46i### TIMEZONE' userdata.txt
169
- sed -i ' 51i### NAME SERVER' userdata.txt
170
- sed -i ' 54i### DO NOT EDIT BELOW THIS LINE' userdata.txt
168
+ sed -i ' 38i### LOCALES TIMEZONE AND NAMESERVERS' userdata.txt
169
+ sed -i ' 44i### DO NOT EDIT BELOW THIS LINE' userdata.txt
171
170
172
- # customize your image
173
- custom_txt (){
174
- echo " # Boot Partition: true false" > custom.txt
175
- echo ' ENABLE_VFAT="false"' >> custom.txt
176
- echo " " >> custom.txt
177
- echo " # Root Filesystem Types: ext4 btrfs xfs" >> custom.txt
178
- echo ' FSTYPE="ext4"' >> custom.txt
179
- echo " " >> custom.txt
180
- echo " # UEFI Options: true false" >> custom.txt
181
- echo ' ENABLE_EFI="false"' >> custom.txt
182
- echo " " >> custom.txt
183
- echo " # Petitboot (ODROID): true false" >> custom.txt
184
- echo ' ENABLE_PETITBOOT="false"' >> custom.txt
185
- echo " " >> custom.txt
186
- echo " # Image Size: 3072MB 3584MB 4096MB" >> custom.txt
187
- echo ' IMGSIZE="4096MB"' >> custom.txt
188
- echo " " >> custom.txt
189
- echo " # Shrink Image (EXT4 Only): true false" >> custom.txt
190
- echo ' ENABLE_SHRINK="true"' >> custom.txt
191
- echo " " >> custom.txt
192
- echo " # Compression Types: xz zst" >> custom.txt
193
- echo ' IMG_COMPRESSION="xz"' >> custom.txt
194
- echo " " >> custom.txt
195
- echo " ### DO NOT EDIT BELOW THIS LINE" >> custom.txt
196
- echo " # CUSTOM=${BUILDER} " >> custom.txt
197
- }
171
+ # custom dot txt
198
172
if [[ -f " custom.txt" ]]; then
199
- if [[ ` grep -w " CUSTOM=${BUILDER} " " custom.txt" ` ]]; then
200
- : ;
201
- else
202
- custom_txt
203
- fi
173
+ . custom.txt
174
+ if [[ " $CUSTOM " == " ${BUILDER} " ]]; then : ; else custom_txt; fi
204
175
else
205
176
custom_txt
206
177
fi
0 commit comments