mirror of
https://github.com/immich-app/immich.git
synced 2024-11-21 18:16:55 +02:00
fix install.sh add random password for .env (#9282)
* fix install.sh add random password for .env * fix generate random password * remove comment
This commit is contained in:
parent
3d4ae9c210
commit
462f0f76a4
39
install.sh
39
install.sh
@ -2,14 +2,15 @@
|
|||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
create_immich_directory() { local -r Tgt='./immich-app'
|
create_immich_directory() {
|
||||||
|
local -r Tgt='./immich-app'
|
||||||
echo "Creating Immich directory..."
|
echo "Creating Immich directory..."
|
||||||
if [[ -e $Tgt ]]; then
|
if [[ -e $Tgt ]]; then
|
||||||
echo "Found existing directory $Tgt, will overwrite YAML files"
|
echo "Found existing directory $Tgt, will overwrite YAML files"
|
||||||
else
|
else
|
||||||
mkdir "$Tgt" || return
|
mkdir "$Tgt" || return
|
||||||
fi
|
fi
|
||||||
cd "$Tgt" || return
|
cd "$Tgt" || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
download_docker_compose_file() {
|
download_docker_compose_file() {
|
||||||
@ -22,6 +23,16 @@ download_dot_env_file() {
|
|||||||
"${Curl[@]}" "$RepoUrl"/example.env -o ./.env
|
"${Curl[@]}" "$RepoUrl"/example.env -o ./.env
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generate_random_password() {
|
||||||
|
echo "Generate random password for .env file..."
|
||||||
|
rand_pass=$(echo "$RANDOM$(date)$RANDOM" | sha256sum | base64 | head -c10)
|
||||||
|
if [ -z "$rand_pass" ]; then
|
||||||
|
sed -i -e "s/DB_PASSWORD=postgres/DB_PASSWORD=postgres${RANDOM}${RANDOM}/" ./.env
|
||||||
|
else
|
||||||
|
sed -i -e "s/DB_PASSWORD=postgres/DB_PASSWORD=${rand_pass}/" ./.env
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
start_docker_compose() {
|
start_docker_compose() {
|
||||||
echo "Starting Immich's docker containers"
|
echo "Starting Immich's docker containers"
|
||||||
|
|
||||||
@ -66,11 +77,25 @@ main() {
|
|||||||
return 14
|
return 14
|
||||||
fi
|
fi
|
||||||
|
|
||||||
create_immich_directory || { echo 'error creating Immich directory'; return 10; }
|
create_immich_directory || {
|
||||||
download_docker_compose_file || { echo 'error downloading Docker Compose file'; return 11; }
|
echo 'error creating Immich directory'
|
||||||
download_dot_env_file || { echo 'error downloading .env'; return 12; }
|
return 10
|
||||||
start_docker_compose || { echo 'error starting Docker'; return 13; }
|
}
|
||||||
return 0; }
|
download_docker_compose_file || {
|
||||||
|
echo 'error downloading Docker Compose file'
|
||||||
|
return 11
|
||||||
|
}
|
||||||
|
download_dot_env_file || {
|
||||||
|
echo 'error downloading .env'
|
||||||
|
return 12
|
||||||
|
}
|
||||||
|
generate_random_password
|
||||||
|
start_docker_compose || {
|
||||||
|
echo 'error starting Docker'
|
||||||
|
return 13
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
Exit=$?
|
Exit=$?
|
||||||
|
Loading…
Reference in New Issue
Block a user