1
0
mirror of https://github.com/rancher/os.git synced 2025-09-10 19:20:55 +00:00

Cache os-services yml

This commit is contained in:
Jason-ZW
2018-05-18 05:35:05 +00:00
parent 7e64d3e9dd
commit 9df8d1c440
5 changed files with 43 additions and 3 deletions

View File

@@ -87,7 +87,7 @@ ARG SYSTEM_DOCKER_URL_amd64=https://github.com/niusmallnan/os-system-docker/rele
ARG SYSTEM_DOCKER_URL_arm64=https://github.com/niusmallnan/os-system-docker/releases/download/${SYSTEM_DOCKER_VERSION}/docker-arm64-${SYSTEM_DOCKER_VERSION}.tgz ARG SYSTEM_DOCKER_URL_arm64=https://github.com/niusmallnan/os-system-docker/releases/download/${SYSTEM_DOCKER_VERSION}/docker-arm64-${SYSTEM_DOCKER_VERSION}.tgz
ARG VMWARE_AUTOFORMAT=1 ARG VMWARE_AUTOFORMAT=1
ARG OPEN_VMTOOLS_VERSION=10.2.5-1 ARG OPEN_VMTOOLS_VERSION=10.2.5-2
###################################################### ######################################################
# Set up environment and export all ARGS as ENV # Set up environment and export all ARGS as ENV

View File

@@ -443,6 +443,32 @@ func RunInit() error {
log.Debugf("memory Resolve.conf == [%s]", configFiles["/etc/resolv.conf"]) log.Debugf("memory Resolve.conf == [%s]", configFiles["/etc/resolv.conf"])
// this code make sure the open-vm-tools service can be started correct when there is no network
if hypervisor == "vmware" {
// make sure the cache directory exist
if err := os.MkdirAll("/var/lib/rancher/cache/", os.ModeDir|0755); err != nil {
log.Errorf("Create service cache diretory error: %v", err)
}
// move os-services cache file
if _, err := os.Stat("/usr/share/ros/services-cache"); err == nil {
files, err := ioutil.ReadDir("/usr/share/ros/services-cache/")
if err != nil {
log.Errorf("Read file error: %v", err)
}
for _, f := range files {
err := os.Rename("/usr/share/ros/services-cache/"+f.Name(), "/var/lib/rancher/cache/"+f.Name())
if err != nil {
log.Errorf("Rename file error: %v", err)
}
}
if err := os.Remove("/usr/share/ros/services-cache"); err != nil {
log.Errorf("Remove file error: %v", err)
}
}
}
if boot2DockerEnvironment { if boot2DockerEnvironment {
if err := config.Set("rancher.state.dev", cfg.Rancher.State.Dev); err != nil { if err := config.Set("rancher.state.dev", cfg.Rancher.State.Dev); err != nil {
log.Errorf("Failed to update rancher.state.dev: %v", err) log.Errorf("Failed to update rancher.state.dev: %v", err)

View File

@@ -30,6 +30,20 @@ SUPPORT_URL="https://forums.rancher.com/c/rancher-os"
BUG_REPORT_URL="https://github.com/rancher/os/issues" BUG_REPORT_URL="https://github.com/rancher/os/issues"
BUILD_ID= BUILD_ID=
HERE HERE
# cache os-services yml file
if [ -e ".make-vmware" ]; then
SERVICE_URL=${OS_SERVICES_REPO}/${REPO_VERSION}
SERVICE_INDEX_URL="${SERVICE_URL}/index.yml"
SERVICE_OPEN_VMTOOLS_URL="${SERVICE_URL}/o/open-vm-tools.yml"
SERVICE_INDEX_URL_MD5=$(echo -n ${SERVICE_INDEX_URL}|md5sum|cut -d ' ' -f1)
SERVICE_OPEN_VMTOOLS_URL_MD5=$(echo -n ${SERVICE_OPEN_VMTOOLS_URL}|md5sum|cut -d ' ' -f1)
mkdir -p ${INITRD_DIR}/usr/share/ros/services-cache/
wget -O ${INITRD_DIR}/usr/share/ros/services-cache/${SERVICE_INDEX_URL_MD5} ${SERVICE_INDEX_URL}
wget -O ${INITRD_DIR}/usr/share/ros/services-cache/${SERVICE_OPEN_VMTOOLS_URL_MD5} ${SERVICE_OPEN_VMTOOLS_URL}
fi
# TODO: usr/lib dir is overwritten by the kernel modules and firmware # TODO: usr/lib dir is overwritten by the kernel modules and firmware
ln -s ${INITRD_DIR}/usr/share/ros/os-release ${INITRD_DIR}/usr/lib/ ln -s ${INITRD_DIR}/usr/share/ros/os-release ${INITRD_DIR}/usr/lib/
ln -s ${INITRD_DIR}/usr/share/ros/os-release ${INITRD_DIR}/usr/etc/ ln -s ${INITRD_DIR}/usr/share/ros/os-release ${INITRD_DIR}/usr/etc/

View File

@@ -4,7 +4,7 @@ set -ex
cd $(dirname $0)/.. cd $(dirname $0)/..
source ./scripts/version source ./scripts/version
export REPO_VERSION=$VERSION export REPO_VERSION=$VERSION
if [[ -z "$GIT_TAG" ]]; then if [[ -n "$DIRTY" || -z "$GIT_TAG" ]]; then
export REPO_VERSION=master export REPO_VERSION=master
fi fi
export COMPRESS="xz --format=lzma -9 --memlimit-compress=80% -e" export COMPRESS="xz --format=lzma -9 --memlimit-compress=80% -e"

View File

@@ -16,7 +16,7 @@ if [ -z "$VERSION" ]; then
fi fi
INITRD=initrd-${VERSION} INITRD=initrd-${VERSION}
export VERSION COMMIT INITRD GIT_TAG export VERSION COMMIT INITRD GIT_TAG DIRTY
# Suffix # Suffix
export SUFFIX="" export SUFFIX=""