-
Notifications
You must be signed in to change notification settings - Fork 3
/
make-repo.sh
executable file
·700 lines (584 loc) · 17.7 KB
/
make-repo.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
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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
#!/bin/bash
# Copyright (c) 2013 Takatoshi MATSUO ([email protected])
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it would be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Further, this software is distributed without any warranty that it is
# free of the rightful claim of any third person regarding infringement
# or the like. Any license provided herein, whether implied or
# otherwise, applies only to this software file. Patent licenses, if
# any, provided herein do not apply to combinations of this program with
# other software, or any other product whatsoever.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
CONF_FILE="make-repo.conf"
### functions ###
get_version() {
local name
name=`find $RPMDIRS -maxdepth 1 -type f | grep -v "src\.rpm" | grep "/$1-[0-9].*\.rpm" | sed "s/^.*\/$1-//g" | sed "s/\.x86_64.*//g" | sed "s/\.noarch.*//g"`
if [ ! -n "$name" ]; then
echo "$1 file not found" >&2
exit 1
fi
echo "$name"
}
get_filename_rpm() {
local rpmname="$1"
local filename=""
filename=`find $RPMDIRS -maxdepth 1 -type f | grep -v "src\.rpm" | grep "$rpmname-[0-9].*\.rpm"`
if [ $? -ne 0 ]; then
echo "$rpmname file not found" >&2
exit 1
fi
if [ `echo -e "$filename" | wc -l` -ge 2 ]; then
echo "multiple $rpmname file found: $filename" >&2
exit 1
fi
echo "$filename"
}
get_filename_srpm() {
local rpmname="$1"
local filename=""
filename=`find $SRPMDIR -maxdepth 1 -type f | grep "$i-[0-9].*src\.rpm"`
if [ $? -ne 0 ]; then
echo "$rpmname src file not found" >&2
exit 1
fi
if [ `echo -e "$filename" | wc -l` -ge 2 ]; then
echo "multiple $rpmname file found: $filename" >&2
exit 1
fi
echo "$filename"
}
### make pacemaker-all.spec file ###
make_pacemaker_set_sepc() {
local pkg
local version
cat > $SET_SPEC_FILE <<END
Name: pacemaker-all
Version: ${rpm_ver}
Release: ${rpm_release}%{?dist}
Summary: pacemaker and recommended toolset
Group: Environment/Daemons
License: GPL
URL: https://ja.osdn.net/projects/linux-ha/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
END
for pkg in ${!REQUIRE_RPM[@]}; do
if [ -n "${REQUIRE_RPM[$pkg]}" ]; then
if ! echo "${REQUIRE_RPM[$pkg]}" | grep -q "^[<>=]"; then
echo "$pkg version is invalid : \"${REQUIRE_RPM[$pkg]}\""
exit 1
fi
if ! version=`get_version $pkg`; then
exit 1
fi
echo "Requires: $pkg ${REQUIRE_RPM[$pkg]} $version" >> $SET_SPEC_FILE
else
echo "Requires: $pkg" >> $SET_SPEC_FILE
fi
done
cat >> $SET_SPEC_FILE <<END
%description
This package collects required packages as pacemaker-all.
%post
%if 0%{?rhel} >= 7
systemctl try-restart NetworkManager.service
%endif
%files
%changelog
END
echo -e "$changelog" >> $SET_SPEC_FILE
}
### make pacemaker-repo.spec file ###
make_pacemaker_repo_spec() {
cat > $REPO_SPEC_FILE << END
Name: pacemaker-repo
Version: ${rpm_ver}
Release: ${rpm_release}%{?dist}
Summary: Packages for High-Availability Linux
Group: System Environment/Base
License: GPL
URL: https://ja.osdn.net/projects/linux-ha/
Source0: %{name}-%{version}-%{release}.%{_arch}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
%define linux_ha_dir /opt/linux-ha
%define pm_dir %{linux_ha_dir}/pacemaker
%define rpm_dir %{pm_dir}/rpm
%define repodata_dir %{pm_dir}/repodata
%define repo_dir %{_sysconfdir}/yum.repos.d
%define debug_package %{nil}
%description
Install Pacemaker repository.
%prep
%setup -q -n %{name}-%{version}-%{release}.%{_arch}
%build
%install
rm -rf \${RPM_BUILD_ROOT}
mkdir -p \${RPM_BUILD_ROOT}%{rpm_dir}
cp -pr rpm/* \${RPM_BUILD_ROOT}%{rpm_dir}
mkdir -p \${RPM_BUILD_ROOT}%{repodata_dir}
cp -pr repodata/* \${RPM_BUILD_ROOT}%{repodata_dir}
mkdir -p \${RPM_BUILD_ROOT}%{repo_dir}
cp -p $YUM_CONF_FILE \${RPM_BUILD_ROOT}%{repo_dir}
%files
%defattr(-,root,root)
%dir %{linux_ha_dir}
%dir %{pm_dir}
%{rpm_dir}
%{repodata_dir}
%config(noreplace) %{repo_dir}/$YUM_CONF_FILE
%clean
rm -rf \${RPM_BUILD_ROOT}
%changelog
END
echo -e "$changelog" >> $REPO_SPEC_FILE
}
make_pacemaker_set() {
local rpmfile
make_pacemaker_set_sepc
### build pacemaker-all ###
echo "building pacemaker-all ...."
rpmfile=`LANG=C rpmbuild -bb $SET_SPEC_FILE | grep "Wrote:" | cut -d ":" -f 2`
if [ ! -n "$rpmfile" ]; then
echo "rpmbuild failed"
exit 1
fi
echo
rm -f $REPO_DIR/rpm/pacemaker-all*rpm
echo "mv $rpmfile ."
mv $rpmfile $REPO_DIR/rpm/
}
### pacemaker.repo file ###
make_yum_repository() {
cat >> $REPO_DIR/$YUM_CONF_FILE << END
[linux-ha-ja-pacemaker]
name=linux-ha-ja-pacemaker
baseurl=file:///opt/linux-ha/pacemaker/
enabled=1
gpgcheck=0
END
echo "Creating yum repository ..."
cd $REPO_DIR
createrepo .
if [ $? -ne 0 ]; then
echo "createrepo failed" >&2
cd -
exit 1
fi
cd -
}
# arg1 : dir
check_dir() {
# always delete existing directory when the cleanup option was specified
if [ -d "$1" ] && ! $do_cleanup ; then
YN="E"
echo "$1 dir exists."
echo "Delete?(d) Skip?(s) Exit?(E) d/s/E"
read YN
case "$YN" in
d)
rm -rf "$1"
return 0
;;
s)
return 2
;;
*)
echo "Please delete $1 directory"
exit 1
;;
esac
fi
rm -rf "$1"
rm -f $1.tar.gz
}
mkdir_and_cp_pacemaker_repo() {
local rc
local filename
check_dir "$REPO_DIR"
rc=$?
if [ $rc -ne 0 ]; then
return $rc
fi
### make main repository dir ###
mkdir -p $REPO_DIR/rpm
for i in $BIN_FILES; do
filename=`get_filename_rpm $i`
if [ $? -ne 0 ]; then exit 1; fi
echo "copy $filename"
cp $filename $REPO_DIR/rpm/
done
chown root:root -R $REPO_DIR
chmod 644 $REPO_DIR/rpm/*
}
make_pacemaker_repo() {
local rpmfile
mkdir_and_cp_pacemaker_repo || return $?
make_pacemaker_set
make_pacemaker_repo_spec
make_yum_repository
### build pacemaker-repo ###
rm -f $HOME/rpmbuild/SOURCES/${REPO_DIR}.tar.gz
echo "Compressing ... ${REPO_DIR}.tar.gz"
tar zcf $HOME/rpmbuild/SOURCES/${REPO_DIR}.tar.gz $REPO_DIR
rpmfile=""
echo "building pacemaker-repo .... see pacemaker-repo_build.log"
rpmfile=`LANG=C rpmbuild -bb $REPO_SPEC_FILE 2> pacemaker-repo_build.log | grep "Wrote:" | cut -d ":" -f 2`
if [ ! -n "$rpmfile" ]; then
echo "rpmbuild failed"
exit 1
fi
echo
echo "mv $rpmfile ."
mv $rpmfile .
}
### make pacemaker-debuginfo-repo.spec file ###
make_pacemaker_debuginfo_repo_spec() {
cat > $REPO_DEBUG_SPEC_FILE << END
Name: pacemaker-repo-debuginfo
Version: ${rpm_ver}
Release: ${rpm_release}%{?dist}
Summary: Debuginfo Packages for High-Availability Linux
Group: System Environment/Base
License: GPL
URL: https://ja.osdn.net/projects/linux-ha/
Source0: %{name}-%{version}-%{release}.%{_arch}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
%define linux_ha_dir /opt/linux-ha
%define pm_dir %{linux_ha_dir}/pacemaker-debuginfo
%define rpm_dir %{pm_dir}/rpm
%define repodata_dir %{pm_dir}/repodata
%define repo_dir %{_sysconfdir}/yum.repos.d
%define debug_package %{nil}
%description
Install Pacemaker repository.
%prep
%setup -q -n %{name}-%{version}-%{release}.%{_arch}
%build
%install
rm -rf \${RPM_BUILD_ROOT}
mkdir -p \${RPM_BUILD_ROOT}%{rpm_dir}
cp -pr rpm/* \${RPM_BUILD_ROOT}%{rpm_dir}
mkdir -p \${RPM_BUILD_ROOT}%{repodata_dir}
cp -pr repodata/* \${RPM_BUILD_ROOT}%{repodata_dir}
mkdir -p \${RPM_BUILD_ROOT}%{repo_dir}
cp -p $YUM_DEBUG_CONF_FILE \${RPM_BUILD_ROOT}%{repo_dir}
%files
%defattr(-,root,root)
%dir %{linux_ha_dir}
%dir %{pm_dir}
%{rpm_dir}
%{repodata_dir}
%config(noreplace) %{repo_dir}/$YUM_DEBUG_CONF_FILE
%clean
rm -rf \${RPM_BUILD_ROOT}
%changelog
END
echo -e "$changelog" >> $REPO_DEBUG_SPEC_FILE
}
### pacemaker-debuginfo.repo file ###
make_yum_repository_debuginfo() {
cat >> $REPO_DEBUG_DIR/$YUM_DEBUG_CONF_FILE << END
[linux-ha-ja-pacemaker-debuginfo]
name=linux-ha-ja-pacemaker-debuginfo
baseurl=file:///opt/linux-ha/pacemaker-debuginfo/
enabled=1
gpgcheck=0
END
echo "Creating debuginfo yum repository ..."
createrepo $REPO_DEBUG_DIR
if [ $? -ne 0 ]; then
echo "createrepo failed" >&2
exit 1
fi
}
### make pacemaker-debuginfo-repo ###
mkdir_and_cp_pacemaker_debuginfo_repo() {
local filename
check_dir "$REPO_DEBUG_DIR" || return $?
mkdir -p $REPO_DEBUG_DIR/rpm
for i in $DEBUG_FILES; do
filename=`get_filename_rpm $i`
if [ $? -ne 0 ]; then exit 1; fi
echo "copy $filename"
cp $filename $REPO_DEBUG_DIR/rpm/
done
chown root:root -R $REPO_DEBUG_DIR
chmod 644 $REPO_DEBUG_DIR/rpm/*
}
make_pacemaker_debuginfo_repo() {
local rpmfile
mkdir_and_cp_pacemaker_debuginfo_repo || return $?
make_pacemaker_debuginfo_repo_spec
make_yum_repository_debuginfo
### build pacemaker-repo ###
rm -f $HOME/rpmbuild/SOURCES/${REPO_DEBUG_DIR}.tar.gz
echo "Compressing ... ${REPO_DEBUG_DIR}.tar.gz"
tar zcf $HOME/rpmbuild/SOURCES/${REPO_DEBUG_DIR}.tar.gz $REPO_DEBUG_DIR
rpmfile=""
echo "building pacemaker-repo-debuginfo .... see pacemaker-repo_build.log"
rpmfile=`LANG=C rpmbuild -bb $REPO_DEBUG_SPEC_FILE 2>> pacemaker-repo_build.log | grep "Wrote:" | cut -d ":" -f 2`
if [ ! -n "$rpmfile" ]; then
echo "rpmbuild failed"
exit 1
fi
echo
echo "mv $rpmfile ."
mv $rpmfile .
}
### make pacemaker-src-repo.spec file ###
make_pacemaker_src_repo_spec() {
cat > $REPO_SRC_SPEC_FILE << END
Name: pacemaker-repo-src
Version: ${rpm_ver}
Release: ${rpm_release}%{?dist}
Summary: Source Packages for High-Availability Linux
Group: System Environment/Base
License: GPL
URL: https://ja.osdn.net/projects/linux-ha/
Source0: %{name}-%{version}-%{release}.%{_arch}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
%define linux_ha_dir /opt/linux-ha
%define pm_dir %{linux_ha_dir}/pacemaker-src
%define rpm_dir %{pm_dir}/rpm
%define repodata_dir %{pm_dir}/repodata
%define repo_dir %{_sysconfdir}/yum.repos.d
%define debug_package %{nil}
%description
Install Pacemaker repository.
%prep
%setup -q -n %{name}-%{version}-%{release}.%{_arch}
%build
%install
rm -rf \${RPM_BUILD_ROOT}
mkdir -p \${RPM_BUILD_ROOT}%{rpm_dir}
cp -pr rpm/* \${RPM_BUILD_ROOT}%{rpm_dir}
mkdir -p \${RPM_BUILD_ROOT}%{repodata_dir}
cp -pr repodata/* \${RPM_BUILD_ROOT}%{repodata_dir}
mkdir -p \${RPM_BUILD_ROOT}%{repo_dir}
cp -p $YUM_SRC_CONF_FILE \${RPM_BUILD_ROOT}%{repo_dir}
%files
%defattr(-,root,root)
%dir %{linux_ha_dir}
%dir %{pm_dir}
%{rpm_dir}
%{repodata_dir}
%config(noreplace) %{repo_dir}/$YUM_SRC_CONF_FILE
%clean
rm -rf \${RPM_BUILD_ROOT}
%changelog
END
echo -e "$changelog" >> $REPO_SRC_SPEC_FILE
}
### pacemaker-src.repo file ###
make_yum_repository_src() {
cat >> $REPO_SRC_DIR/$YUM_SRC_CONF_FILE << END
[linux-ha-ja-pacemaker-src]
name=linux-ha-ja-pacemaker-src
baseurl=file:///opt/linux-ha/pacemaker-src/
enabled=1
gpgcheck=0
END
echo "Creating src yum repository ..."
createrepo $REPO_SRC_DIR
if [ $? -ne 0 ]; then
echo "createrepo failed" >&2
exit 1
fi
}
### make pacemaker-src-repo ###
mkdir_and_cp_pacemaker_src_repo() {
local filename
check_dir "$REPO_SRC_DIR" || return $?
mkdir -p $REPO_SRC_DIR/rpm
for i in $SRC_FILES; do
filename=`get_filename_srpm $i`
if [ $? -ne 0 ]; then exit 1; fi
echo "copy $filename"
cp $filename $REPO_SRC_DIR/rpm/
done
chown root:root -R $REPO_SRC_DIR
chmod 644 $REPO_SRC_DIR/rpm/*
}
### make pacemaker-src-repo ###
make_pacemaker_src_repo() {
local rpmfile
mkdir_and_cp_pacemaker_src_repo || return $?
make_pacemaker_src_repo_spec
make_yum_repository_src
### build pacemaker-repo ###
rm -f $HOME/rpmbuild/SOURCES/${REPO_SRC_DIR}.tar.gz
echo "Compressing ... ${REPO_SRC_DIR}.tar.gz"
tar zcf $HOME/rpmbuild/SOURCES/${REPO_SRC_DIR}.tar.gz $REPO_SRC_DIR
rpmfile=""
echo "building pacemaker-repo-src .... see pacemaker-repo_build.log"
rpmfile=`LANG=C rpmbuild -bb $REPO_SRC_SPEC_FILE 2>> pacemaker-repo_build.log | grep "Wrote:" | cut -d ":" -f 2`
if [ ! -n "$rpmfile" ]; then
echo "rpmbuild failed"
exit 1
fi
echo
echo "mv $rpmfile ."
mv $rpmfile .
}
usage() {
echo "$0: [-r|--release RELSPEC] [-R|--rpmbuilddir] [-C|--clean] [--nosrc] [rpm_dir]"
echo " -r|--release RELSPEC: repository package version"
echo " format: RELSPEC=\${rpm_ver}-\${rpm_release}"
echo " -R|--rpmbuilddir: build under $HOME/rpmbuild directory for packaging"
echo " The following directories are used instead of the current directory or [rpm_dir]."
echo " $HOME/rpmbuild/REPOPKG: the output repository packages"
echo " $HOME/rpmbuild/RPMS : binary rpms to be packaged"
echo " (x86_64 and noarch only; no i386 support yet)"
echo " $HOME/rpmbuild/SRPMS : source rpms to be packaged"
echo " -C|--clean: always clean up working directory when packaging"
echo " --nosrc: skip building source packages for development"
echo
echo "Example 1: $0 -r \"1.1.13-1.1\" -R"
echo "Example 2: rpm_ver=\"1.1.10\" rpm_release=\"1.1\" $0 [rpm_dir]"
}
### main ######################################################################
# configurable options
RPMDIRS=""
SRPMDIR=""
REPO_OUTPUT_DIR=""
opt_repspec=""
opt_rpmdir=""
use_rpmbuilddir=false
do_cleanup=false
buildsrc=true
### parse options ###
OPT=`getopt -o r:RC --long release:,rpmbuilddir,clean,nosrc,help -- "$@"`
if [ $? != 0 ] ; then
exit 1
fi
eval set -- "$OPT"
while true; do
case "$1" in
-r|--release) opt_relspec="$2"; shift; shift;;
-R|--rpmbuilddir) use_rpmbuilddir=true; shift;;
-C|--clean) do_cleanup=true; shift;;
--nosrc) buildsrc=false; shift;;
--help) usage; exit 0;;
--) shift; break;;
*) echo "Unknown option: $1" 1>&2; usage; exit 1;;
esac
done
if [ -n "$1" ]; then
opt_rpmdir="$1"
fi
if $use_rpmbuilddir; then
RPMDIRS="$HOME/rpmbuild/RPMS/noarch $HOME/rpmbuild/RPMS/x86_64"
SRPMDIR="$HOME/rpmbuild/SRPMS"
REPO_OUTPUT_DIR="$HOME/rpmbuild/REPOPKG"
fi
if [ "$opt_rpmdir" ]; then
if [ ! -d "$opt_rpmdir" ]; then
echo "rpm directory \"$opt_rpmdir\" not found" >&2
usage
exit 1
fi
RPMDIRS="$opt_rpmdir"
SRPMDIR="$opt_rpmdir"
if $use_rpmbuilddir; then
echo "WARN: both -R option and [rpm_dir] parameter has specified: continue with overriding by [rpm_dir]"
fi
fi
if [ -z "$RPMDIRS" ]; then
echo "Neither rpm directory or -R options specified" >&2
usage
exit 1
fi
### validate ###
# command check
for i in "rpmbuild createrepo"; do
which $i > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "$i not found" >&2
exit 1
fi
done
# if dist was not specified then use the system default
# $dist is without a period character in this script.
if [ -z "$dist" ]; then
dist=`rpmbuild --eval %{dist} | sed 's/^\.//'`
echo "Use dist='$dist'"
fi
if [ -n "$opt_relspec" ]; then
rpm_ver=`expr $opt_relspec : '^\([^-]*\)-[^-]*$'`
rpm_release=`expr $opt_relspec : '^[^-]*-\([^-]*\)$'`
fi
if [ ! -n "$rpm_ver" ] || [ ! -n "$rpm_release" ] || [ ! -n "$dist" ] ; then
echo "Please specify rpm_ver and rpm_release or -r option properly" >&2
usage
exit 1
fi
# to make sure which directories will be used
echo "Packaging options"
echo " RPMDIRS = $RPMDIRS"
echo " SRPMDIR = $SRPMDIR"
echo " REPO_OUTPUT_DIR = $REPO_OUTPUT_DIR"
echo " rpm_ver = $rpm_ver"
echo " rpm_release = $rpm_release"
echo " dist = $dist"
### read configuration ###
if [ ! -f $CONF_FILE ]; then
echo "$CONF_FILE not found" >&2
exit 1
fi
source $CONF_FILE
if [ ! -n "$BIN_FILES" ] || [ ! -n "$DEBUG_FILES" ] || [ ! -n "$SRC_FILES" ] ; then
echo "Conf file is invalid." >&2
exit 1
fi
# create and move to the build working directory if specified
if [ -n "$REPO_OUTPUT_DIR" ]; then
mkdir -p $REPO_OUTPUT_DIR
cd $REPO_OUTPUT_DIR
fi
# global params
SET_SPEC_FILE="pacemaker-all.spec"
REPO_SPEC_FILE="pacemaker-repo.spec"
REPO_SRC_SPEC_FILE="pacemaker-src-repo.spec"
REPO_DEBUG_SPEC_FILE="pacemaker-debuginfo-repo.spec"
YUM_CONF_FILE="pacemaker.repo"
YUM_SRC_CONF_FILE="pacemaker-src.repo"
YUM_DEBUG_CONF_FILE="pacemaker-debuginfo.repo"
REPO_DIR="pacemaker-repo-${rpm_ver}-${rpm_release}.${dist}.x86_64"
REPO_SRC_DIR="pacemaker-repo-src-${rpm_ver}-${rpm_release}.${dist}.x86_64"
REPO_DEBUG_DIR="pacemaker-repo-debuginfo-${rpm_ver}-${rpm_release}.${dist}.x86_64"
make_pacemaker_repo
make_pacemaker_debuginfo_repo
$buildsrc && make_pacemaker_src_repo
if $do_cleanup; then
rm -rf $REPO_DIR
rm -rf $REPO_DEBUG_DIR
rm -rf $REPO_SRC_DIR
fi
# print total number of packages
set -- $BIN_FILES
num_bin=$#
set -- $DEBUG_FILES
num_debug=$#
set -- $SRC_FILES
num_src=$#
echo "Total number of packages"
echo " BIN_FILES : $num_bin"
echo " DEBUG_FILES : $num_debug"
echo " SRC_FILES : $num_src"
if [ -n "$REPO_OUTPUT_DIR" ]; then
echo
echo "The repository package was generated under $REPO_OUTPUT_DIR"
fi
echo
echo "done"