aboutsummaryrefslogtreecommitdiffstats
path: root/build/make_repo.sh
diff options
context:
space:
mode:
Diffstat (limited to 'build/make_repo.sh')
-rwxr-xr-xbuild/make_repo.sh67
1 files changed, 47 insertions, 20 deletions
diff --git a/build/make_repo.sh b/build/make_repo.sh
index 8ef3c448..6d5faab7 100755
--- a/build/make_repo.sh
+++ b/build/make_repo.sh
@@ -32,7 +32,11 @@ function make_repo()
rm -f ${WORK_PATH}/work/repo/install_packages.sh
rm -f ${WORK_PATH}/work/repo/Dockerfile
- TEMP=`getopt -o h -l os-ver:,package-tag:,tmpl:,default-package:,special-package:,ansible-dir: -n 'make_repo.sh' -- "$@"`
+ option=`echo "os-ver:,package-tag:,tmpl:,default-package:, \
+ special-package:,special-package-script-dir:, \
+ special-package-dir:,ansible-dir:,special-package-dir" | sed 's/ //g'`
+
+ TEMP=`getopt -o h -l $option -n 'make_repo.sh' -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
@@ -43,6 +47,7 @@ function make_repo()
tmpl=""
default_package=""
special_package=""
+ special_package_script_dir=""
special_package_dir=""
ansible_dir=""
while :; do
@@ -52,19 +57,20 @@ function make_repo()
--tmpl) tmpl=$2; shift 2;;
--default-package) default_package=$2; shift 2;;
--special-package) special_package=$2; shift 2;;
+ --special-package-script-dir) special_package_script_dir=$2; shift 2;;
--special-package-dir) special_package_dir=$2; shift 2;;
--ansible-dir) ansible_dir=$2; shift 2;;
--) shift; break;;
- *) echo "Internal error!" ; exit 1 ;;
+ *) echo "Internal error! $1" ; exit 1 ;;
esac
done
- if [[ ! -z ${package_tag} && ${package_tag} == "pip" ]]; then
+ if [[ -n ${package_tag} && ${package_tag} == "pip" ]]; then
make_pip_repo
return
fi
- if [[ -z ${os_ver} || -z ${tmpl} || -z ${package_tag} ]]; then
+ if [[ -z ${os_ver} || -z ${package_tag} ]]; then
echo "parameter is wrong"
exit 1
fi
@@ -79,25 +85,50 @@ function make_repo()
os_name=centos
fi
+ if [[ -z $arch ]]; then
+ echo "unsupported ${os_ver} os"
+ exit 1
+ fi
+
dockerfile=Dockerfile
docker_tmpl=${BUILD_PATH}/os/${os_name}/${os_ver}/${package_tag}/${dockerfile}".tmpl"
docker_tag="${os_ver}/${package_tag}"
- python ${BUILD_PATH}/gen_ins_pkg_script.py "${ansible_dir}" "${arch}" "${BUILD_PATH}/templates/${tmpl}" \
- "${docker_tmpl}" "${default_package}" "${special_package}" "${special_package_dir}"
+ if [[ -z ${tmpl} ]]; then
+ tmpl=${BUILD_PATH}/templates/${arch}_${package_tag}.tmpl
+ fi
+
+ python ${BUILD_PATH}/gen_ins_pkg_script.py "${ansible_dir}" "${arch}" "${tmpl}" \
+ "${docker_tmpl}" "${default_package}" "${special_package}" \
+ "${WORK_PATH}/work/repo/$arch/script/" \
+ "${WORK_PATH}/work/repo/$arch/packages/"
+
+ rm -rf ${WORK_PATH}/work/repo/$arch
+ mkdir -p ${WORK_PATH}/work/repo/$arch/{script,packages}
+
+ # copy default package script to wokr dir
+ if [[ -d ${WORK_PATH}/build/arch/$arch ]]; then
+ cp -rf ${WORK_PATH}/build/arch/$arch/* ${WORK_PATH}/work/repo/$arch/script/
+ fi
+
+ # copy make package script to work dir
+ if [[ -n $special_package_script_dir && -d $special_package_script_dir ]]; then
+ cp -rf $special_package_script_dir/* ${WORK_PATH}/work/repo/$arch/script/
+ fi
- # copy make package script to work/repo dir
- if [[ -n $arch && -d ${WORK_PATH}/build/templates/$arch ]]; then
- rm -rf ${WORK_PATH}/work/repo/$arch
- cp -rf ${WORK_PATH}/build/templates/$arch ${WORK_PATH}/work/repo/
+ # copy special package to work dir
+ if [[ -n $special_package_dir && -d $special_package_dir ]]; then
+ cp -rf $special_package_dir/* ${WORK_PATH}/work/repo/$arch/packages/
fi
+ # copy docker file to work dir
if [[ -n $os_ver && -d ${WORK_PATH}/build/os/$os_name/$os_ver ]]; then
rm -rf ${WORK_PATH}/work/repo/$os_ver
cp -rf ${WORK_PATH}/build/os/$os_name/$os_ver ${WORK_PATH}/work/repo
fi
- if [[ -f ${WORK_PATH}/build/os/$os_name/comps.xml ]]; then
+ # copy centos comps.xml to work dir
+ if [[ $arch == RedHat && -f ${WORK_PATH}/build/os/$os_name/comps.xml ]]; then
cp -rf ${WORK_PATH}/build/os/$os_name/comps.xml ${WORK_PATH}/work/repo
fi
@@ -127,29 +158,25 @@ function make_pip_repo()
function make_all_repo()
{
- make_pip_repo
+ make_repo --package-tag pip
make_repo --os-ver rhel6 --package-tag compass \
- --tmpl compass_core.tmpl \
+ --tmpl "${WORK_PATH}/build/templates/compass_core.tmpl" \
--default-package "epel-release python-yaml python-jinja2 python-paramiko"
make_repo --os-ver trusty --package-tag juno \
--ansible-dir $WORK_PATH/deploy/adapters/ansible \
- --tmpl Debian_juno.tmpl \
--default-package "openssh-server" \
- --special-package "openvswitch-datapath-dkms openvswitch-switch"
+ --special-package "openvswitch-datapath-dkms openvswitch-switch" \
make_repo --os-ver trusty --package-tag kilo \
--ansible-dir $WORK_PATH/deploy/adapters/ansible \
- --tmpl Debian_kilo.tmpl \
--default-package "openssh-server" \
- --special-package "openvswitch-datapath-dkms openvswitch-switch"
+ --special-package "openvswitch-datapath-dkms openvswitch-switch" \
make_repo --os-ver rhel7 --package-tag juno \
--ansible-dir $WORK_PATH/deploy/adapters/ansible \
- --tmpl RedHat_juno.tmpl \
- --default-package "rsyslog strace net-tools wget vim openssh-server dracut-config-rescue dracut-network" \
- --special-package ""
+ --default-package "rsyslog strace net-tools wget vim openssh-server dracut-config-rescue dracut-network"
}
function main()