-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstaller.sh
39 lines (32 loc) · 1.04 KB
/
installer.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
#!/bin/bash
# Installer for OptiCPU on Linux systems
# Define paths and file names
INSTALL_DIR="/usr/local/bin"
EXECUTABLE_NAME="opticpu"
SOURCE_FILE_URL="https://raw.githubusercontent.com/felipealfonsog/OptiCPU/main/src/opticpu.c"
# Download the source file
echo "Welcome to OptiCPU installer"
echo "----------------------------"
echo "Downloading the source file..."
wget -O "${EXECUTABLE_NAME}.c" "$SOURCE_FILE_URL"
if [ $? -ne 0 ]; then
echo "Error: Failed to download the source file."
exit 1
fi
# Compile the program
echo "Compiling the program..."
gcc -o "$EXECUTABLE_NAME" "${EXECUTABLE_NAME}.c"
if [ $? -ne 0 ]; then
echo "Error: Failed to compile the program."
exit 1
fi
# Move the executable to the installation directory
echo "Installing the program to $INSTALL_DIR..."
sudo mv "$EXECUTABLE_NAME" "$INSTALL_DIR"
if [ $? -ne 0 ]; then
echo "Error: Failed to move the executable to $INSTALL_DIR."
exit 1
fi
# Clean up temporary files
rm -f "${EXECUTABLE_NAME}.c"
echo "OptiCPU has been successfully installed to $INSTALL_DIR."