Make installer compile on host, list_packages compile in Podman when PODMAN_BUILD=1
This commit is contained in:
		
							parent
							
								
									61a4f0ab6c
								
							
						
					
					
						commit
						f51dee2ea1
					
				
					 6 changed files with 108 additions and 18 deletions
				
			
		|  | @ -986,6 +986,10 @@ boot() | |||
| 	echo "Well it looks like you are ready to go!" | ||||
| 	echo "---------------------------------------" | ||||
| 	statusCheck | ||||
| 	echo | ||||
| 	echo "** Be sure to update your path to include Rust - run the following command: **" | ||||
| 	echo 'source $HOME/.cargo/env' | ||||
| 	echo | ||||
| 	echo "Run the following commands to build Redox:" | ||||
| 	echo "cd redox" | ||||
| 	MAKE="make" | ||||
|  |  | |||
							
								
								
									
										13
									
								
								mk/config.mk
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								mk/config.mk
									
										
									
									
									
								
							|  | @ -26,7 +26,7 @@ FILESYSTEM_CONFIG?=config/$(ARCH)/$(BOARD)/$(CONFIG_NAME).toml | |||
| endif | ||||
| HOST_CARGO=env -u RUSTUP_TOOLCHAIN -u CC -u TARGET cargo | ||||
| ## Filesystem size in MB (default comes from filesystem_size in the FILESYSTEM_CONFIG)
 | ||||
| FILESYSTEM_SIZE?=$(shell $(HOST_CARGO) run --release --manifest-path installer/Cargo.toml -- --filesystem-size -c $(FILESYSTEM_CONFIG)) | ||||
| ## FILESYSTEM_SIZE?=$(shell $(HOST_CARGO) run --release --manifest-path installer/Cargo.toml -- --filesystem-size -c $(FILESYSTEM_CONFIG))
 | ||||
| ## Flags to pass to redoxfs-mkfs. Add --encrypt to set up disk encryption
 | ||||
| REDOXFS_MKFS_FLAGS?= | ||||
| ## Set to 1 to enable Podman build, any other value will disable it
 | ||||
|  | @ -80,14 +80,17 @@ export RUST_COMPILER_RT_ROOT=$(ROOT)/rust/src/llvm-project/compiler-rt | |||
| export TARGET=$(ARCH)-unknown-redox | ||||
| BUILD=build/$(ARCH)/$(CONFIG_NAME) | ||||
| INSTALLER=installer/target/release/redox_installer | ||||
| INSTALLER_OPTS= | ||||
| LIST_PACKAGES=installer/target/release/list_packages | ||||
| LIST_PACKAGES_OPTS= | ||||
| ifeq ($(REPO_BINARY),0) | ||||
| INSTALLER+=--cookbook=cookbook | ||||
| REPO_TAG=$(BUILD)/repo.tag | ||||
| INSTALLER_OPTS+=--cookbook=cookbook | ||||
| else | ||||
| INSTALLER+=--cookbook=cookbook --repo-binary | ||||
| REPO_TAG=$(BUILD)/repo.tag | ||||
| INSTALLER_OPTS+=--cookbook=cookbook --repo-binary | ||||
| LIST_PACKAGES_OPTS+=--repo-binary | ||||
| endif | ||||
| 
 | ||||
| REPO_TAG=$(BUILD)/repo.tag | ||||
| FSTOOLS_TAG=build/fstools.tag | ||||
| export BOARD | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										30
									
								
								mk/disk.mk
									
										
									
									
									
								
							
							
						
						
									
										30
									
								
								mk/disk.mk
									
										
									
									
									
								
							|  | @ -1,33 +1,45 @@ | |||
| # Configuration file with the commands configuration of the Redox image
 | ||||
| 
 | ||||
| $(BUILD)/harddrive.img: $(FSTOOLS_TAG) $(REPO_TAG) | ||||
| $(BUILD)/harddrive.img: $(INSTALLER) $(FSTOOLS_TAG) $(REPO_TAG) | ||||
| 	mkdir -p $(BUILD) | ||||
| 	rm -rf $@  $@.partial | ||||
| 	-$(FUMOUNT) /tmp/redox_installer || true | ||||
| 	truncate -s "$(FILESYSTEM_SIZE)m" $@.partial | ||||
| 	umask 002 && $(INSTALLER) -c $(FILESYSTEM_CONFIG) $@.partial | ||||
| 	FILESYSTEM_SIZE=$(FILESYSTEM_SIZE) && \
 | ||||
