fix: install composer dependencies when --install=n is passed (#9)

Composer packages should still be installed even if the `--install=n` flag is set. The only thing "--install=n" won't do is download and add git submodules

Reviewed-on: https://codeberg.org/vegvisir/install/pulls/9
This commit is contained in:
Victor Westerlund 2025-08-07 12:30:25 +02:00
parent ce6d7fae60
commit f0c03d6b15

View file

@ -41,12 +41,15 @@ install_vegvisir() {
exit 1 exit 1
fi fi
if ! [ -d "vegvisir" ] ; then # Download and install the Vegvisir repository
git submodule add https://codeberg.org/vegvisir/vegvisir if [[ "$install" != "n" ]]; then
fi if ! [ -d "vegvisir" ] ; then
git submodule add https://codeberg.org/vegvisir/vegvisir
fi
# Update submodules # Update submodules
git submodule update --init --recursive git submodule update --init --recursive
fi
# Install dependencies with composer # Install dependencies with composer
(cd vegvisir && composer install --classmap-authoritative) (cd vegvisir && composer install --classmap-authoritative)
@ -54,7 +57,14 @@ install_vegvisir() {
# Bail out if composer didn't create a vendor folder # Bail out if composer didn't create a vendor folder
if ! [ -d "vegvisir/vendor" ] ; then if ! [ -d "vegvisir/vendor" ] ; then
echo_err "Something went wrong with the installation." echo_err "Something went wrong with the installation."
exit_report
# Script was not run with the install flag disabled, this is probably a bug
if [[ "$install" != "n" ]]; then
exit_report
fi
echo_err "Make sure you have cloned the Vegvisir repository. Or run without '--install=n'."
exit 1
fi fi
} }
@ -65,12 +75,14 @@ configure_vegvisir() {
fi fi
# A configuration file already exists # A configuration file already exists
if [[ -f "vegvisir/.env.ini" && "$overwrite" != "y" ]] ; then if [[ -f "vegvisir/.env.ini" ]] ; then
echo "A Vegvisir configuration file already exists at: ${cwd}/vegvisir/.env.ini" if ! [[ -n "$overwrite" ]]; then
read -p "Do you want to overwrite this file? (y/n): " choice </dev/tty echo "A Vegvisir configuration file already exists at: ${cwd}/vegvisir/.env.ini"
read -p "Do you want to overwrite this file? (y/n): " overwrite </dev/tty
fi
# Check the user's response # Check the user's response
if [[ "$choice" == "y" || "$choice" == "Y" ]] ; then if [[ "$overwrite" == "y" || "$overwrite" == "Y" ]] ; then
echo "Removing existing Vegvisir configuration and proceeding with the installation in ${cwd}..." echo "Removing existing Vegvisir configuration and proceeding with the installation in ${cwd}..."
rm vegvisir/.env.ini rm vegvisir/.env.ini
else else
@ -157,12 +169,8 @@ main() {
# Get the current working directory # Get the current working directory
cwd=$(pwd) cwd=$(pwd)
# Download and install the Vegvisir repository check_sys_depend
if [[ "$install" != "n" ]]; then install_vegvisir
check_sys_depend
install_vegvisir
fi
configure_vegvisir configure_vegvisir
echo "Vegvisir has been sucessfully installed." echo "Vegvisir has been sucessfully installed."