Merge branch 'rw_van_221117' into 'master'
move Rust install to a persistent container dir See merge request redox-os/redox!1290
This commit is contained in:
commit
8b4707ade2
19
mk/podman.mk
19
mk/podman.mk
|
@ -1,4 +1,3 @@
|
|||
|
||||
##############################################
|
||||
# podman.mk - Use Podman to build components #
|
||||
##############################################
|
||||
|
@ -8,8 +7,10 @@
|
|||
IMAGE_TAG?=redox-base
|
||||
## Working Directory in Podman
|
||||
CONTAINER_WORKDIR?=/mnt/redox
|
||||
## Podman Home Directory
|
||||
PODMAN_HOME?=build/podman
|
||||
## Podman command with its many arguments
|
||||
PODMAN_VOLUMES?=--volume "`pwd`":$(CONTAINER_WORKDIR):Z
|
||||
PODMAN_VOLUMES?=--volume "`pwd`":$(CONTAINER_WORKDIR):Z --volume $(PODMAN_HOME):/home:Z
|
||||
PODMAN_ENV?=--env PATH=/home/poduser/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --env PODMAN_BUILD=0
|
||||
PODMAN_CONFIG?=--env ARCH=$(ARCH) --env CONFIG_NAME=$(CONFIG_NAME) --env FILESYSTEM_CONFIG=$(FILESYSTEM_CONFIG)
|
||||
PODMAN_OPTIONS?=--rm --workdir $(CONTAINER_WORKDIR) --userns keep-id --user `id -u` --interactive --tty --env TERM=$(TERM)
|
||||
|
@ -24,13 +25,16 @@ endif
|
|||
|
||||
container_clean: FORCE
|
||||
rm -f build/container.tag
|
||||
@echo "If podman dir cannot be removed, "
|
||||
@echo "remove with \"sudo rm\"."
|
||||
-rm -rf $(PODMAN_HOME) || true
|
||||
@echo "For complete clean of images and containers, use \"podman system reset\""
|
||||
-podman image rm --force $(IMAGE_TAG) || true
|
||||
|
||||
container_touch: FORCE
|
||||
ifeq ($(PODMAN_BUILD),1)
|
||||
@echo If you get an error, the image does not exist. Just do a normal make.
|
||||
podman image exists $(IMAGE_TAG)
|
||||
rm -f build/container.tag
|
||||
podman image exists $(IMAGE_TAG) || (echo "Image does not exist, it will be rebuilt during normal make."; exit 1)
|
||||
touch build/container.tag
|
||||
else
|
||||
@echo PODMAN_BUILD=$(PODMAN_BUILD), container not required.
|
||||
|
@ -40,13 +44,18 @@ endif
|
|||
build/container.tag: $(CONTAINERFILE)
|
||||
ifeq ($(PODMAN_BUILD),1)
|
||||
rm -f build/container.tag
|
||||
@echo "If podman_home dir cannot be removed, "
|
||||
@echo "remove with \"sudo rm\"."
|
||||
-rm -rf $(PODMAN_HOME) || true
|
||||
-podman image rm --force $(IMAGE_TAG) || true
|
||||
mkdir -p $(PODMAN_HOME)
|
||||
@echo "Building Podman image. This may take some time."
|
||||
sed s/_UID_/`id -u`/ $(CONTAINERFILE) | podman build --file - $(PODMAN_VOLUMES) --tag $(IMAGE_TAG)
|
||||
@echo "Mapping Podman user space. Please wait."
|
||||
$(PODMAN_RUN) echo "Podman ready!"
|
||||
$(PODMAN_RUN) bash -e podman/rustinstall.sh
|
||||
mkdir -p build
|
||||
touch $@
|
||||
@echo "Podman ready!"
|
||||
else
|
||||
@echo PODMAN_BUILD=$(PODMAN_BUILD), container not required.
|
||||
endif
|
||||
|
|
|
@ -38,12 +38,8 @@ RUN apt-get update \
|
|||
wget
|
||||
|
||||
# _UID_ must be replaced with the user's uid on host
|
||||
RUN useradd --create-home --no-log-init --uid _UID_ poduser
|
||||
# podman root is mapped to your user id on host during build,
|
||||
# poduser is mapped to your user id during podman run
|
||||
RUN useradd --create-home --no-log-init --uid _UID_ poduser && \
|
||||
chown -R root:root /home
|
||||
|
||||
USER poduser
|
||||
|
||||
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly && \
|
||||
/home/poduser/.cargo/bin/cargo install --force --version 0.1.1 cargo-config && \
|
||||
/home/poduser/.cargo/bin/cargo install --force --version 0.3.20 xargo
|
||||
|
||||
CMD [ "bash", "-c"]
|
7
podman/rustinstall.sh
Executable file
7
podman/rustinstall.sh
Executable file
|
@ -0,0 +1,7 @@
|
|||
#/usr/bin/env bash
|
||||
|
||||
# Install Rust in Podman, after the image has been built
|
||||
|
||||
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly
|
||||
cargo install --force --version 0.1.1 cargo-config
|
||||
cargo install --force --version 0.3.20 xargo
|
Loading…
Reference in a new issue