1
0
mirror of https://github.com/rancher/os.git synced 2025-08-15 21:43:42 +00:00
os/scripts/layout-initrd
Olli Janatuinen ab3f7a0b49 v2.0.0
* Downgrade system-docker to 17.06.107 (last version before rename)
* Use Docker 24.0.9 by default. 25.0.3 available as alternative.
* Buildroot 2023.02.10
* Kernel 5.10.211
* Always generate dhcpd.conf (not only with Wi-Fi)
* Support user Docker "data_root" configuration
2024-03-05 19:33:51 +00:00

75 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
function cache_services() {
echo "Caching service: $1"
local SERVICE_YMLFILE=$1
local SERVICE_URL=${OS_SERVICES_REPO}/${REPO_VERSION}
local SERVICE_INDEX_URL="${SERVICE_URL}/index.yml"
local SERVICE_YMLFILE_URL="${SERVICE_URL}/${SERVICE_YMLFILE}"
local SERVICE_INDEX_URL_MD5=$(echo -n ${SERVICE_INDEX_URL}|md5sum|cut -d ' ' -f1)
local SERVICE_YMLFILE_URL_MD5=$(echo -n ${SERVICE_YMLFILE_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_YMLFILE_URL_MD5} ${SERVICE_YMLFILE_URL}
}
echo Create initrd layout in $INITRD_DIR
rm -rf ${INITRD_DIR}
mkdir -p ${INITRD_DIR}/usr/{etc,lib,bin,share/ros}
./scripts/template
cp build/images*.tar ${INITRD_DIR}/usr/share/ros/
cp bin/ros ${INITRD_DIR}/usr/bin/
ln -s usr/bin/ros ${INITRD_DIR}/init
# cp ${INITRD_DIR}/usr/bin/sh ${INITRD_DIR}/usr/bin
ln -s ros ${INITRD_DIR}/usr/bin/init
ln -s bin ${INITRD_DIR}/usr/sbin
ln -s usr/sbin ${INITRD_DIR}/sbin
curl -SL ${!SYSTEM_DOCKER_URL} | tar --strip-components=1 -xzvf - -C ${INITRD_DIR}/usr/bin/
# we have diabled the user-proxy so we get rid of system-docker-proxy
rm -f ${INITRD_DIR}/usr/bin/system-docker-proxy
# reduce size by removing debugging tool system-docker-containerd-ctr
rm -f ${INITRD_DIR}/usr/bin/system-docker-containerd-ctr
cat <<HERE > ${INITRD_DIR}/usr/share/ros/os-release
NAME="BurmillaOS"
VERSION=${VERSION}
ID=rancheros
ID_LIKE=
VERSION_ID=${VERSION}
PRETTY_NAME="BurmillaOS ${VERSION}"
HOME_URL="https://burmillaos.org"
SUPPORT_URL="https://github.com/burmilla/os"
BUG_REPORT_URL="https://github.com/burmilla/os/issues"
BUILD_ID=
HERE
pushd ${INITRD_DIR}/usr/etc
ln -s ../share/ros/os-release .
popd
# Support upgrades from old persistent consoles that bind mount these
touch ${INITRD_DIR}/usr/bin/docker-containerd
touch ${INITRD_DIR}/usr/bin/docker-containerd-shim
touch ${INITRD_DIR}/usr/bin/docker
# make burmilla/os-initrd image
cat <<HERE > ${INITRD_DIR}/../Dockerfile.initrd
FROM scratch
COPY initrd/* /
HERE
name="os-initrd"
tag="${OS_REPO}/${name}:${VERSION}${SUFFIX}"
pushd .
cd ${INITRD_DIR}/..
docker build -t ${OS_REPO}/${name} -f Dockerfile.initrd .
docker tag burmilla/${name} ${tag}
popd