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
fi
# Download and install the Vegvisir repository
if [[ "$install" != "n" ]]; then
if ! [ -d "vegvisir" ] ; then
git submodule add https://codeberg.org/vegvisir/vegvisir
fi
# Update submodules
git submodule update --init --recursive
fi
# Install dependencies with composer
(cd vegvisir && composer install --classmap-authoritative)
@ -54,8 +57,15 @@ install_vegvisir() {
# Bail out if composer didn't create a vendor folder
if ! [ -d "vegvisir/vendor" ] ; then
echo_err "Something went wrong with the installation."
# 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
}
configure_vegvisir() {
@ -65,12 +75,14 @@ configure_vegvisir() {
fi
# A configuration file already exists
if [[ -f "vegvisir/.env.ini" && "$overwrite" != "y" ]] ; then
if [[ -f "vegvisir/.env.ini" ]] ; then
if ! [[ -n "$overwrite" ]]; then
echo "A Vegvisir configuration file already exists at: ${cwd}/vegvisir/.env.ini"
read -p "Do you want to overwrite this file? (y/n): " choice </dev/tty
read -p "Do you want to overwrite this file? (y/n): " overwrite </dev/tty
fi
# 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}..."
rm vegvisir/.env.ini
else
@ -157,12 +169,8 @@ main() {
# Get the current working directory
cwd=$(pwd)
# Download and install the Vegvisir repository
if [[ "$install" != "n" ]]; then
check_sys_depend
install_vegvisir
fi
configure_vegvisir
echo "Vegvisir has been sucessfully installed."