| 	if [ -z "$$FILESYSTEM_SIZE" ] ; then \
 | ||||
| 	FILESYSTEM_SIZE=$(shell $(INSTALLER) --filesystem-size -c $(FILESYSTEM_CONFIG)); \
 | ||||
| 	fi && \
 | ||||
| 	truncate -s "$$FILESYSTEM_SIZE"m $@.partial | ||||
| 	umask 002 && $(INSTALLER) $(INSTALLER_OPTS) -c $(FILESYSTEM_CONFIG) $@.partial | ||||
| 	mv $@.partial $@ | ||||
| 
 | ||||
| $(BUILD)/livedisk.iso: $(FSTOOLS_TAG) $(REPO_TAG) | ||||
| $(BUILD)/livedisk.iso: $(INSTALLER) $(FSTOOLS_TAG) $(REPO_TAG) | ||||
| 	mkdir -p $(BUILD) | ||||
| 	rm -rf $@  $@.partial | ||||
| 	-$(FUMOUNT) /tmp/redox_installer || true | ||||
| 	truncate -s "$(FILESYSTEM_SIZE)m" $@.partial | ||||
| 	umask 002 && $(INSTALLER) -c $(FILESYSTEM_CONFIG) --live $@.partial | ||||
| 	FILESYSTEM_SIZE=$(FILESYSTEM_SIZE) && \
 | ||||
| 	if [ -z "$$FILESYSTEM_SIZE" ] ; then \
 | ||||
| 	FILESYSTEM_SIZE=$(shell $(INSTALLER) --filesystem-size -c $(FILESYSTEM_CONFIG)); \
 | ||||
| 	fi && \
 | ||||
| 	truncate -s "$$FILESYSTEM_SIZE"m $@.partial | ||||
| 	umask 002 && $(INSTALLER) $(INSTALLER_OPTS) -c $(FILESYSTEM_CONFIG) --live $@.partial | ||||
| 	mv $@.partial $@ | ||||
| 
 | ||||
| $(BUILD)/filesystem.img: $(FSTOOLS_TAG) $(REPO_TAG) | ||||
| $(BUILD)/filesystem.img: $(INSTALLER) $(FSTOOLS_TAG) $(REPO_TAG) | ||||
| 	mkdir -p $(BUILD) | ||||
| 	-$(FUMOUNT) $(BUILD)/filesystem/ || true | ||||
| 	rm -rf $@  $@.partial $(BUILD)/filesystem/ | ||||
| 	-$(FUMOUNT) /tmp/redox_installer || true | ||||
| 	truncate -s "$(FILESYSTEM_SIZE)m" $@.partial | ||||
| 	FILESYSTEM_SIZE=$(FILESYSTEM_SIZE) && \
 | ||||
| 	if [ -z "$$FILESYSTEM_SIZE" ] ; then \
 | ||||
| 	FILESYSTEM_SIZE=$(shell $(INSTALLER) --filesystem-size -c $(FILESYSTEM_CONFIG)); \
 | ||||
| 	fi && \
 | ||||
| 	truncate -s "$$FILESYSTEM_SIZE"m $@.partial | ||||
| 	redoxfs/target/release/redoxfs-mkfs $(REDOXFS_MKFS_FLAGS) $@.partial | ||||
| 	mkdir -p $(BUILD)/filesystem/ | ||||
| 	redoxfs/target/release/redoxfs $@.partial $(BUILD)/filesystem/ | ||||
| 	sleep 1 | ||||
| 	pgrep redoxfs | ||||
| 	umask 002 && $(INSTALLER) -c $(FILESYSTEM_CONFIG) $(BUILD)/filesystem/ | ||||
| 	umask 002 && $(INSTALLER) $(INSTALLER_OPTS) -c $(FILESYSTEM_CONFIG) $(BUILD)/filesystem/ | ||||
| 	sync | ||||
| 	-$(FUMOUNT) $(BUILD)/filesystem/ || true | ||||
| 	rm -rf $(BUILD)/filesystem/ | ||||
|  |  | |||
|  | @ -2,17 +2,21 @@ | |||
| 
 | ||||
| fstools: $(FSTOOLS_TAG) | ||||
| 
 | ||||
| ## The installer runs on the host, even when using Podman build
 | ||||
