-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart-wiki
executable file
·36 lines (30 loc) · 974 Bytes
/
start-wiki
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
#!/bin/bash
sudo apt update
# Function to install Node.js and npm
install_node_npm() {
echo "Node.js and npm not found. Installing..."
# Add NodeSource repository and install Node.js (this installs npm automatically)
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
echo "Node.js and npm installed successfully."
}
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
install_node_npm
else
echo "Node.js is already installed. Version: $(node -v)"
fi
# Check if npm is installed
if ! command -v npm &> /dev/null; then
echo "npm not found, but Node.js is installed. Installing npm..."
sudo apt install -y npm
echo "npm installed successfully."
else
echo "npm is already installed. Version: $(npm -v)"
fi
# Start the wiki server
# https://github.com/smlhelp/book
npm install
npm start
# Open the wiki in the default web browser
xdg-open http://localhost:3000/book/