2424# prep for a release.
2525# GPGSIGN=0 - Do not sign the repo in the end of the build. The repo will be signed by default
2626#
27+ # LOCAL_KEY=1 Use local keys to sign repo instead of WGET from GSA. By default use GSA.
28+ #
29+ # SETUP=1 Setup environment for build. By default do not setup environment.
30+ #
2731# LOG=<filename> - provide an LOG file option to redirect some output into log file
2832#
2933# DEST=<directory> - provide a directory to contains the build result
@@ -48,16 +52,8 @@ if [[ ! -f /etc/lsb-release ]]; then
4852fi
4953. /etc/lsb-release
5054
51- # Check the necessary packages before starting the build
52- declare -a packages=( " reprepro" " devscripts" " debhelper" " libsoap-lite-perl" " libdbi-perl" " quilt" " git" )
55+ export HOME=/root
5356
54- for package in ${packages[@]} ; do
55- RC=` dpkg -l | grep $package >> /dev/null 2>&1 ; echo $? `
56- if [[ ${RC} != 0 ]]; then
57- echo " ERROR: Could not find $package , install using 'apt-get install $package ' to continue"
58- exit 1
59- fi
60- done
6157
6258# Process cmd line variable assignments, assigning each attr=val pair to a variable of same name
6359for i in $* ; do
@@ -70,6 +66,44 @@ for i in $*; do
7066 export $varstring
7167done
7268
69+ # Setup environment so the xcat-deps can be built on a FVT test machine
70+ if [ " $SETUP " = " 1" ]; then
71+ # Mount GSA
72+ POKGSA=" /gsa/pokgsa"
73+ POKGSA2=" /gsa/pokgsa-p2"
74+ POKGSAIBM=" pokgsa.ibm.com"
75+ if [ ! -d $POKGSA ]; then
76+ mkdir -p $POKGSA
77+ mount ${POKGSAIBM} :${POKGSA} ${POKGSA}
78+ fi
79+ if [ ! -d $POKGSA2 ]; then
80+ mkdir -p $POKGSA2
81+ mount ${POKGSAIBM} :${POKGSA2} ${POKGSA2}
82+ fi
83+
84+ # Verify needed packages installed
85+ REPREPO=" reprepro"
86+ DEVSCRIPTS=" devscripts"
87+ DEBHELPER=" debhelper"
88+ QUILT=" quilt"
89+
90+ apt-get -y install $REPREPO $DEVSCRIPTS $DEBHELPER $QUILT
91+
92+ echo " Finised setup for xcat-dep build. Rerun this script with SETUP=0 LOCAL_KEY=1 flags"
93+ exit 1
94+ fi
95+
96+ # Check the necessary packages before starting the build
97+ declare -a packages=( " reprepro" " devscripts" " debhelper" " libsoap-lite-perl" " libdbi-perl" " quilt" " git" )
98+
99+ for package in ${packages[@]} ; do
100+ RC=` dpkg -l | grep $package >> /dev/null 2>&1 ; echo $? `
101+ if [[ ${RC} != 0 ]]; then
102+ echo " ERROR: Could not find $package , install using 'apt-get install $package ' to continue"
103+ exit 1
104+ fi
105+ done
106+
73107# Supported distributions
74108dists=" saucy trusty utopic xenial bionic"
75109
@@ -136,8 +170,6 @@ function setbranch {
136170 fi
137171}
138172
139- export HOME=/root
140-
141173WGET_CMD=" wget"
142174if [ ! -z ${LOG} ]; then
143175 WGET_CMD=" wget -o ${LOG} "
@@ -150,10 +182,16 @@ else
150182 gsa_url=http://pokgsa.ibm.com/projects/x/xcat/build/linux
151183 mkdir -p $HOME /.gnupg
152184 for key_name in pubring.gpg secring.gpg trustdb.gpg; do
153- if [ ! -f $HOME /.gnupg/$key_name ] || [ ` wc -c $HOME /.gnupg/$key_name | cut -f 1 -d' ' ` == 0 ]; then
154- rm -f $HOME /.gnupg/$key_name
155- ${WGET_CMD} -P $HOME /.gnupg $gsa_url /keys/$key_name
185+ if [ " $LOCAL_KEY " = " 1" ]; then
186+ # Keys are already in the local $HOME/.gnupg directory
156187 chmod 600 $HOME /.gnupg/$key_name
188+ else
189+ # Need to download keys from GSA
190+ if [ ! -f $HOME /.gnupg/$key_name ] || [ ` wc -c $HOME /.gnupg/$key_name | cut -f 1 -d' ' ` == 0 ]; then
191+ rm -f $HOME /.gnupg/$key_name
192+ ${WGET_CMD} -P $HOME /.gnupg $gsa_url /keys/$key_name
193+ chmod 600 $HOME /.gnupg/$key_name
194+ fi
157195 fi
158196 done
159197fi
424462
425463 # the path of ubuntu xcat-dep deb packages on GSA
426464 GSA=" /gsa/pokgsa/projects/x/xcat/build/ubuntu/xcat-dep"
427-
428465 if [ ! -d $GSA ]; then
429- echo " build-ubunturepo: It appears that you do not have gsa installed to access the xcat-dep pkgs."
466+ echo " build-ubunturepo: It appears that you do not have GSA to access the xcat-dep pkgs."
430467 exit 1;
431468 fi
432469
0 commit comments