-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmake_build
More file actions
executable file
·308 lines (283 loc) · 8.48 KB
/
make_build
File metadata and controls
executable file
·308 lines (283 loc) · 8.48 KB
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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
#!/bin/bash
# The master script that will make an OLPC XO compatible puppylinux build.
# from the content of this git repository, public sources, and a puppylinux
# ISO image file.
#
# GPL2 (see /usr/share/doc) (c) mavrothal, 01micko
# NO WARRANTY
#ver
VER=3
xoolpcfunc()
{
echo ""
echo -en "\033[1;33m""\t1""\033[0m" "|" "\033[1;32m" "L""\033[0m" \
"|""\033[1;36m"" ->""\033[0m" "|""\033[1;35m" "X"; echo -e "\033[0m"
echo ""
}
export -f xoolpcfunc
xoolpcfunc
#usage
usagefunc()
{
cat <<_USAGE
Usage:
This program will create a puppylinux version bootable on the OLPC
XO-1 and XO-1.5 hardware, from a puppy linux iso.
-h|--help display this usage
-v|--version display script version
-b|--build-iso [path/to/iso] the FULL pathname of the x86 Puppy iso
-ba|--build-ARM [path/to/img] the FULL pathname of the ARM Puppy image
-i|--iso [path/to/iso] like "-b" nut NO kernel building. Must have one
-ia|--img [path/to/img] like "-ba" nut NO kernel building. Must have one
NOTE: This script must be run from one level above the "Pox_git" folder
eg:\`exec Pox_git/make_build -b <path>', \`./Pox_git/make_build -i <path>'
(c) Created by mavrothal and 01micko
@murga-linux puppy forum
GPLv2. See /usr/share/doc/legal/
NO WARRANTY
While all care is taken NO responsibility is accepted
_USAGE
xoolpcfunc
exit 0
}
export -f usagefunc
# Check if we have development tools installed
if [ -f /etc/rc.d/BOOTCONFIG ] ; then
. /etc/rc.d/BOOTCONFIG
DEVX=`echo "$EXTRASFSLIST" | grep devx`
if [ "$DEVX" = "" ] ; then
if [ "$(uname -m)" != "x86_64" -o "$(uname -m | grep -i armv7)" != "" ]; then
echo -e "\\0033[1;31m"
echo "You _must_ have devx loaded or run an x86_64 or ARMv7 distribution"
echo "with devel files, for this script to run properly. Exiting"
echo -en "\\0033[0;39m"
xoolpcfunc
exit 0
fi
fi
else
if [ "`which gcc | grep no\ `" != "" ] || [ "`which gcc`" = "" ] \
|| [ "`which make | grep no\ `" != "" ] || [ "`which make`" = "" ] ; then
echo -e "\\0033[1;31m"
echo "You _must_ have development tools installed for this script"
echo " to run properly. Please install them and try again"
echo -en "\\0033[0;39m"
xoolpcfunc
exit 0
fi
fi
#Check if we have git
if [ "`which git`" = "" ] ; then
echo -e "\\0033[1;31m"
echo "You _must_ have git installed for this script"
echo " to run properly. Please install git and try again"
echo -en "\\0033[0;39m"
xoolpcfunc
exit 0
fi
prepare()
{
NOWDIR=`pwd`
INSIDE=`echo $NOWDIR | grep Pox_git`
if [ "$INSIDE" != "" ] ; then
echo -e "\\0033[1;31m"
echo "Run this script form _1_ level above the Pox_git folder"
echo -en "\\0033[0;39m"
sleep 5
usagefunc
fi
if [ ! -d "$NOWDIR"/*Pox_git* ] ; then
echo -e "\\0033[1;31m"
echo "Run this script form _1_ level above the Pox_git folder"
echo -en "\\0033[0;39m"
sleep 5
usagefunc
fi
#Make the working directory
mkdir $NOWDIR/"$BUILDNAME"_XO_build
WDIR="$NOWDIR/"$BUILDNAME"_XO_build"
# Create a build log
echo `date`, puppy-XO build on > $WDIR/build.log
echo `cat /etc/issue` >> $WDIR/build.log
if [ ! -f /etc/DISTRO_SPECS ] ; then
echo -e "\\0033[1;31m"
echo "This program may not run properly in other than Puppylinux, distros"
echo ""
echo "Hit \"c\" and then \"enter\" to take your chances "
echo "and continue... or just \"enter\" to stop."
echo -en "\\0033[0;39m"
read CONTINUE
if [ "$CONTINUE" = "c" ];then
echo "Building in a non-puppylinux distro. $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
else
exit 0
fi
else
. /etc/DISTRO_SPECS
fi
# Clean and update the Pox_git
cd $NOWDIR/*Pox_git*
git reset --hard HEAD
git fetch
if [ $? -ne 0 ]; then
echo "Pox_git git update failed. $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
fi
# Copy files from Pox_git into the work directory
cd $WDIR
cp -a $NOWDIR/*Pox_git*/*.sh .
cp -a $NOWDIR/*Pox_git*/pkgs_remrc .
cp -aR $NOWDIR/*Pox_git*/XO/* .
chmod 755 *.sh
sync
# and remove the .gitignore files
rm -f $WDIR/extra_pets/.gitignore
rm -f $WDIR/extra_packs/.gitignore
rm -f $WDIR/XO_sfs/.*/.gitignore
}
export -f prepare
run_all()
{
# Run the build scripts
echo "Starting kernel build. $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
./XOpup_kernel_builder.sh -x
sync; sync
if [ ! -f $WDIR/boot10/vmlinuz ] && [ ! -f $WDIR/boot15/vmlinuz ] ; then
echo -e "\\0033[1;31m"
echo "Aborting! XO kernel build failed"
echo "Check $WDIR/build.log for more."
echo -en "\\0033[0;39m"
echo "Kernel build failed. $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
exit 1
else
echo "Finished kernel build. $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
fi
sleep 5
echo "Building XO_sfs files. $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
./build_from_OLPC_git.sh -b
sync; sync
./build_aufs_util.sh
sync; sync
echo "Finished building XO_sfs files. $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
sleep 5
echo "Building $BUILDNAME-XO . $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
./create_xo_puppy.sh -i "$ISOPATH"
sync; sync
echo "Finished building $BUILDNAME-XO . $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
}
export -f run_all
run_all_arm ()
{
# Run the build scripts
echo "Starting kernel build. $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
./XOpup_kernel_builder.sh -a
sync; sync
if [ ! -f $WDIR/boot175/vmlinuz ] && [ ! -f $WDIR/boot40/vmlinuz ] ; then
echo -e "\\0033[1;31m"
echo "Aborting! XO kernel build failed"
echo "Check $WDIR/build.log for more."
echo -en "\\0033[0;39m"
echo "Kernel build failed. $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
exit 1
else
echo "Finished kernel build. $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
fi
sleep 5
echo "Building XO_sfs files. $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
./build_ARM_from_OLPC_git.sh -b
sync; sync
./build_aufs_util.sh
sync; sync
echo "Finished building XO_sfs files. $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
sleep 5
echo "Building $BUILDNAME-XO . $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
./build_ARMedDog_XO.sh -i "$IMGPATH"
sync; sync
echo "Finished building $BUILDNAME-XO . $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
}
export -f run_all_arm
no_kernel()
{
# Use an existing kernel
if [ ! -f $WDIR/boot10/vmlinuz ] && [ ! -f $WDIR/boot15/vmlinuz ] ; then
echo -e "\\0033[1;31m"
echo " You do not have the XO kernels in the"
echo " $WDIR directory."
echo " Copy them over or run this script with the -b option"
echo -en "\\0033[0;39m"
exit 0
fi
echo "Building XO_sfs files. $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
./build_from_OLPC_git.sh -b
sync; sync
./build_aufs_util.sh
sync; sync
echo "Finished building XO_sfs files. $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
sleep 5
echo "Building $BUILDNAME-XO . $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
./create_xo_puppy.sh -i "$ISOPATH"
sync; sync
echo "Finished building $BUILDNAME-XO . $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
}
export -f no_kernel
no_ARM_kernel ()
{
# Use an existing kernel
if [ ! -f $WDIR/boot40/vmlinuz ] && [ ! -f $WDIR/boot175/vmlinuz ] ; then
echo -e "\\0033[1;31m"
echo " You do not have the XO kernels in the"
echo " $WDIR directory."
echo " Copy them over or run this script with the -b option"
echo -en "\\0033[0;39m"
exit 0
fi
echo "Building XO_sfs files. $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
./build_ARM_from_OLPC_git.sh -b
sync; sync
./build_aufs_util.sh
sync; sync
echo "Finished building XO_sfs files. $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
sleep 5
echo "Building $BUILDNAME-XO . $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
./build_ARMedDog_XO.sh -i "$IMGPATH"
sync; sync
echo "Finished building $BUILDNAME-XO . $(date "+%Y-%m-%d %H:%M")" >> $WDIR/build.log
}
export -f no_ARM_kernel
case "$#" in
0) usagefunc ;;
[3-9])echo "too many arguments"; usagefunc ;;
esac
case $1 in
-h|--help) usagefunc && exit 0 ;;
-v|--version) echo "$VER" && exit 0 ;;
-b|--build-iso) [ ! $2 ] && usagefunc
ISOPATH=$2
ISO="`basename $ISOPATH`"
BUILDNAME=`echo $ISO | sed 's/.iso//'`
# Need this to check if chrome driver is build correctly
export BUILDNAME
prepare
run_all ;;
-i|--iso) [ ! $2 ] && usagefunc
ISOPATH=$2
ISO="`basename $ISOPATH`"
BUILDNAME=`echo $ISO | sed 's/.iso//'`
# Need this to check if chrome driver is build correctly
export BUILDNAME
prepare
no_kernel ;;
-ba|--build-ARM) [ ! $2 ] && usagefunc
IMGPATH=$2
IMG="`basename $IMGPATH`"
BUILDNAME=`echo $IMG | sed 's/.img//'`
export BUILDNAME
prepare
run_all_arm ;;
-ia|--img) [ ! $2 ] && usagefunc
IMGPATH=$2
IMG="`basename $IMGPATH`"
BUILDNAME=`echo $IMG | sed 's/.img//'`
export BUILDNAME
prepare
no_ARM_kernel ;;
esac