From 8c048fbe18084bca4cf23af66dd0a229093bfa6f Mon Sep 17 00:00:00 2001 From: linxiaoxu Date: Wed, 8 Dec 2021 02:01:18 +0000 Subject: [PATCH] change generate argument from isopath to repopath --- docs/quick-start.md | 4 ++-- scripts/generate.sh | 30 ++++++------------------------ 2 files changed, 8 insertions(+), 26 deletions(-) diff --git a/docs/quick-start.md b/docs/quick-start.md index 098c839e..ceb81e56 100644 --- a/docs/quick-start.md +++ b/docs/quick-start.md @@ -56,10 +56,10 @@ 进入scripts目录,执行脚本 ``` cd scripts - bash generate.sh ISO_PATH VERSION AGENT_PATH ENCRYPTED_PASSWD + bash generate.sh REPO_PATH VERSION AGENT_PATH ENCRYPTED_PASSWD ``` - 参数说明: - - ISO_PATH :全量iso的路径 + - REPO_PATH :全量repo的路径 - VERSION :制作的容器OS镜像的版本 - AGENT_PATH:构建出来的os-agent的路径 - ENCRYPTED_PASSWD:镜像的root用户密码,加密后的带盐值的密码。可以用openssl、kiwi等命令生成 diff --git a/scripts/generate.sh b/scripts/generate.sh index 13748940..73830ea6 100644 --- a/scripts/generate.sh +++ b/scripts/generate.sh @@ -12,8 +12,7 @@ set -e NAME=KubeOS -ISO_PATH="/mnt" -ISO="" +REPO="" VERSION="" AGENT_PATH="" PASSWD="" @@ -27,7 +26,7 @@ CHECK_REGEX='\||;|&|&&|\|\||>|>>|<|,|#|!|\$' function show_options() { cat << EOF -usage example: sh generate.sh isopath osversion agentpath passwd(encrypted) +usage example: sh generate.sh repopath osversion agentpath passwd(encrypted) options: -h,--help show help information @@ -114,7 +113,6 @@ function delete_file() { function clean_space() { delete_dir "${RPM_ROOT}" delete_dir "${TMP_MOUNT_PATH}" - unmount_dir "${ISO_PATH}" delete_file os.tar rm -rf "${LOCK}" } @@ -135,8 +133,8 @@ function test_lock() { } function check_path() { - if [ ! -f "${ISO}" ];then - echo "ISO path is invalid." + if [ ! -f "${REPO}" ];then + echo "REPO path is invalid." exit 3 fi @@ -144,11 +142,6 @@ function check_path() { echo "there is a rootfs folder. please confirm if rootfs is being used, if not, please remove ${RPM_ROOT} first." exit 5 fi - - if mount 2>/dev/null | grep -w -q "${ISO_PATH}"; then - echo "$ISO_PATH has already been mounted." - exit 4 - fi } function check_disk_space() { @@ -168,24 +161,13 @@ function check_disk_space() { } function prepare_yum() { - mount "${ISO}" "${ISO_PATH}" - if [ ! -d "/mnt/Packages" ]; then - echo "please use ISO file path as ${ISO}." - exit 2 - fi - # init rpmdb rpm --root "${RPM_ROOT}" --initdb mkdir -p "${RPM_ROOT}"{/etc/yum.repos.d,/persist,/proc,/dev/pts,/sys} mount_proc_dev_sys "${RPM_ROOT}" # init yum repo local iso_repo="${RPM_ROOT}/etc/yum.repos.d/iso.repo" - echo "[base]" >"${iso_repo}" - { - echo "name=ISO base" - echo "baseurl=file://${ISO_PATH}" - echo "enabled=1" - } >>"${iso_repo}" + cat "${REPO}" > ${RPM_ROOT}/etc/yum.repos.d/iso.repo } function install_packages() { @@ -304,7 +286,7 @@ do done set -eE -ISO=$1 +REPO=$1 VERSION=$2 AGENT_PATH=$3 PASSWD=$4 -- Gitee