#!/bin/bash LATEST_TESTED_VERSION=83 DEPENDENCY_PATH=~/.local/share/cargo/git/checkouts/polkadot-sdk-dee0edd6eefa0594/b401690/substrate/primitives/io/src/lib.rs cargo_version=$(cargo --version | cut -d'.' -f2) if [ "$cargo_version" -gt "$LATEST_TESTED_VERSION" ]; then if grep -q '#\[no_mangle\]' "$DEPENDENCY_PATH"; then sed -i '/#\[no_mangle\]/d' "$DEPENDENCY_PATH" echo "[+] patch-2 will be applied: remove unnecessary #[no_mangle] from the source code for sp-io" else echo "[+] patch-2 already applied: #[no_mangle] already removed from source code of sp-io" fi else echo "[+] patch-2 not needed: rustc compiler version is compatible" fi