| $(FSTOOLS_TAG): cookbook installer redoxfs $(CONTAINER_TAG) | ||||
| ifeq ($(PODMAN_BUILD),1) | ||||
| 	$(PODMAN_RUN) $(MAKE) $@ | ||||
| else | ||||
| 	$(HOST_CARGO) build --manifest-path cookbook/Cargo.toml --release | ||||
| 	$(HOST_CARGO) build --manifest-path installer/Cargo.toml --release | ||||
| 	$(HOST_CARGO) build --bin list_packages --manifest-path installer/Cargo.toml --release | ||||
| 	$(HOST_CARGO) build --manifest-path redoxfs/Cargo.toml --release --bin redoxfs --bin redoxfs-mkfs | ||||
| 	mkdir -p build | ||||
| 	touch $@ | ||||
| endif | ||||
| 
 | ||||
| $(INSTALLER): installer | ||||
| 	$(HOST_CARGO) build --bin redox_installer --manifest-path installer/Cargo.toml --release | ||||
| 
 | ||||
| fstools_clean: FORCE $(CONTAINER_TAG) | ||||
| ifeq ($(PODMAN_BUILD),1) | ||||
| 	$(PODMAN_RUN) $(MAKE) $@ | ||||
|  |  | |||
|  | @ -4,19 +4,19 @@ $(BUILD)/fetch.tag: prefix $(FSTOOLS_TAG) $(FILESYSTEM_CONFIG) $(CONTAINER_TAG) | |||
| ifeq ($(PODMAN_BUILD),1) | ||||
| 	$(PODMAN_RUN) $(MAKE) $@ | ||||
| else | ||||
| 	PACKAGES="$$($(INSTALLER) --list-packages -c $(FILESYSTEM_CONFIG))" && \
 | ||||
| 	PACKAGES="$$($(LIST_PACKAGES) $(LIST_PACKAGES_OPTS) -c $(FILESYSTEM_CONFIG))" && \
 | ||||
| 	cd cookbook && \
 | ||||
| 	./fetch.sh "$${PACKAGES}" | ||||
| 	mkdir -p $(BUILD) | ||||
| 	touch $@ | ||||
| endif | ||||
| 
 | ||||
| $(BUILD)/repo.tag: $(BUILD)/fetch.tag $(FSTOOLS_TAG) $(CONTAINER_TAG) | ||||
| $(REPO_TAG): $(BUILD)/fetch.tag $(FSTOOLS_TAG) $(CONTAINER_TAG) | ||||
| ifeq ($(PODMAN_BUILD),1) | ||||
| 	$(PODMAN_RUN) $(MAKE) $@ | ||||
| else | ||||
| 	export PATH="$(PREFIX_PATH):$$PATH" && \
 | ||||
| 	PACKAGES="$$($(INSTALLER) --list-packages -c $(FILESYSTEM_CONFIG))" && \
 | ||||
| 	PACKAGES="$$($(LIST_PACKAGES) $(LIST_PACKAGES_OPTS) -c $(FILESYSTEM_CONFIG))" && \
 | ||||
| 	cd cookbook && \
 | ||||
| 	./repo.sh $(REPO_NONSTOP) "$${PACKAGES}" | ||||
| 	mkdir -p $(BUILD) | ||||
|  |  | |||
|  | @ -501,6 +501,67 @@ cargoInstall() { | |||
| 	fi | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| #################################################################################### | ||||
| # 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 gets the current build status from travis and prints | ||||
| # a message to the user | ||||
|  | @ -551,6 +612,10 @@ boot() | |||
| 	echo "---------------------------------------" | ||||
| 	statusCheck | ||||
| 	echo "The file redox/.config was created with PODMAN_BUILD=1." | ||||
| 	echo | ||||
| 	echo "** Be sure to update your path to include Rust - run the following command: **" | ||||
| 	echo 'source $HOME/.cargo/env' | ||||
| 	echo | ||||
| 	echo "Run the following commands to build redox using Podman:" | ||||
| 	echo | ||||
| 	echo "cd redox" | ||||
|  | @ -598,6 +663,8 @@ done | |||
| 
 | ||||
| banner | ||||
| 
 | ||||
| rustInstall "$noninteractive" | ||||
| 
 | ||||
| if [ "$update" == "true" ]; then | ||||
| 	git pull upstream master | ||||
| 	git submodule update --recursive --init | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ron Williams
						Ron Williams