diff --git a/README.md b/README.md index 9c047a3..bb8bd44 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,34 @@ # Vegvisir installer -This script will automatically install and configure Vegvisir from in a fresh git repository. +Run this script from a git repository to automatically install and configure Vegvisir as a git submodule to your project. -## Important -The script will only run on Linux environments with `coreutils` installed (for now). +> [!IMPORTANT] +> The script will only run in environments with Bash and `coreutils` installed (for now). # Get started -1. Create a repository for your website -2. Run this command from the root directory of your local repository +1. Create a git repository for your project. +2. Run this command from the root directory of your local repository. ```sh -curl -fsSL https://href.vlw.se/vegvisir/install | bash -``` \ No newline at end of file +curl -fsSL https://codeberg.org/vegvisir/install/raw/branch/master/install.sh | bash +``` + +# Arguments +You can pass optional named arguments to this script for headless installation of Vegvisir. + +## `--install` - Installation directory +```sh +./install.sh --install="/path/to/project" +``` +Pass an `--install` argument with a value of a directory Vegvisir should consider its [`root_path`](https://vegvisir.vlw.se/docs/Reference/Env#root_path). + +## `--override` - Overwrite configuration files +```sh +./install.sh --overwrite=y +``` +Pass `--overwrite=y` to replace existing Vegvisir configuration files. + +## `--example` - Generate example website +```sh +./install.sh --example=n +``` +Pass `--overwrite=n` to disable generation of an example website after installation. \ No newline at end of file diff --git a/install.sh b/install.sh index 894e19b..94ad5ef 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,10 @@ #!/bin/bash -# Get the current working directory -cwd=$(pwd) +# Initialize variables +cwd="" +install="" +example="" +overwrite="" echo_err() { echo "!! -> $1" @@ -33,7 +36,7 @@ check_sys_depend() { install_vegvisir() { if ! [ -d ".git" ] ; then - echo_err "Not in a git repository" + echo_err "Installation aborted: '$cwd' is not a git repository" exit 1 fi @@ -61,7 +64,7 @@ configure_vegvisir() { fi # A configuration file already exists - if [ -f "vegvisir/.env.ini" ] ; then + if [[ -f "vegvisir/.env.ini" && "$overwrite" != "y" ]] ; 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