Compare commits

..

3 commits

Author SHA1 Message Date
8b80663a32 fix: install composer packages even though --install=n is passed (#4)
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/reflect/install/pulls/4
2025-08-07 12:22:52 +02:00
vlw
366939068a doc(style): use h3 for main arguments in README (#3)
Reviewed-on: https://codeberg.org/reflect/install/pulls/3
Co-authored-by: vlw <victor@vlw.se>
Co-committed-by: vlw <victor@vlw.se>
2025-08-07 10:23:34 +02:00
vlw
ff5b177c67 feat: add optional --install named argument flag (#2)
This PR adds a new optional flag `--install` which when set to `--install=n` will skip download and installation of the Reflect git submodule.

Reviewed-on: https://codeberg.org/reflect/install/pulls/2
Co-authored-by: vlw <victor@vlw.se>
Co-committed-by: vlw <victor@vlw.se>
2025-08-07 10:22:02 +02:00
2 changed files with 29 additions and 7 deletions

View file

@ -21,7 +21,13 @@ curl -fsSL https://codeberg.org/reflect/install/raw/branch/master/install.sh | b
# Arguments
You can pass optional named arguments to this script for headless installation of Reflect.
## `--overwrite` - Overwrite existing configuration files
### `--install` - Don't install, only configure Reflect
```sh
./install.sh --install=n
```
Pass `--install=n` to prevent download and installation of the Reflect git submodule. Use this option if you're version controlling Reflect from your project repository.
### `--overwrite` - Overwrite existing configuration files
```sh
./install.sh --example=n
```

View file

@ -7,6 +7,7 @@ dir=""
host=""
user=""
seed=""
install=""
password=""
seed_host=""
seed_user=""
@ -48,12 +49,15 @@ install_reflect() {
exit 1
fi
# Download and install the Reflect repository
if [[ "$install" != "n" ]]; then
if ! [ -d "reflect" ] ; then
git submodule add https://codeberg.org/reflect/reflect
fi
# Update submodules
git submodule update --init --recursive
fi
# Install dependencies with composer
(cd reflect && composer install --classmap-authoritative)
@ -61,8 +65,15 @@ install_reflect() {
# Bail out if composer didn't create a vendor folder
if ! [ -d "reflect/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 Reflect repository. Or run without '--install=n'."
exit 1
fi
}
configure_reflect() {
@ -198,6 +209,7 @@ main() {
cwd=$(pwd)
check_sys_depend
install_reflect
configure_reflect
@ -232,6 +244,10 @@ for arg in "$@"; do
seed="${arg#*=}"
;;
--install=*)
install="${arg#*=}"
;;
--seed-host=*)
seed_host="${arg#*=}"
;;