|
@@ -1,5 +1,7 @@
|
|
|
#!/bin/bash
|
|
|
|
|
|
+source bin/functions.sh
|
|
|
+
|
|
|
if [ -f bin/install.cfg ]; then
|
|
|
echo "File install.cfg already exists"
|
|
|
else
|
|
@@ -7,24 +9,26 @@ else
|
|
|
max_attempts=3
|
|
|
|
|
|
while [ $attempts -lt $max_attempts ]; do
|
|
|
- read -p "File install.cfg does not exist. Do you want to create it? (y/n) [default: y]: " answer
|
|
|
+ echo_error "File install.cfg does not exist."
|
|
|
+
|
|
|
+ read -p "Do you want to create it? (y/n) [default: y]: " answer
|
|
|
|
|
|
if [[ "$answer" == "y" || "$answer" == "Y" ]]; then
|
|
|
cp bin/install.cfg.example bin/install.cfg
|
|
|
- echo "File install.cfg was successfully created"
|
|
|
- echo "Restart install.sh script after editing install.cfg"
|
|
|
+ echo_success "File install.cfg was successfully created"
|
|
|
+ echo_warning "Restart install.sh script after editing install.cfg"
|
|
|
exit 0
|
|
|
elif [[ "$answer" == "n" || "$answer" == "N" ]]; then
|
|
|
- echo "Error: You need to create the file manually and then continue."
|
|
|
+ echo_error "Error: You need to create the file manually and then continue."
|
|
|
echo "cp /bin/install.cfg.example to /bin/install.cfg with your settings."
|
|
|
exit 1
|
|
|
else
|
|
|
attempts=$((attempts + 1))
|
|
|
- echo "Invalid input. Please enter 'y' or 'n'. Attempt $attempts of $max_attempts."
|
|
|
+ echo_error "Invalid input. Please enter 'y' or 'n'. Attempt $attempts of $max_attempts."
|
|
|
fi
|
|
|
done
|
|
|
|
|
|
- echo "Exceeded maximum attempts. Exiting."
|
|
|
+ echo_error "Exceeded maximum attempts. Exiting."
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
@@ -38,14 +42,14 @@ update_repository() {
|
|
|
|
|
|
if [ -d "$repo_dir" ]; then
|
|
|
# If the directory exists, then do a git pull
|
|
|
- echo "Updating $repo_dir..."
|
|
|
+ echo_warning "Updating $repo_dir..."
|
|
|
cd "$repo_dir" || exit
|
|
|
git checkout $repo_branch
|
|
|
git pull
|
|
|
cd - || exit
|
|
|
else
|
|
|
# If the directory does not exist, then do a git clone
|
|
|
- echo "Cloning $repo_url into $repo_dir..."
|
|
|
+ echo_warning "Cloning $repo_url into $repo_dir..."
|
|
|
git clone -b "$repo_branch" "$repo_url" "$repo_dir"
|
|
|
fi
|
|
|
}
|
|
@@ -84,9 +88,9 @@ if [ -f conf/sharix_open.service ]; then
|
|
|
echo "File sharix_open.service already exists"
|
|
|
else
|
|
|
cp conf/sharix_open.service.example conf/sharix_open.service
|
|
|
- echo "File sharix_open.service was successfully created"
|
|
|
- echo "Write the settings for systemd service."
|
|
|
- echo "Restart install.sh script after editing."
|
|
|
+ echo_success "File sharix_open.service was successfully created"
|
|
|
+ echo "Write the settings for systemd service, if you want."
|
|
|
+ echo_warning "To continue, restart the install.sh"
|
|
|
exit
|
|
|
fi
|
|
|
|