Make fstools in podman opt in and install rust on host again

This commit is contained in:
Wildan M 2025-11-19 11:18:48 -08:00
parent 86c25c24e2
commit 6c8a9c894a
No known key found for this signature in database
GPG Key ID: 01AC53185C679C79
5 changed files with 93 additions and 20 deletions

View File

@ -40,6 +40,8 @@ HOST_CARGO=env -u RUSTUP_TOOLCHAIN -u CC -u TARGET cargo
REDOXFS_MKFS_FLAGS?=
## Set to 1 to enable Podman build, any other value will disable it
PODMAN_BUILD?=1
## Set to 1 to put filesystem tools inside podman, any other value will install it to host
FSTOOLS_IN_PODMAN?=0
## Enable sccache to speed up cargo builds
## only do this by default if this is inside podman
SCCACHE_BUILD?=$(shell [ -f /run/.containerenv ] && echo 1 || echo 0)
@ -51,6 +53,7 @@ export NPROC=nproc
export REDOX_MAKE=make
ifneq ($(PODMAN_BUILD),1)
FSTOOLS_IN_PODMAN=0
HOST_TARGET := $(shell env -u RUSTUP_TOOLCHAIN rustc -vV | grep host | cut -d: -f2 | tr -d " ")
# x86_64 linux hosts have all toolchains
ifneq ($(HOST_TARGET),x86_64-unknown-linux-gnu)

View File

@ -12,6 +12,9 @@ endif
endif
# dont check for compile tools, used internally when installing fstools on host
ifneq ($(SKIP_CHECK_TOOLS),1)
ifeq ($(shell which cbindgen),)
$(error cbindgen not found, install from crates.io or from your package manager)
endif
@ -25,3 +28,5 @@ $(error 'just' not found, install from crates.io or from your package manager)
endif
endif
endif

View File

@ -1,7 +1,7 @@
# Configuration file with the commands configuration of the Redox image
$(BUILD)/harddrive.img: $(HOST_FSTOOLS) $(REPO_TAG)
ifeq ($(PODMAN_BUILD),1)
$(BUILD)/harddrive.img: $(FSTOOLS) $(REPO_TAG)
ifeq ($(FSTOOLS_IN_PODMAN),1)
$(PODMAN_RUN) make $@
else
mkdir -p $(BUILD)
@ -16,8 +16,8 @@ else
mv $@.partial $@
endif
$(BUILD)/redox-live.iso: $(HOST_FSTOOLS) $(REPO_TAG) redox.ipxe
ifeq ($(PODMAN_BUILD),1)
$(BUILD)/redox-live.iso: $(FSTOOLS) $(REPO_TAG) redox.ipxe
ifeq ($(FSTOOLS_IN_PODMAN),1)
$(PODMAN_RUN) make $@
else
mkdir -p $(BUILD)
@ -33,8 +33,8 @@ else
cp redox.ipxe $(BUILD)/redox.ipxe
endif
$(BUILD)/filesystem.img: $(HOST_FSTOOLS) $(REPO_TAG)
ifeq ($(PODMAN_BUILD),1)
$(BUILD)/filesystem.img: $(FSTOOLS) $(REPO_TAG)
ifeq ($(FSTOOLS_IN_PODMAN),1)
$(PODMAN_RUN) make $@
else
mkdir -p $(BUILD)
@ -58,8 +58,8 @@ else
mv $@.partial $@
endif
mount: $(HOST_FSTOOLS) FORCE
ifeq ($(PODMAN_BUILD),1)
mount: $(FSTOOLS) FORCE
ifeq ($(FSTOOLS_IN_PODMAN),1)
$(PODMAN_RUN) make $@
else
mkdir -p $(MOUNT_DIR)
@ -68,8 +68,8 @@ else
pgrep redoxfs
endif
mount_extra: $(HOST_FSTOOLS) FORCE
ifeq ($(PODMAN_BUILD),1)
mount_extra: $(FSTOOLS) FORCE
ifeq ($(FSTOOLS_IN_PODMAN),1)
$(PODMAN_RUN) make $@
else
mkdir -p $(MOUNT_DIR)
@ -78,8 +78,8 @@ else
pgrep redoxfs
endif
mount_live: $(HOST_FSTOOLS) FORCE
ifeq ($(PODMAN_BUILD),1)
mount_live: $(FSTOOLS) FORCE
ifeq ($(FSTOOLS_IN_PODMAN),1)
$(PODMAN_RUN) make $@
else
mkdir -p $(MOUNT_DIR)
@ -89,7 +89,7 @@ else
endif
unmount: FORCE
ifeq ($(PODMAN_BUILD),1)
ifeq ($(FSTOOLS_IN_PODMAN),1)
$(PODMAN_RUN) make $@
else
sync

