From 180ad0ddd7024c80a43f4598ba5cb4654e11a864 Mon Sep 17 00:00:00 2001 From: mystie Date: Sat, 28 Sep 2024 00:37:27 +0300 Subject: [PATCH] update the buggy install script --- install.sh | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/install.sh b/install.sh index f507349..21a2a7e 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,6 @@ #!/usr/bin/bash -working_dir=~/tmp/catask +working_dir=~/.local/share/catask bold=$(tput bold) normal=$(tput sgr0) git_repo_url="https://git.mst.k.vu/mst/catask" @@ -14,7 +14,7 @@ echo "${bold}Cloning the repository...${normal}" # this might work... or not, who knows id -u catask >/dev/null 2>&1 || sudo useradd -r -s /bin/false -m -d /etc/catask -U catask # cloning dev branch for now because the installer doesn't exist in main branch yet -git clone $git_repo_url $working_dir --branch dev +sudo git clone $git_repo_url $working_dir --branch dev cd $working_dir echo echo "${bold}Creating & activating virtual environment...${normal}" @@ -25,8 +25,8 @@ echo pip install -r requirements.txt # move to /etc/catask after installing packages -sudo mv $working_dir /etc/ -working_dir="/etc/catask" +# sudo mv $working_dir /etc/ +# working_dir="/etc/catask" # check if redis is installed if ! command -v redis-cli 2>&1 >/dev/null; then @@ -44,11 +44,11 @@ if ! command -v redis-cli 2>&1 >/dev/null; then sudo chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list sudo apt-get update - sudo apt-get install redis + sudo apt-get install redis -y ;; fedora) # standard redis install instructions from https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-linux/#install-on-red-hatrocky - sudo dnf install redis + sudo dnf install redis -y sudo systemctl enable redis sudo systemctl start redis ;; @@ -62,7 +62,6 @@ fi echo echo "${bold}Configuring CatAsk...${normal}" -cd $working_dir cp $working_dir/.env.example $working_dir/.env; cp $working_dir/config.example.json $working_dir/config.json echo read -n 1 -s -r -p "Press any key to open main config file..." @@ -73,11 +72,9 @@ nano .env echo echo "${bold}Initializing the database...${normal}" if flask init-db; then : ; else - # echo 'If the error is "MySQL Connection not available." then you can safely ignore it' - echo "Otherwise, create an issue at ${git_repo_issue_url}" + echo "An error has occurred: create an issue at ${bold}${git_repo_issue_url}${normal}" read -p "Proceed? (y/N) " proceed_after_error proceed_after_error="${proceed_after_error,,}" - echo $proceed_after_error if [[ "$proceed_after_error" == 'y' ]]; then echo "Proceeding..." else