forked from BUGBOUNTYchrisg8691/xerolinux_iso
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·283 lines (232 loc) · 9.28 KB
/
build.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
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
#!/bin/bash
#set -e
##################################################################################################################
# Author : DarkXero
# Website : https://xerolinux.xyz
##################################################################################################################
echo
echo "################################################################## "
tput setaf 2
echo "Phase 1 : "
echo "- Setting General parameters"
tput sgr0
echo "################################################################## "
echo
#Let us set the desktop"
#First letter of desktop is small letter
desktop="plasma"
dmDesktop="plasma"
xerolinuxVersion='2023.11'
isoLabel='xerolinux-'$xerolinuxVersion'-x86_64.iso'
# setting of the general parameters
archisoRequiredVersion="archiso 73-1"
buildFolder=$HOME"/xero-build"
outFolder=$HOME"/Xero-Out"
archisoVersion=$(sudo pacman -Q archiso)
# If you are ready to use your personal repo and personal packages
# https://xerolinux.com/use-our-knowledge-and-create-your-own-icon-theme-combo-use-github-to-saveguard-your-work/
# 1. set variable personalrepo to true in this file (default:false)
# 2. change the file personal-repo to reflect your repo
# 3. add your applications to the file packages-personal-repo.x86_64
personalrepo=false
echo "################################################################## "
echo "Building the desktop : "$desktop
echo "Building version : "$xerolinuxVersion
echo "Iso label : "$isoLabel
echo "Do you have the right archiso version? : "$archisoVersion
echo "What is the required archiso version? : "$archisoRequiredVersion
echo "Build folder : "$buildFolder
echo "Out folder : "$outFolder
echo "################################################################## "
if [ "$archisoVersion" == "$archisoRequiredVersion" ]; then
tput setaf 2
echo "##################################################################"
echo "Archiso has the correct version. Continuing ."
echo "##################################################################"
tput sgr0
else
tput setaf 1
echo "###################################################################################################"
echo "You need to install the correct version of Archiso"
echo "Use 'sudo downgrade archiso' to do that"
echo "or update your system"
echo "###################################################################################################"
tput sgr0
fi
echo
echo "################################################################## "
tput setaf 2
echo "Phase 2 :"
echo "- Checking if archiso is installed"
echo "- Saving current archiso version to readme"
echo "- Making mkarchiso verbose"
tput sgr0
echo "################################################################## "
echo
package="archiso"
#----------------------------------------------------------------------------------
#checking if application is already installed or else install with aur helpers
if pacman -Qi $package &> /dev/null; then
echo "Archiso is already installed"
else
#checking which helper is installed
if pacman -Qi yay &> /dev/null; then
echo "################################################################"
echo "######### Installing with yay"
echo "################################################################"
yay -S --noconfirm $package
elif pacman -Qi trizen &> /dev/null; then
echo "################################################################"
echo "######### Installing with trizen"
echo "################################################################"
trizen -S --noconfirm --needed --noedit $package
fi
# Just checking if installation was successful
if pacman -Qi $package &> /dev/null; then
echo "################################################################"
echo "######### "$package" has been installed"
echo "################################################################"
else
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "!!!!!!!!! "$package" has NOT been installed"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
exit 1
fi
fi
echo
echo "Saving current archiso version to readme"
sudo sed -i "s/\(^archiso-version=\).*/\1$archisoVersion/" archiso.readme
echo
echo "Making mkarchiso verbose"
sudo sed -i 's/quiet="y"/quiet="n"/g' /usr/bin/mkarchiso
echo
echo "################################################################## "
tput setaf 2
echo "Phase 3 :"
echo "- Deleting the build folder if one exists"
echo "- Copying the Archiso folder to build folder"
tput sgr0
echo "################################################################## "
echo
echo "Deleting the build folder if one exists - takes some time"
[ -d $buildFolder ] && sudo rm -rf $buildFolder
echo
echo "Copying the Archiso folder to build work"
echo
mkdir $buildFolder
cp -r XeroKDE/ $buildFolder/XeroKDE
echo
echo "################################################################## "
tput setaf 2
echo "Phase 4 :"
echo "- Removing the old packages.x86_64 file from build folder"
echo "- Copying the new packages.x86_64 file to the build folder"
echo "- Add our own personal repo + add your packages to packages-personal-repo.x86_64"
tput sgr0
echo "################################################################## "
echo
echo "Removing the old packages.x86_64 file from build folder"
rm $buildFolder/XeroKDE/packages.x86_64
rm $buildFolder/XeroKDE/packages-personal-repo.x86_64
echo
echo "Copying the new packages.x86_64 file to the build folder"
cp -f XeroKDE/packages.x86_64 $buildFolder/XeroKDE/packages.x86_64
echo
if [ $personalrepo == true ]; then
echo "Adding packages from your personal repository - packages-personal-repo.x86_64"
printf "\n" | sudo tee -a $buildFolder/XeroKDE/packages.x86_64
cat XeroKDE/packages-personal-repo.x86_64 | sudo tee -a $buildFolder/XeroKDE/packages.x86_64
fi
if [ $personalrepo == true ]; then
echo "Adding our own repo to /etc/pacman.conf"
printf "\n" | sudo tee -a $buildFolder/XeroKDE/pacman.conf
printf "\n" | sudo tee -a $buildFolder/XeroKDE/airootfs/etc/pacman.conf
cat personal-repo | sudo tee -a $buildFolder/XeroKDE/pacman.conf
cat personal-repo | sudo tee -a $buildFolder/XeroKDE/airootfs/etc/pacman.conf
fi
echo
echo "################################################################## "
tput setaf 2
echo "Phase 5 : "
echo "- Changing all references"
echo "- Adding time to /etc/dev-rel"
tput sgr0
echo "################################################################## "
echo
#Setting variables
#profiledef.sh
oldname1='iso_name="xerolinux'
newname1='iso_name="xerolinux'
oldname2='iso_label="xerolinux'
newname2='iso_label="xerolinux'
oldname3='XeroLinux'
newname3='XeroLinux'
#hostname
oldname4='XeroLinux'
newname4='XeroLinux'
echo "Changing all references"
echo
sed -i 's/'$oldname1'/'$newname1'/g' $buildFolder/XeroKDE/profiledef.sh
sed -i 's/'$oldname2'/'$newname2'/g' $buildFolder/XeroKDE/profiledef.sh
sed -i 's/'$oldname3'/'$newname3'/g' $buildFolder/XeroKDE/airootfs/etc/dev-rel
sed -i 's/'$oldname4'/'$newname4'/g' $buildFolder/XeroKDE/airootfs/etc/hostname
sed -i 's/'$oldname5'/'$newname5'/g' $buildFolder/XeroKDE/airootfs/etc/sddm.conf
echo "Adding time to /etc/dev-rel"
date_build=$(date -d now)
echo "Iso build on : "$date_build
sudo sed -i "s/\(^ISO_BUILD=\).*/\1$date_build/" $buildFolder/XeroKDE/airootfs/etc/dev-rel
echo
echo "################################################################## "
tput setaf 2
echo "Phase 7 :"
echo "- Building the iso - this can take a while - be patient"
tput sgr0
echo "################################################################## "
echo
[ -d $outFolder ] || mkdir $outFolder
cd $buildFolder/XeroKDE/
sudo mkarchiso -v -w $buildFolder -o $outFolder $buildFolder/XeroKDE/
echo
echo "###################################################################"
tput setaf 2
echo "Phase 8 :"
echo "- Creating checksums"
echo "- Copying pgklist"
tput sgr0
echo "###################################################################"
echo
cd $outFolder
echo "Creating checksums for : "$isoLabel
echo "##################################################################"
echo
echo "Building sha1sum"
echo "########################"
sha1sum $isoLabel | tee $isoLabel.sha1
echo "Building sha256sum"
echo "########################"
sha256sum $isoLabel | tee $isoLabel.sha256
echo "Building md5sum"
echo "########################"
md5sum $isoLabel | tee $isoLabel.md5
echo
echo "Moving pkglist.x86_64.txt"
echo "########################"
cp $buildFolder/iso/arch/pkglist.x86_64.txt $outFolder/$isoLabel".pkglist.txt"
echo
echo "##################################################################"
tput setaf 2
echo "Phase 9 :"
echo "- Making sure we start with a clean slate next time"
tput sgr0
echo "################################################################## "
echo
echo "Deleting the build folder if one exists - takes some time"
[ -d $buildFolder ] && sudo rm -rf $buildFolder
echo
echo "##################################################################"
tput setaf 2
echo "DONE"
echo "- Check your out folder :"$outFolder
tput sgr0
echo "################################################################## "
echo