Skip to content

Commit

Permalink
fix: add EMACS_DIRECTORY directory existence checks
Browse files Browse the repository at this point in the history
Add checks to ensure the EMACS_DIRECTORY exists
  • Loading branch information
KarimAziev committed May 3, 2024
1 parent a023528 commit f05ef64
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions build-emacs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,23 @@ pull_emacs() {
}

remove_emacs() {
cd "$EMACS_DIRECTORY" || exit 1
echo "Uninstalling Emacs"
sudo make uninstall
echo "Cleaning Emacs"
sudo make extraclean
if [ -d "$EMACS_DIRECTORY" ]; then
cd "$EMACS_DIRECTORY" || exit 1
echo "Uninstalling Emacs"
sudo make uninstall
echo "Cleaning Emacs"
sudo make extraclean
fi
}

build_emacs() {
cd "$EMACS_DIRECTORY" || exit 1
if [ ! -d "$EMACS_DIRECTORY" ]; then
echo >&2 "build_emacs: Error - Directory '$EMACS_DIRECTORY' doesn't exist."
exit 1
else
cd "$EMACS_DIRECTORY"
echo "Building Emacs"
fi

./autogen.sh
./configure \
Expand All @@ -237,7 +245,13 @@ build_emacs() {
}

install_emacs() {
cd "$EMACS_DIRECTORY" || exit 1
if [ ! -d "$EMACS_DIRECTORY" ]; then
echo >&2 "install_emacs: Error - Directory '$EMACS_DIRECTORY' doesn't exist."
exit 1
else
cd "$EMACS_DIRECTORY"
echo "Installing Emacs"
fi
sudo make install
}

Expand Down

0 comments on commit f05ef64

Please sign in to comment.