-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall-importbot.sh
83 lines (69 loc) · 2.31 KB
/
install-importbot.sh
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
#!/bin/bash
echo "Welcome to ImportBot Installer"
# Check if Node.js is installed
if ! command -v node &> /dev/null
then
echo "Node.js is not installed. Please install Node.js and try again."
exit 1
fi
# Check if npm is installed
if ! command -v npm &> /dev/null
then
echo "npm is not installed. Please install npm and try again."
exit 1
fi
# Ask for installation directory
read -p "Enter the directory where you want to install ImportBot (default: current directory): " install_dir
install_dir=${install_dir:-$(pwd)}
# Create directory if it doesn't exist
mkdir -p "$install_dir"
cd "$install_dir"
# Clone the repository
echo "Cloning ImportBot repository..."
git clone https://github.com/yourusername/importbot.git
cd importbot
# Install dependencies
echo "Installing dependencies..."
npm install
# Ask for GitHub token
read -p "Enter your GitHub token: " github_token
echo "GITHUB_TOKEN=$github_token" > .env.local
# Ask for port number
read -p "Enter the port number you want to use (default: 3000): " port
port=${port:-3000}
echo "PORT=$port" >> .env.local
# Build the project
echo "Building the project..."
npm run build
# Ask if user wants to use screen for hosting
read -p "Do you want to use screen for hosting? (y/n): " use_screen
if [[ $use_screen == "y" || $use_screen == "Y" ]]
then
# Check if screen is installed
if ! command -v screen &> /dev/null
then
echo "Screen is not installed. Installing screen..."
if command -v apt-get &> /dev/null
then
sudo apt-get update
sudo apt-get install screen -y
elif command -v yum &> /dev/null
then
sudo yum install screen -y
else
echo "Unable to install screen automatically. Please install screen manually and run the script again."
exit 1
fi
fi
# Create a screen session and start the server
echo "Starting ImportBot in a screen session..."
screen -dmS importbot bash -c "cd $install_dir/importbot && npm start"
echo "ImportBot is now running in a screen session named 'importbot'"
echo "To attach to the session, use: screen -r importbot"
else
# Start the server normally
echo "Starting ImportBot..."
npm start
fi
echo "ImportBot installation complete!"
echo "You can access ImportBot at http://localhost:$port"