2024-02-15 19:55:04 +00:00
|
|
|
#!/bin/bash
|
2024-02-15 21:49:23 +00:00
|
|
|
|
|
|
|
# Generate opening text.
|
|
|
|
cat <<EOF
|
|
|
|
|
|
|
|
* * * * *
|
|
|
|
|
|
|
|
Welcome!
|
|
|
|
|
|
|
|
The script will install hero and set the environment to work with mdbook.
|
|
|
|
This will take a couple of minutes.
|
|
|
|
|
|
|
|
* * * * *
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
# Disable "Pending kernel upgrade" and "Daemons using outdated libraries" windows
|
2024-02-15 19:55:04 +00:00
|
|
|
sed -i "s/#\$nrconf{kernelhints} = -1;/\$nrconf{kernelhints} = -1;/g" /etc/needrestart/needrestart.conf
|
|
|
|
sed -i "/#\$nrconf{restart} = 'i';/s/.*/\$nrconf{restart} = 'a';/" /etc/needrestart/needrestart.conf
|
2024-02-15 21:49:23 +00:00
|
|
|
|
|
|
|
# Update and install dependencies
|
|
|
|
apt-get update
|
|
|
|
apt-get install -y lsb-release gpg
|
2024-02-15 19:55:04 +00:00
|
|
|
curl https://sh.rustup.rs -sSf | sh -s -- -y
|
|
|
|
source "$HOME/.cargo/env"
|
|
|
|
export PATH=$PATH:/root/.cargo/bin
|
|
|
|
curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
|
|
|
|
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/redis.list
|
|
|
|
apt-get update
|
2024-02-15 21:49:23 +00:00
|
|
|
apt-get install -y redis pkg-config gcc libssl-dev
|
|
|
|
|
|
|
|
# Download and run the hero installer script
|
2024-02-15 19:55:04 +00:00
|
|
|
curl https://raw.githubusercontent.com/freeflowuniverse/crystallib/development/scripts/installer_hero.sh > /tmp/hero_install.sh
|
|
|
|
bash /tmp/hero_install.sh
|
2024-02-15 21:49:23 +00:00
|
|
|
|
|
|
|
# Start the SSH agent, run hero mdbook and build the mdbook
|
2024-02-15 19:55:04 +00:00
|
|
|
eval $(ssh-agent)
|
|
|
|
hero mdbook -u https://git.ourworld.tf/tfgrid/info_tfgrid/src/branch/main/heroscript
|
|
|
|
cd /root/hero/var/mdbuild/duniayetu
|
|
|
|
mdbook build
|
2024-02-15 21:49:23 +00:00
|
|
|
|
|
|
|
# Generate closing text after successful script.
|
2024-02-15 19:55:04 +00:00
|
|
|
cat <<EOF
|
|
|
|
|
|
|
|
* * * * *
|
|
|
|
|
|
|
|
The script has been successfully completed.
|
|
|
|
|
2024-02-15 21:49:23 +00:00
|
|
|
To see the mdbook live on your browser,
|
2024-02-15 19:55:04 +00:00
|
|
|
run the following command with the proper port (here we use 3333).
|
|
|
|
|
2024-02-15 21:49:23 +00:00
|
|
|
mdbook serve --hostname 0.0.0.0 --port 3333
|
2024-02-15 19:55:04 +00:00
|
|
|
|
|
|
|
Happy mdbooking!
|
|
|
|
|
|
|
|
* * * * *
|
|
|
|
|
|
|
|
EOF
|
2024-02-15 21:49:23 +00:00
|
|
|
|
|
|
|
# Send stderr to null and exit gracefully
|
2024-02-15 19:55:04 +00:00
|
|
|
return 2> /dev/null; exit
|