finalize hard reset for starter script
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
This commit is contained in:
parent
6ae3fd6291
commit
141f05ddab
@ -80,6 +80,29 @@ extract_seed() {
|
|||||||
echo $seed
|
echo $seed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
downgrade_compiler_if_needed() {
|
||||||
|
# TODO: uncomment later
|
||||||
|
# echo "[+] fetching the latest ghost-node source code"
|
||||||
|
# git switch main
|
||||||
|
# git pull origin main
|
||||||
|
|
||||||
|
# 1.83.0 works fine, tested with:
|
||||||
|
# ...
|
||||||
|
# 1.87.0 throws errors during compilation
|
||||||
|
# 1.88.0 throws errors during compilation
|
||||||
|
LATEST_TESTED_VERSION=83
|
||||||
|
cargo_version=$(cargo --version | cut -d'.' -f2)
|
||||||
|
if [ "$cargo_version" -gt "$LATEST_TESTED_VERSION" ]; then
|
||||||
|
echo "[+] downgrading rustc compiler version to 1.83.0"
|
||||||
|
rustup default 1.83.0
|
||||||
|
toolchain_name=$(rustup show | grep default | head -n 1 | cut -d' ' -f1)
|
||||||
|
rustup target add wasm32-unknown-unknown --toolchain $toolchain_name
|
||||||
|
rustup component add rust-src --toolchain $toolchain_name
|
||||||
|
else
|
||||||
|
echo "[+] rustc compiler version is compatible"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
help() {
|
help() {
|
||||||
echo -e "Ghost Node Build automation tool. Helper for Ghost Node environment preparation.\n"
|
echo -e "Ghost Node Build automation tool. Helper for Ghost Node environment preparation.\n"
|
||||||
echo -e "With no OPTION nothing will happen, possible OPTION:\n"
|
echo -e "With no OPTION nothing will happen, possible OPTION:\n"
|
||||||
@ -195,22 +218,11 @@ if [[ $HARD_RESET = true ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $PROJECT_FOLDER
|
downgrade_compiler_if_needed
|
||||||
# TODO: uncomment later
|
|
||||||
# echo "[+] fetching the latest ghost-node source code"
|
|
||||||
# git switch main
|
|
||||||
# git pull origin main
|
|
||||||
|
|
||||||
# rustc version control, this works fine
|
|
||||||
# cargo --version | cut -d'.' -f2, if higher then do
|
|
||||||
# rustup default 1.83.0
|
|
||||||
# rustup target add wasm32-unknown-unknown --toolchain 1.83.0-x86_64-unknown-linux-gnu
|
|
||||||
# rustup component add rust-src --toolchain 1.83.0-x86_64-unknown-linux-gnu
|
|
||||||
#
|
|
||||||
# I think we need to do clean before recompilation
|
|
||||||
# cargo clean
|
|
||||||
|
|
||||||
cd $PROJECT_FOLDER
|
cd $PROJECT_FOLDER
|
||||||
|
echo "[+] clean build cache..."
|
||||||
|
cargo clean
|
||||||
echo "[+] starting build in 3 seconds..."
|
echo "[+] starting build in 3 seconds..."
|
||||||
sleep 3
|
sleep 3
|
||||||
cargo build $RELEASE $FEATURES
|
cargo build $RELEASE $FEATURES
|
||||||
@ -228,8 +240,9 @@ if [[ $HARD_RESET = true ]]; then
|
|||||||
echo "[+] ghost executable copied in '$EXECUTABLE_PATH' from '$TARGET'"
|
echo "[+] ghost executable copied in '$EXECUTABLE_PATH' from '$TARGET'"
|
||||||
echo "[+] specification '$SPECIFICATION_NAME.json' copied to '$SPECIFICATION_PATH'"
|
echo "[+] specification '$SPECIFICATION_NAME.json' copied to '$SPECIFICATION_PATH'"
|
||||||
|
|
||||||
echo "[+] starting ghost-node"
|
# TODO: uncomment later
|
||||||
sudo systemctl start ghost-node
|
# echo "[+] starting ghost-node"
|
||||||
|
# sudo systemctl start ghost-node
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@ -312,13 +325,12 @@ if [[ $SET_ENVIRONMENT = true ]]; then
|
|||||||
|
|
||||||
if prompt "[?] setup the rust environment (e.g. WASM support)?"; then
|
if prompt "[?] setup the rust environment (e.g. WASM support)?"; then
|
||||||
rustup default stable
|
rustup default stable
|
||||||
rustup update
|
downgrade_compiler_if_needed
|
||||||
rustup target add wasm32-unknown-unknown
|
|
||||||
rustup component add rust-src
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -z $RELEASE ]]; then
|
if [[ ! -z $RELEASE ]]; then
|
||||||
|
downgrade_compiler_if_needed
|
||||||
if prompt "[?] 'cargo build $RELEASE $FEATURES' is what you want?"; then
|
if prompt "[?] 'cargo build $RELEASE $FEATURES' is what you want?"; then
|
||||||
cd $PROJECT_FOLDER
|
cd $PROJECT_FOLDER
|
||||||
echo "[+] starting build in 3 seconds..."
|
echo "[+] starting build in 3 seconds..."
|
||||||
|
Loading…
Reference in New Issue
Block a user