Skip to content

Commit

Permalink
Add checks to commands and symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
ronilaukkarinen committed Nov 5, 2024
1 parent 487b166 commit 6daf386
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@

### [Unreleased]

* Add checks to commands and symlinks

### 2.4.8: 2024-06-25

* Fix fatal error with unexisting function countPlugins()
Expand Down
45 changes: 36 additions & 9 deletions bin/tasks/certs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,44 @@ echo "${YELLOW}Ensuring mkcert is installed...${TXTRESET}"
cd "$PROJECTS_HOME/$PROJECTNAME/"
if [ ! -f /usr/local/bin/mkcert ]; then
echo "${YELLOW}Installing mkcert${TXTRESET}"
sudo apt update
sudo apt install linuxbrew-wrapper -y
brew update
brew install mkcert

# Just to make sure it's installed:
brew install mkcert
# Check if apt update succeeds
if ! sudo apt update; then
echo "${RED}Failed to update apt${TXTRESET}"
exit 1
fi

# Link
sudo ln -s /home/linuxbrew/.linuxbrew/bin/mkcert /usr/local/bin/mkcert
sudo chmod +x /usr/local/bin/mkcert
# Install linuxbrew-wrapper
if ! sudo apt install linuxbrew-wrapper -y; then
echo "${RED}Failed to install linuxbrew-wrapper${TXTRESET}"
exit 1
fi

# Update brew
if ! brew update; then
echo "${RED}Failed to update brew${TXTRESET}"
exit 1
fi

# Install mkcert
if ! brew install mkcert; then
echo "${RED}Failed to install mkcert${TXTRESET}"
exit 1
fi

# Create symlink if it doesn't exist
if [ ! -L /usr/local/bin/mkcert ]; then
if ! sudo ln -s /home/linuxbrew/.linuxbrew/bin/mkcert /usr/local/bin/mkcert; then
echo "${RED}Failed to create symlink for mkcert${TXTRESET}"
exit 1
fi
fi

# Make executable
if ! sudo chmod +x /usr/local/bin/mkcert; then
echo "${RED}Failed to make mkcert executable${TXTRESET}"
exit 1
fi
fi

echo "${YELLOW}Ensuring dhparam is generated...${TXTRESET}"
Expand Down

0 comments on commit 6daf386

Please sign in to comment.