38 lines
1.2 KiB
Bash
Executable File
38 lines
1.2 KiB
Bash
Executable File
|
|
# clone the repository
|
|
git clone https://git.nxs.solutions/Fast/FastFlask.git lib
|
|
|
|
# ask the user for the location where to setup Fast
|
|
read -p "Enter the full path where you want to set up Fast (e.g., /opt/fast): " FAST_PATH
|
|
# if the user input is empty, use /opt/fast as default
|
|
|
|
if [ -z "$FAST_PATH" ]; then
|
|
FAST_PATH="/opt/fast"
|
|
fi
|
|
|
|
# create the directory if it doesn't exist
|
|
sudo mkdir -p "$FAST_PATH"
|
|
sudo cp -r lib/* $FAST_PATH
|
|
sudo cp -r lib/.docker/ $FAST_PATH/.docker/
|
|
|
|
# remove the .git directory to detach from the original repository
|
|
echo "Removing .git directory to detach from the original repository..."
|
|
sudo rm -r lib
|
|
|
|
# check if FAST_PATH is in .bashrc, if not, add it and source .bashrc
|
|
if ! grep -q "export FAST_PATH=" ~/.bashrc; then
|
|
echo "export FAST_PATH=$FAST_PATH" >> ~/.bashrc
|
|
echo 'export PATH=$FAST_PATH/bin:$PATH' >> ~/.bashrc
|
|
source ~/.bashrc
|
|
echo "FAST_PATH added to .bashrc and sourced."
|
|
else
|
|
echo "FAST_PATH already exists in .bashrc."
|
|
echo "Overwriting FAST_PATH in .bashrc..."
|
|
sed -i "s|^export FAST_PATH=.*$|export FAST_PATH=$FAST_PATH|" ~/.bashrc
|
|
source ~/.bashrc
|
|
echo "FAST_PATH updated in .bashrc and sourced."
|
|
fi
|
|
|
|
sudo chown -R $USER:root $FAST_PATH
|
|
echo "Fast has been set up at $FAST_PATH"
|