-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
129 lines (103 loc) · 5.01 KB
/
install.sh
File metadata and controls
129 lines (103 loc) · 5.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
set -e
# === Helper function ===
echo_info() {
echo -e "\n\033[1;34m[INFO]\033[0m $1\n"
}
PROJECT_ROOT="$(dirname "$(realpath "$0")")"
# Update packages and install required tools
sudo apt update -y && \
sudo apt install -y python3-pip unzip tree qemu-utils dosfstools && \
pip3 install gdown
# === Step 1: Create main project directory ===
echo_info "Creating /root/qubic directory..."
mkdir -p /root/qubic
# === Step 2: Download VHD and extract in background ===
echo_info "Downloading 32GBVHD.zip from Google Drive..."
gdown --id 1Qz-axY4AmGCL_JVjBdYVBYFdNqJ8T05B --no-cookies --quiet
echo_info "Extracting 32GBVHD.zip to /root/qubic (in background)..."
unzip -o 32GBVHD.zip -d /root/qubic/ &
bg_unzip_pid=$!
# === Step 3: Download base206.zip and extract ===
echo_info "Downloading base206.zip from Google Drive..."
gdown --id 1etZDX3dvn4f7Kh4IWhhfcahbM8heVHTV --no-cookies --quiet
mkdir -p /root/qubic/filesForVHD
unzip -o base206.zip -d /root/qubic/filesForVHD
# === Step 4: Download and install libvpx7 ===
echo_info "Downloading and installing libvpx7..."
gdown --id 1q7loi8oFfKa-TSLuuMMGBjP2BYm-OxWH --no-cookies --quiet
dpkg -i libvpx7_1.11.0-2ubuntu2.3_amd64.deb || apt -f install -y
# === Step 5: Install system dependencies ===
echo_info "Installing system packages..."
apt update
apt install -y sshpass freerdp2-x11 git libxcb-cursor0 cmake make build-essential \
gcc-12 g++-12 dkms linux-headers-$(uname -r) gcc perl docker.io curl
# === Step 6: Create mount directory ===
sudo mkdir -p /mnt/qubic
# === Step 7: Install VirtualBox and Extension Pack ===
echo_info "Installing VirtualBox and Extension Pack..."
wget https://download.virtualbox.org/virtualbox/7.1.4/virtualbox-7.1_7.1.4-165100~Ubuntu~jammy_amd64.deb
wget https://download.virtualbox.org/virtualbox/7.1.4/Oracle_VirtualBox_Extension_Pack-7.1.4.vbox-extpack
dpkg -i virtualbox-7.1_7.1.4-165100~Ubuntu~jammy_amd64.deb || apt -f install -y
VBoxManage extpack install Oracle_VirtualBox_Extension_Pack-7.1.4.vbox-extpack --accept-license=eb31505e56e9b4d0fbca139104da41ac6f6b98f8e78968bdf01b1f3da3c4f9ae
modprobe -r vboxnetflt vboxnetadp vboxpci vboxdrv || true
/sbin/vboxconfig || true
# === Step 8: Install Docker Compose ===
echo_info "Installing Docker Compose..."
curl -L "https://github.com/docker/compose/releases/download/v2.26.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
# === Step 9: Clone repositories ===
echo_info "Cloning GitHub repositories..."
cd /root/qubic
git clone https://github.com/icyblob/qubic_docker.git
git clone https://github.com/icyblob/qubic-efi-cross-build.git
git clone https://github.com/qubic/qlogging.git
git clone https://github.com/qubic/qubic-cli.git
# === Step 10: Build qubic-cli ===
echo_info "Building qubic-cli..."
cd /root/qubic/qubic-cli
mkdir -p build && cd build
cmake ../
make
# === Step 11: Build qlogging ===
echo_info "Building qlogging..."
cd /root/qubic/qlogging
mkdir -p build && cd build
cmake ../
make
# === Step 12: Move configuration files ===
echo_info "Placing configuration files..."
cp "$PROJECT_ROOT/config.yaml" /root/qubic/qubic-efi-cross-build/
cp "$PROJECT_ROOT/seeds.txt" /root/qubic/qubic-efi-cross-build/
cp "$PROJECT_ROOT/seedsMN.txt" /root/qubic/qubic-efi-cross-build/ || true
cp -r "$PROJECT_ROOT/scripts" /root/qubic/
cp "$PROJECT_ROOT/build.ps1" /root/qubic/qubic-efi-cross-build/
cp "$PROJECT_ROOT/run_win_build.sh" /root/qubic/qubic-efi-cross-build/
cp "$PROJECT_ROOT/configMN.yaml" /root/qubic/qubic-efi-cross-build/
echo -e "127.0.0.1\n$(hostname -I | awk '{print $1}')" > /root/qubic/qubic-efi-cross-build/peers.txt
cp "$PROJECT_ROOT/peersMN.txt" /root/qubic/qubic-efi-cross-build/
cp "$PROJECT_ROOT/cleanup.sh" /root/qubic/qubic_docker/
cp "$PROJECT_ROOT/deploy.sh" /root/qubic/qubic_docker/
cp "$PROJECT_ROOT/qubic-cli" /root/qubic/qubic_docker/
cp "$PROJECT_ROOT/restart_network.sh" /root/qubic/qubic_docker/
cp "$PROJECT_ROOT/docker-compose.yaml" /root/qubic/qubic_docker/
mkdir -p /root/qubic/qubic_docker/spectrumData/
cp "$PROJECT_ROOT/qubic-stats-processor" /root/qubic/qubic_docker/spectrumData/
cp "$PROJECT_ROOT/setupSpectrumData.sh" /root/qubic/qubic_docker/spectrumData/
cp /root/qubic/filesForVHD/spectrum.175 /root/qubic/qubic_docker/spectrumData/
mkdir -p /root/qubic/filesForVHDMN
# === Step 13: Patch docker-compose.yaml with current IP ===
echo_info "Updating docker-compose.yaml with server IP..."
server_ip=$(hostname -I | awk '{print $1}')
sed -i 's|^\(\s*QUBIC_EVENTS_POOL_NODE_PASSCODES:\s*"\).*|\1'"$server_ip"':AAAAAAAAAAEAAAAAAAAAAgAAAAAAAAADAAAAAAAAAAQ="|' /root/qubic/qubic_docker/docker-compose.yaml
sed -i "s/\"IP\"/\"$server_ip\"/" /root/qubic/qubic_docker/docker-compose.yaml
# === Step 14: Frontend setu ===
echo "Running frontend setup script..."
bash "$PROJECT_ROOT/setup_frontend.sh"
# === Step 15: Set permissions ===
echo_info "Setting execution permissions..."
chmod -R +x /root/qubic/
# === Final: Wait for unzip ===
echo_info "Waiting for VHD unzip to finish..."
wait $bg_unzip_pid
echo_info "Setup completed successfully."