From dccae166ad3bee4e99730d8a471666eff1cfd40d Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 5 Feb 2015 15:00:24 -0500 Subject: [PATCH 01/10] Added some changes to build xCAT-confluent --- buildcore.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/buildcore.sh b/buildcore.sh index 1a1fbbd68..20d342803 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -241,12 +241,13 @@ if [ "$OSNAME" = "AIX" ]; then fi # Build the rest of the noarch rpms -for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT-SoftLayer xCAT-vlan; do +for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT-SoftLayer xCAT-vlan xCAT-confluent; do #if [ "$EMBED" = "zvm" -a "$rpmname" != "xCAT-server" -a "$rpmname" != "xCAT-UI" ]; then continue; fi # for zvm embedded env only need to build server and UI if [[ " $EMBEDBUILD " != *\ $rpmname\ * ]]; then continue; fi - if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-buildkit" ]; then continue; fi # do not build xCAT-buildkit on aix - if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-SoftLayer" ]; then continue; fi # do not build xCAT-softlayer on aix - if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-vlan" ]; then continue; fi # do not build xCAT-vlan on aix + if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-buildkit" ]; then continue; fi # do not build xCAT-buildkit on aix + if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-SoftLayer" ]; then continue; fi # do not build xCAT-softlayer on aix + if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-vlan" ]; then continue; fi # do not build xCAT-vlan on aix + if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-confluent" ]; then continue; fi # do not build xCAT-confluent on aix if $GREP $rpmname $GITUP || [ "$BUILDALL" == 1 ]; then UPLOAD=1 maker $rpmname From 6da3d8ee0eda8b1550b3c699524c5303184cffaa Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 5 Feb 2015 15:57:37 -0500 Subject: [PATCH 02/10] getslnodes.py was using argparse, which is not included on centos6.5 and not available in python 2.6... switched to using docopt for command line interface argument parsing. This python library is pulled in by the SoftLayer python bindings so it's not an extra step. --- xCAT-SoftLayer/bin/getslnodes.py | 137 +++++++++++++++++++------------ 1 file changed, 83 insertions(+), 54 deletions(-) diff --git a/xCAT-SoftLayer/bin/getslnodes.py b/xCAT-SoftLayer/bin/getslnodes.py index dd911dd38..51ee03662 100755 --- a/xCAT-SoftLayer/bin/getslnodes.py +++ b/xCAT-SoftLayer/bin/getslnodes.py @@ -1,28 +1,36 @@ #!/usr/bin/env python -# Query the softlayer account for info about all of the bare metal servers and -# put the info in mkdef stanza format, so the node can be defined in the xcat db -# so that xcat can manage/deploy them. +""" +Usage: getslnodes.py [-h] [-v] [] + +Description: +Query your SoftLayer account and get attributes for each bare metal server. +The attributes can be piped to 'mkdef -z' to define the nodes into the xCAT +Database so that xCAT can manage them. + +getslnodes requires a the .softlayer configuration file defined which can +be set by running "sl config setup" on the command line. + +positional arguments: + hostname-match Select servers that include this partial hostname. + +Optional: + -h, --help show this help message and exit + -v, --verbose display verbose output +""" + +import sys try: - import sys + import docopt import pprint - import argparse import SoftLayer except ImportError as e: - print 'Error: install missing python module before running this command: '+str(e) + print 'Error: install missing python module before running this command: ' + str(e) sys.exit(2) -# Process the cmd line args -# --help is automatically provided by this -parser = argparse.ArgumentParser(description="Query your SoftLayer account and get attributes for each bare metal server. The attributes can be piped to 'mkdef -z' to define the nodes in the xCAT DB so that xCAT can manage them. getslnodes requires a .softlayer file in your home directory that contains your SoftLayer username, api_key, and optionally endpoint_url.") -parser.add_argument('hnmatch', metavar='hostname-match', nargs='?', help='Select servers that include this partial hostname.') -parser.add_argument('-v', "--verbose", action="store_true", help="display verbose output") -args = parser.parse_args() -hnmatch = args.hnmatch # if they specified a hostname match, only show svrs that start with that +def get_sl_servers(): -# Get info from softlayer -try: # username, api_key, endpoint_url come from the .softlayer file client = SoftLayer.Client() @@ -30,53 +38,74 @@ try: operatingSystem.id, operatingSystem.passwords.username, operatingSystem.passwords.password, \ remoteManagementAccounts.username, remoteManagementAccounts.password, remoteManagementComponent.ipmiIpAddress, \ primaryBackendNetworkComponent.primaryIpAddress, primaryBackendNetworkComponent.macAddress" + # # If they specified hnmatch, it would be faster to have softlayer filter the response with something like: # filter={'hardware': {'hostname': {'operation': '*= '+hostname}, 'domain': {'operation': '*= '+domain}}} # But those 2 operations are ANDed together, so it will not work. And currently, filtering does not work on fullyQualifiedDomainName. + # servers = client['Account'].getHardware(mask=mask) - if args.verbose: pprint.pprint(servers) -except SoftLayer.exceptions.SoftLayerAPIError as e: - print 'Error: '+str(e) + return servers + +def print_xcat_node_stanza(servers, hnmatch): -# print info out in xcat node stanza format -for server in servers: - if hnmatch and server['fullyQualifiedDomainName'].find(hnmatch) == -1: continue - print "\n"+server['hostname']+":" - print "\tobjtype=node" - print "\tgroups=slnode,ipmi,all" - print "\tmgt=ipmi" - print "\tbmc="+server['remoteManagementComponent']['ipmiIpAddress'] + for server in servers: + if hnmatch and server['fullyQualifiedDomainName'].find(hnmatch) == -1: + continue - # I have seen svrs with no remoteManagementAccounts entries - if len(server['remoteManagementAccounts']): - print "\tbmcusername="+server['remoteManagementAccounts'][0]['username'] - print "\tbmcpassword="+server['remoteManagementAccounts'][0]['password'] + print "\n"+server['hostname']+":" + print "\tobjtype=node" + print "\tgroups=slnode,ipmi,all" + print "\tmgt=ipmi" + print "\tbmc="+server['remoteManagementComponent']['ipmiIpAddress'] - print "\tip="+server['primaryBackendNetworkComponent']['primaryIpAddress'] - print "\tmac="+server['primaryBackendNetworkComponent']['macAddress'] - print "\tserial="+server['manufacturerSerialNumber'] - print "\tnetboot=xnba" - print "\tarch=x86_64" + # I have seen svrs with no remoteManagementAccounts entries + if len(server['remoteManagementAccounts']): + print "\tbmcusername="+server['remoteManagementAccounts'][0]['username'] + print "\tbmcpassword="+server['remoteManagementAccounts'][0]['password'] - # Find the root or Administrator username and pw - username = None - password = None - for entry in server['operatingSystem']['passwords']: - if entry['username'] == 'root' or entry['username'] == 'Administrator': - # found it - username = entry['username'] - password = entry['password'] - break - elif not username: - # save the 1st entry, in case we never find root or Administrator - username = entry['username'] - password = entry['password'] - if username and password: userStr = ", user:"+username+", pw:"+password - print "\tusercomment=hostname:"+server['fullyQualifiedDomainName']+userStr -sys.exit(0) + print "\tip="+server['primaryBackendNetworkComponent']['primaryIpAddress'] + print "\tmac="+server['primaryBackendNetworkComponent']['macAddress'] + print "\tserial="+server['manufacturerSerialNumber'] + print "\tnetboot=xnba" + print "\tarch=x86_64" + + # Find the root or Administrator username and pw + username = None + password = None + for entry in server['operatingSystem']['passwords']: + if entry['username'] == 'root' or entry['username'] == 'Administrator': + # found it + username = entry['username'] + password = entry['password'] + break + elif not username: + # save the 1st entry, in case we never find root or Administrator + username = entry['username'] + password = entry['password'] + + if username and password: + userStr = ", user:"+username+", pw:"+password + + print "\tusercomment=hostname:"+server['fullyQualifiedDomainName']+userStr -def verbose(text): - '''Print msg only if -v was specified.''' - if args.verbose: print text + +if __name__ == '__main__': + try: + arguments = (docopt.docopt(__doc__, version="1.0")) + # print arguments + + servers = get_sl_servers() + if arguments['--verbose']: + pprint.pprint(servers) + + print_xcat_node_stanza(servers, arguments['']) + + except docopt.DocoptExit as e: + print e + except SoftLayer.exceptions.SoftLayerAPIError as e: + print e + + sys.exit(1) + From f8cb5bbe6600ef585a36580a515544f1c771f8ca Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 5 Feb 2015 16:20:02 -0500 Subject: [PATCH 03/10] Add xCAT-confluent package to Ubuntu and Debian build scripts --- build-debs-all | 2 +- build-ubunturepo | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/build-debs-all b/build-debs-all index 8ff818eb3..70f71933a 100755 --- a/build-debs-all +++ b/build-debs-all @@ -68,7 +68,7 @@ function makedeb { } # build all debian packages -packages="xCAT-client xCAT-nbroot xCAT-nbroot2 perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-IBMhpc xCAT-rmc xCAT-vlan" +packages="xCAT-client xCAT-nbroot xCAT-nbroot2 perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-IBMhpc xCAT-rmc xCAT-vlan xCAT-confluent" for file in `echo $packages` do diff --git a/build-ubunturepo b/build-ubunturepo index 2adc8546d..8309b6efe 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -194,8 +194,7 @@ then if [ ! -d ../../$package_dir_name ];then mkdir -p "../../$package_dir_name" fi - #packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-OpenStack xCAT-OpenStack-baremetal xCAT-buildkit" - packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT xCATsn xCAT-test xCAT-buildkit xCAT-vlan" + packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT xCATsn xCAT-test xCAT-buildkit xCAT-vlan xCAT-confluent" target_archs=(amd64 ppc64el) for file in `echo $packages` do From 15e68b1555a186127cff230cd6aa49eca0087397 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 5 Feb 2015 16:26:09 -0500 Subject: [PATCH 04/10] No man page for xCAT-confluent, comment out call to xpod2man --- xCAT-confluent/xCAT-confluent.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-confluent/xCAT-confluent.spec b/xCAT-confluent/xCAT-confluent.spec index eee1515d1..b6a4187a9 100644 --- a/xCAT-confluent/xCAT-confluent.spec +++ b/xCAT-confluent/xCAT-confluent.spec @@ -28,7 +28,7 @@ system management server %build # Convert pods to man pages and html pages -./xpod2man +#./xpod2man %install rm -rf $RPM_BUILD_ROOT From c0be673a4d3a4fa516f900cf13a80ed94a9b4147 Mon Sep 17 00:00:00 2001 From: Junxiaw Date: Thu, 5 Feb 2015 18:51:45 -0800 Subject: [PATCH 05/10] modify bundlelist delete #chdef_t_o_attr --- xCAT-test/autotest/bundle/p_rhels_cmd.bundle | 11 ----------- xCAT-test/autotest/bundle/p_sles_cmd.bundle | 11 ----------- xCAT-test/autotest/bundle/x_rhels_cmd.bundle | 1 - 3 files changed, 23 deletions(-) diff --git a/xCAT-test/autotest/bundle/p_rhels_cmd.bundle b/xCAT-test/autotest/bundle/p_rhels_cmd.bundle index 5b33d57f3..a34ee8bd8 100644 --- a/xCAT-test/autotest/bundle/p_rhels_cmd.bundle +++ b/xCAT-test/autotest/bundle/p_rhels_cmd.bundle @@ -11,7 +11,6 @@ chdef_multiple_keys chdef_n chdef_t_o_error chtab_null -chtab_modify chtab_d chtab_modify_node chtab_modify_key @@ -120,9 +119,7 @@ noderm_null noderm_err_node nodeset_stat nodeset_noderange -nodestat_noderange nodestat_err_node -rinv_null rinv_bus rinv_config rinv_serial @@ -131,7 +128,6 @@ rinv_firm rinv_all rinv_noderange_err rmdef_null -rmdef_f_all rmdef_t_err rpower_off rpower_stat @@ -191,7 +187,6 @@ dumpxCATdb_a_p_nullskiptables_V dumpxCATdb_p_V restorexCAT_h restorexCATdb_v -restorexCATdb_p restorexCATdb_p_V restorexCATdb_a_p_V restorexCATdb_wrongpath @@ -216,7 +211,6 @@ makehosts_d makehosts_n makehosts_n_noderange xdcp_src_dst -xdcp_P makedns_h makedns_d_node makedns_n @@ -224,15 +218,10 @@ makedns noderange_individual_node noderange_individual_grp noderange_node01-node10 -noderange_node[01-10] noderange_group1-group3 -noderange_node001-node200 -noderange_node10+3 noderange_10-20 noderange_XCAT_NODE_PREFIX noderange_XCAT_NODE_SUFFIX -noderange_/nrtestnode.* -noderange_/tmp/nodelistfile noderange_exclusion noderange_group_intersection confignics_config_one_port_single_value diff --git a/xCAT-test/autotest/bundle/p_sles_cmd.bundle b/xCAT-test/autotest/bundle/p_sles_cmd.bundle index 5b33d57f3..a34ee8bd8 100644 --- a/xCAT-test/autotest/bundle/p_sles_cmd.bundle +++ b/xCAT-test/autotest/bundle/p_sles_cmd.bundle @@ -11,7 +11,6 @@ chdef_multiple_keys chdef_n chdef_t_o_error chtab_null -chtab_modify chtab_d chtab_modify_node chtab_modify_key @@ -120,9 +119,7 @@ noderm_null noderm_err_node nodeset_stat nodeset_noderange -nodestat_noderange nodestat_err_node -rinv_null rinv_bus rinv_config rinv_serial @@ -131,7 +128,6 @@ rinv_firm rinv_all rinv_noderange_err rmdef_null -rmdef_f_all rmdef_t_err rpower_off rpower_stat @@ -191,7 +187,6 @@ dumpxCATdb_a_p_nullskiptables_V dumpxCATdb_p_V restorexCAT_h restorexCATdb_v -restorexCATdb_p restorexCATdb_p_V restorexCATdb_a_p_V restorexCATdb_wrongpath @@ -216,7 +211,6 @@ makehosts_d makehosts_n makehosts_n_noderange xdcp_src_dst -xdcp_P makedns_h makedns_d_node makedns_n @@ -224,15 +218,10 @@ makedns noderange_individual_node noderange_individual_grp noderange_node01-node10 -noderange_node[01-10] noderange_group1-group3 -noderange_node001-node200 -noderange_node10+3 noderange_10-20 noderange_XCAT_NODE_PREFIX noderange_XCAT_NODE_SUFFIX -noderange_/nrtestnode.* -noderange_/tmp/nodelistfile noderange_exclusion noderange_group_intersection confignics_config_one_port_single_value diff --git a/xCAT-test/autotest/bundle/x_rhels_cmd.bundle b/xCAT-test/autotest/bundle/x_rhels_cmd.bundle index 5180c6a49..8c044f944 100644 --- a/xCAT-test/autotest/bundle/x_rhels_cmd.bundle +++ b/xCAT-test/autotest/bundle/x_rhels_cmd.bundle @@ -168,7 +168,6 @@ lsxcatd_null lsxcatd_h lsxcatd_d lsxcatd_a -xdcp_P makedns_d_node makedns_n makedns From cc515c0aea2cfa79f5e33178ad8a2be41be62ee0 Mon Sep 17 00:00:00 2001 From: Junxiaw Date: Thu, 5 Feb 2015 19:09:21 -0800 Subject: [PATCH 06/10] modify bundlelist delete #chdef_t_o_attr --- xCAT-test/autotest/bundle/p_rhels_cmd.bundle | 2 -- xCAT-test/autotest/bundle/p_sles_cmd.bundle | 2 -- 2 files changed, 4 deletions(-) diff --git a/xCAT-test/autotest/bundle/p_rhels_cmd.bundle b/xCAT-test/autotest/bundle/p_rhels_cmd.bundle index a34ee8bd8..a35c0ead3 100644 --- a/xCAT-test/autotest/bundle/p_rhels_cmd.bundle +++ b/xCAT-test/autotest/bundle/p_rhels_cmd.bundle @@ -235,11 +235,9 @@ xdsh_h xdsh_V xdsh_regular_command xdsh_Q_command -xdsh_c_sn xdsh_c_cn xdsh_e_filename xdsh_E -xdsh_i_linux xdsh_t xdsh_q xdsh_T diff --git a/xCAT-test/autotest/bundle/p_sles_cmd.bundle b/xCAT-test/autotest/bundle/p_sles_cmd.bundle index a34ee8bd8..a35c0ead3 100644 --- a/xCAT-test/autotest/bundle/p_sles_cmd.bundle +++ b/xCAT-test/autotest/bundle/p_sles_cmd.bundle @@ -235,11 +235,9 @@ xdsh_h xdsh_V xdsh_regular_command xdsh_Q_command -xdsh_c_sn xdsh_c_cn xdsh_e_filename xdsh_E -xdsh_i_linux xdsh_t xdsh_q xdsh_T From 31f473c09cc61d33e65e0faa7a01df464c63327e Mon Sep 17 00:00:00 2001 From: Junxiaw Date: Thu, 5 Feb 2015 21:09:08 -0800 Subject: [PATCH 07/10] modify bundlelist --- xCAT-test/autotest/bundle/x_ubuntu_cmd.bundle | 4 ---- 1 file changed, 4 deletions(-) diff --git a/xCAT-test/autotest/bundle/x_ubuntu_cmd.bundle b/xCAT-test/autotest/bundle/x_ubuntu_cmd.bundle index 835b8b802..fdc1ef4b9 100644 --- a/xCAT-test/autotest/bundle/x_ubuntu_cmd.bundle +++ b/xCAT-test/autotest/bundle/x_ubuntu_cmd.bundle @@ -224,8 +224,6 @@ rmkit_f rmkit_V rmkitcomp_v rmkitcomp_h -rmkitcomp_noscripts -rmkitcomp_f xdsh_h xdsh_V xdsh_regular_command @@ -237,5 +235,3 @@ xdsh_t xdsh_q xdsh_T xdsh_o -xdsh_c_sn -xdsh_i_linux From dc4138c13cc9ab9deaae0d2a10e0c40f4e26fbc5 Mon Sep 17 00:00:00 2001 From: ligc Date: Fri, 6 Feb 2015 16:24:09 +0800 Subject: [PATCH 08/10] fix for bug 4562: a shell syntax problem --- xCAT/postscripts/configeth | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT/postscripts/configeth b/xCAT/postscripts/configeth index a2052839f..32b12917f 100755 --- a/xCAT/postscripts/configeth +++ b/xCAT/postscripts/configeth @@ -100,7 +100,7 @@ function configipv4(){ echo "NETMASK_${num_v4num}=${str_v4mask}" >> $str_conf_file echo "NETWORK_${num_v4num}=${str_v4net}" >> $str_conf_file echo "LABEL_${num_v4num}=${num_v4num}" >> $str_conf_file - if [ "$str_mtu "!= "$str_default_token" ]; then + if [ "$str_mtu" != "$str_default_token" ]; then echo "MTU_${num_v4num}=${str_mtu}" >> $str_conf_file fi fi From 54bb58fa1791fdab7063b39b857e8845e3473483 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Fri, 6 Feb 2015 08:52:42 -0500 Subject: [PATCH 09/10] code drop for ubuntu diskless genimage to use local mirror --- .../share/xcat/netboot/ubuntu/genimage | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index a6b330a94..faefa5943 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -225,7 +225,12 @@ $uarch="amd64" if ($arch eq x86_64); unless ($onlyinitrd) { @aptdirs=(); - find(\&isaptdir, <$srcdir/>); + + # Get the ubuntu repo path from osimage.pkgdir + my @srcdirs = split(',', $srcdir); + foreach my $dir (@srcdirs) { + find(\&isaptdir, <$dir/>); + } # Add the dir for kernel deb to be installed if ($kernelver) { find(\&isaptdir, <$kerneldir/>); @@ -274,11 +279,20 @@ unless ($onlyinitrd) { my $aptcmd1 = "debootstrap"; #my $aptcmd2 = "--arch $uarch $dist $rootimg_dir file://$installroot/$osver/$arch/"; my $aptcmd2; - if ($uarch eq 'ppc64el') { - $aptcmd2 = "--verbose --arch $uarch $dist $rootimg_dir http://ports.ubuntu.com/ubuntu-ports/"; + + # Check whether a local Ubuntu mirror is specified + # if linuximage.pkgdir has second mirror is set, we consider the second mirror as a full Ubuntu mirror + if ($#srcdirs > 0) { + $aptcmd2 = "--verbose --arch $uarch $dist $rootimg_dir file://$srcdirs[1]"; + $srcdir = $srcdirs[0]; } else { - $aptcmd2 = "--verbose --arch $uarch $dist $rootimg_dir http://archive.ubuntu.com/ubuntu/"; + if ($uarch eq 'ppc64el') { + $aptcmd2 = "--verbose --arch $uarch $dist $rootimg_dir http://ports.ubuntu.com/ubuntu-ports/"; + } else { + $aptcmd2 = "--verbose --arch $uarch $dist $rootimg_dir http://archive.ubuntu.com/ubuntu/"; + } } + mkpath("$rootimg_dir/var/lib/dpkg"); mkpath("$rootimg_dir/var/lib/apt"); @@ -390,6 +404,7 @@ unless ($onlyinitrd) { } } + #add the other package directory to for apt-get install open ($aptconfig,">","$rootimg_dir/etc/apt/sources.list.d/genimage.apt.list"); #if ($otherpkgsdir_local){ From 2bc3c5f031008a33ba0050a41b70f29715db2b96 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 6 Feb 2015 10:55:14 -0500 Subject: [PATCH 10/10] Seems like mklocalrepo never worked for Zypper because the /etc/yum.repos.d was hard coded. Enhanced to work with SLES distributions --- buildcore.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/buildcore.sh b/buildcore.sh index 20d342803..2c84f8b55 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -428,7 +428,14 @@ if [[ $REPOFILE == "xCAT-*.repo" ]]; then echo "ERROR: For xcat-dep, please execute $0 in the correct / subdirectory" exit 1 fi -sed -e 's|baseurl=.*|baseurl=file://'"`pwd`"'|' $REPOFILE | sed -e 's|gpgkey=.*|gpgkey=file://'"`pwd`"'/repodata/repomd.xml.key|' > /etc/yum.repos.d/$REPOFILE +# +# default to RHEL yum, if doesn't exist try Zypper +# +DIRECTORY="/etc/yum.repos.d" +if [[ ! -d ${DIRECTORY} ]]; then + DIRECTORY="/etc/zypp/repos.d" +fi +sed -e 's|baseurl=.*|baseurl=file://'"`pwd`"'|' $REPOFILE | sed -e 's|gpgkey=.*|gpgkey=file://'"`pwd`"'/repodata/repomd.xml.key|' > ${DIRECTORY}/$REPOFILE cd - EOF2 chmod 775 mklocalrepo.sh