jumpserver/utils/build.sh

33 lines
706 B
Bash
Raw Normal View History

#!/bin/bash
#
# 该build基于registry.fit2cloud.com/public/python:3
utils_dir=$(pwd)
project_dir=$(dirname "$utils_dir")
release_dir=${project_dir}/release
# 打包
cd "${project_dir}" || exit 3
2020-07-09 09:03:49 +00:00
rm -rf "${release_dir:?}"/*
to_dir="${release_dir}/jumpserver"
mkdir -p "${to_dir}"
2020-07-09 09:03:49 +00:00
if [[ -d '.git' ]];then
command -v git || yum -y install git
git archive --format tar HEAD | tar x -C "${to_dir}"
else
cp -R . /tmp/jumpserver
2020-07-09 09:18:40 +00:00
mv /tmp/jumpserver/* "${to_dir}"
2020-07-09 09:03:49 +00:00
fi
if [[ $(uname) == 'Darwin' ]];then
alias sedi="sed -i ''"
else
alias sedi='sed -i'
fi
# 修改版本号文件
if [[ -n ${VERSION} ]]; then
sedi "s@VERSION = .*@VERSION = \"${VERSION}\"@g" "${to_dir}/apps/jumpserver/const.py"
fi