View File

@ -1,27 +1,30 @@
# Configuration file for redox-installer, Cookbook and RedoxFS FUSE
fstools: $(FSTOOLS_TAG) $(HOST_FSTOOLS)
fstools: $(FSTOOLS_TAG) $(FSTOOLS)
# These tools run inside Podman if it is used, or on the host if Podman is not used
$(FSTOOLS): cookbook installer $(CONTAINER_TAG)
$(FSTOOLS): installer redoxfs $(CONTAINER_TAG)
ifeq ($(PODMAN_BUILD),1)
ifeq ($(FSTOOLS_IN_PODMAN),1)
$(PODMAN_RUN) make $@
else
$(MAKE) $@ PODMAN_BUILD=0 SKIP_CHECK_TOOLS=1
endif
else
rm -rf $@ $@.partial
mkdir -p $@.partial
$(HOST_CARGO) build --manifest-path cookbook/Cargo.toml --release
$(HOST_CARGO) build --manifest-path cookbook/pkgar/Cargo.toml --release
$(HOST_CARGO) install --root $@.partial --path installer --bin redox_installer
$(HOST_CARGO) install --root $@.partial --path installer --bin redox_installer -Zgit=shallow-deps
$(HOST_CARGO) install --root $@.partial --path redoxfs --bin redoxfs --bin redoxfs-mkfs --bin redoxfs-resize
mv $@.partial $@
touch $@
endif
## TODO: remove this
$(FSTOOLS_TAG): $(FSTOOLS)
$(FSTOOLS_TAG): cookbook $(FSTOOLS)
ifeq ($(PODMAN_BUILD),1)
$(PODMAN_RUN) make $@
else
$(HOST_CARGO) build --manifest-path cookbook/Cargo.toml --release
$(HOST_CARGO) build --manifest-path cookbook/pkgar/Cargo.toml --release
touch $@
endif

View File

@ -491,6 +491,66 @@ usage()
exit
}
#############################################################################
# This function takes care of everything associated to rust, and the version
# manager that controls it, it can install rustup and uninstall multirust as
# well as making sure that the correct version of rustc is selected by rustup
# @params: $1 install non-interactively, boolean
#############################################################################
rustInstall()
{
noninteractive=$1
# Check to see if multirust is installed, we don't want it messing with rustup
# In the future we can probably remove this but I believe it's good to have for now
if [ -e /usr/local/lib/rustlib/uninstall.sh ] ; then
echo "It appears that multirust is installed on your system."
echo "This tool has been deprecated by the maintainer, and will cause issues."
echo "This script can remove multirust from your system if you wish."
printf "Uninstall multirust (y/N):"
read multirust
if echo "$multirust" | grep -iq "^y" ;then
sudo /usr/local/lib/rustlib/uninstall.sh
else
echo "Please manually uninstall multirust and any other versions of rust, then re-run bootstrap."
exit 1
fi
fi
# If rustup is not installed we should offer to install it for them
if [ -z "$(which rustup)" ]; then
rustup_options="--default-toolchain stable"
echo "You do not have rustup installed."
if [ "$noninteractive" = true ]; then
rustup="y"
rustup_options+=" -y"
else
echo "We HIGHLY recommend using rustup."
echo "Would you like to install it now?"
echo "*WARNING* this involves a 'curl | sh' style command"
printf "(y/N): "
read rustup
fi
if echo "$rustup" | grep -iq "^y" ;then
#install rustup
curl https://sh.rustup.rs -sSf | sh -s -- $rustup_options
# You have to add the rustup variables to the $PATH
echo "export PATH=\"\$HOME/.cargo/bin:\$PATH\"" >> ~/.bashrc
# source the variables so that we can execute rustup commands in the current shell
source ~/.cargo/env
else
echo "Rustup will not be installed!"
fi
fi
if [ -z "$(which rustc)" ]; then
echo "Rust is not installed"
echo "Please either run the script again, accepting rustup install"
echo "or install rustc stable manually (not recommended) via:"
echo "\#curl -sSf https://static.rust-lang.org/rustup.sh | sh -s -- --channel=stable"
exit 1
else
echo "Your Rust install looks good!"
fi
}
###########################################################################
# This function is the main logic for the bootstrap; it clones the git repo
# then it installs the dependent packages
@ -556,6 +616,8 @@ done
banner
rustInstall "$noninteractive"
if [ "$update" == "true" ]; then
git pull upstream master
git submodule update --recursive --init