1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-22 01:47:08 +02:00

fix: shell scripts (#7186)

* fix: bash scripts

* pr feedback

* wrong variable

* ci: add shellcheck workflow

* fix: missing scripts
This commit is contained in:
martin 2024-02-19 00:03:01 +01:00 committed by GitHub
parent 4b46bb49d7
commit ddae707ea9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 65 additions and 37 deletions

View File

@ -277,6 +277,19 @@ jobs:
run: | run: |
poetry run pytest app --cov=app --cov-report term-missing poetry run pytest app --cov=app --cov-report term-missing
shellcheck:
name: ShellCheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
ignore_paths: >-
**/open-api/**
**/openapi/**
**/node_modules/**
generated-api-up-to-date: generated-api-up-to-date:
name: OpenAPI Clients name: OpenAPI Clients
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -1,15 +1,13 @@
#!/usr/bin/env bash
echo "Starting Immich installation..." echo "Starting Immich installation..."
ip_address=$(hostname -I | awk '{print $1}') ip_address=$(hostname -I | awk '{print $1}')
RED='\033[0;31m'
GREEN='\032[0;31m'
NC='\033[0m' # No Color
create_immich_directory() { create_immich_directory() {
echo "Creating Immich directory..." echo "Creating Immich directory..."
mkdir -p ./immich-app/immich-data mkdir -p ./immich-app/immich-data
cd ./immich-app cd ./immich-app || exit
} }
download_docker_compose_file() { download_docker_compose_file() {
@ -34,7 +32,7 @@ replace_env_value() {
populate_upload_location() { populate_upload_location() {
echo "Populating default UPLOAD_LOCATION value..." echo "Populating default UPLOAD_LOCATION value..."
upload_location=$(pwd)/immich-data upload_location=$(pwd)/immich-data
replace_env_value "UPLOAD_LOCATION" $upload_location replace_env_value "UPLOAD_LOCATION" "$upload_location"
} }
start_docker_compose() { start_docker_compose() {
@ -45,7 +43,7 @@ start_docker_compose() {
elif docker-compose > /dev/null 2>&1; then elif docker-compose > /dev/null 2>&1; then
docker_bin="docker-compose" docker_bin="docker-compose"
else else
echo 'Cannot find `docker compose` or `docker-compose`.' echo "Cannot find \`docker compose\` or \`docker-compose\`."
exit 1 exit 1
fi fi

View File

@ -1 +1,3 @@
g++ -shared -O3 -o libann.so -fuse-ld=gold -std=c++17 -I$ARMNN_PATH/include -larmnn -larmnnDeserializer -larmnnTfLiteParser -larmnnOnnxParser -L$ARMNN_PATH ann.cpp #!/usr/bin/env sh
g++ -shared -O3 -o libann.so -fuse-ld=gold -std=c++17 -I"$ARMNN_PATH"/include -larmnn -larmnnDeserializer -larmnnTfLiteParser -larmnnOnnxParser -L"$ARMNN_PATH" ann.cpp

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env sh
cd armnn-23.11/ cd armnn-23.11/ || exit
g++ -o ../armnnconverter -O1 -DARMNN_ONNX_PARSER -DARMNN_SERIALIZER -DARMNN_TF_LITE_PARSER -fuse-ld=gold -std=c++17 -Iinclude -Isrc/armnnUtils -Ithird-party -larmnn -larmnnDeserializer -larmnnTfLiteParser -larmnnOnnxParser -larmnnSerializer -L../armnn src/armnnConverter/ArmnnConverter.cpp g++ -o ../armnnconverter -O1 -DARMNN_ONNX_PARSER -DARMNN_SERIALIZER -DARMNN_TF_LITE_PARSER -fuse-ld=gold -std=c++17 -Iinclude -Isrc/armnnUtils -Ithird-party -larmnn -larmnnDeserializer -larmnnTfLiteParser -larmnnOnnxParser -larmnnSerializer -L../armnn src/armnnConverter/ArmnnConverter.cpp

View File

@ -1,6 +1,7 @@
#!/usr/bin/env sh #!/usr/bin/env sh
export LD_PRELOAD="/usr/lib/$(arch)-linux-gnu/libmimalloc.so.2" lib_path="/usr/lib/$(arch)-linux-gnu/libmimalloc.so.2"
export LD_PRELOAD="$lib_path"
export LD_BIND_NOW=1 export LD_BIND_NOW=1
: "${MACHINE_LEARNING_HOST:=0.0.0.0}" : "${MACHINE_LEARNING_HOST:=0.0.0.0}"
@ -10,8 +11,8 @@ export LD_BIND_NOW=1
gunicorn app.main:app \ gunicorn app.main:app \
-k app.config.CustomUvicornWorker \ -k app.config.CustomUvicornWorker \
-w $MACHINE_LEARNING_WORKERS \ -w "$MACHINE_LEARNING_WORKERS" \
-b $MACHINE_LEARNING_HOST:$MACHINE_LEARNING_PORT \ -b "$MACHINE_LEARNING_HOST":"$MACHINE_LEARNING_PORT" \
-t $MACHINE_LEARNING_WORKER_TIMEOUT \ -t "$MACHINE_LEARNING_WORKER_TIMEOUT" \
--log-config-json log_conf.json \ --log-config-json log_conf.json \
--graceful-timeout 0 --graceful-timeout 0

View File

@ -1,4 +1,4 @@
#/bin/bash #!/usr/bin/env bash
# #
# Pump one or both of the server/mobile versions in appropriate files # Pump one or both of the server/mobile versions in appropriate files
@ -25,10 +25,10 @@ while getopts 's:m:' flag; do
esac esac
done done
CURRENT_SERVER=$(cat server/package.json | jq -r '.version') CURRENT_SERVER=$(jq -r '.version' server/package.json)
MAJOR=$(echo $CURRENT_SERVER | cut -d '.' -f1) MAJOR=$(echo "$CURRENT_SERVER" | cut -d '.' -f1)
MINOR=$(echo $CURRENT_SERVER | cut -d '.' -f2) MINOR=$(echo "$CURRENT_SERVER" | cut -d '.' -f2)
PATCH=$(echo $CURRENT_SERVER | cut -d '.' -f3) PATCH=$(echo "$CURRENT_SERVER" | cut -d '.' -f3)
if [[ $SERVER_PUMP == "major" ]]; then if [[ $SERVER_PUMP == "major" ]]; then
MAJOR=$((MAJOR + 1)) MAJOR=$((MAJOR + 1))
@ -48,7 +48,7 @@ fi
NEXT_SERVER=$MAJOR.$MINOR.$PATCH NEXT_SERVER=$MAJOR.$MINOR.$PATCH
CURRENT_MOBILE=$(cat mobile/pubspec.yaml | grep "^version: .*+[0-9]\+$" | cut -d "+" -f2) CURRENT_MOBILE=$(grep "^version: .*+[0-9]\+$" mobile/pubspec.yaml | cut -d "+" -f2)
NEXT_MOBILE=$CURRENT_MOBILE NEXT_MOBILE=$CURRENT_MOBILE
if [[ $MOBILE_PUMP == "true" ]]; then if [[ $MOBILE_PUMP == "true" ]]; then
set $((NEXT_MOBILE++)) set $((NEXT_MOBILE++))
@ -61,9 +61,10 @@ fi
if [ "$CURRENT_SERVER" != "$NEXT_SERVER" ]; then if [ "$CURRENT_SERVER" != "$NEXT_SERVER" ]; then
echo "Pumping Server: $CURRENT_SERVER => $NEXT_SERVER" echo "Pumping Server: $CURRENT_SERVER => $NEXT_SERVER"
npm --prefix server version $SERVER_PUMP npm --prefix server version "$SERVER_PUMP"
npm --prefix web version "$SERVER_PUMP"
make open-api make open-api
poetry --directory machine-learning version $SERVER_PUMP poetry --directory machine-learning version "$SERVER_PUMP"
fi fi
if [ "$CURRENT_MOBILE" != "$NEXT_MOBILE" ]; then if [ "$CURRENT_MOBILE" != "$NEXT_MOBILE" ]; then
@ -75,4 +76,4 @@ sed -i "s/version_number: \"$CURRENT_SERVER\"$/version_number: \"$NEXT_SERVER\"/
sed -i "s/\"android\.injected\.version\.code\" => $CURRENT_MOBILE,/\"android\.injected\.version\.code\" => $NEXT_MOBILE,/" mobile/android/fastlane/Fastfile sed -i "s/\"android\.injected\.version\.code\" => $CURRENT_MOBILE,/\"android\.injected\.version\.code\" => $NEXT_MOBILE,/" mobile/android/fastlane/Fastfile
sed -i "s/^version: $CURRENT_SERVER+$CURRENT_MOBILE$/version: $NEXT_SERVER+$NEXT_MOBILE/" mobile/pubspec.yaml sed -i "s/^version: $CURRENT_SERVER+$CURRENT_MOBILE$/version: $NEXT_SERVER+$NEXT_MOBILE/" mobile/pubspec.yaml
echo "IMMICH_VERSION=v$NEXT_SERVER" >>$GITHUB_ENV echo "IMMICH_VERSION=v$NEXT_SERVER" >>"$GITHUB_ENV"

View File

@ -1,10 +1,10 @@
#!/usr/bin/env sh #!/usr/bin/env sh
# The default execution directory of this script is the ci_scripts directory. # The default execution directory of this script is the ci_scripts directory.
cd $CI_WORKSPACE/mobile cd "$CI_WORKSPACE"/mobile || exit
# Install Flutter using git. # Install Flutter using git.
git clone https://github.com/flutter/flutter.git --depth 1 -b stable $HOME/flutter git clone https://github.com/flutter/flutter.git --depth 1 -b stable "$HOME"/flutter
export PATH="$PATH:$HOME/flutter/bin" export PATH="$PATH:$HOME/flutter/bin"
# Install Flutter artifacts for iOS (--ios), or macOS (--macos) platforms. # Install Flutter artifacts for iOS (--ios), or macOS (--macos) platforms.
@ -14,7 +14,7 @@ flutter precache --ios
flutter pub get flutter pub get
# Install CocoaPods using Homebrew. # Install CocoaPods using Homebrew.
HOMEBREW_NO_AUTO_UPDATE=1 # disable homebrew's automatic updates. export HOMEBREW_NO_AUTO_UPDATE=1 # disable homebrew's automatic updates.
brew install cocoapods brew install cocoapods
# Install CocoaPods dependencies. # Install CocoaPods dependencies.

View File

@ -1,4 +1,6 @@
cd .isar #!/usr/bin/env sh
cd .isar || exit
bash tool/build_android.sh x86 bash tool/build_android.sh x86
bash tool/build_android.sh x64 bash tool/build_android.sh x64
bash tool/build_android.sh armv7 bash tool/build_android.sh armv7

View File

@ -1,2 +1,3 @@
#!/usr/bin/env bash #!/usr/bin/env bash
node /usr/src/app/node_modules/.bin/immich "$@" node /usr/src/app/node_modules/.bin/immich "$@"

View File

@ -1,2 +1,3 @@
#!/usr/bin/env sh #!/usr/bin/env sh
/usr/src/app/start.sh immich-admin $1
/usr/src/app/start.sh immich-admin "$1"

View File

@ -1,2 +1,3 @@
#!/usr/bin/env bash #!/usr/bin/env bash
node /usr/src/app/node_modules/.bin/nest start --debug "0.0.0.0:9230" --watch -- "$@" node /usr/src/app/node_modules/.bin/nest start --debug "0.0.0.0:9230" --watch -- "$@"

View File

@ -1,2 +1,3 @@
#!/usr/bin/env bash #!/usr/bin/env bash
node /usr/src/app/node_modules/.bin/jest --config e2e/$1/jest-e2e.json --runInBand
node /usr/src/app/node_modules/.bin/jest --config e2e/"$1"/jest-e2e.json --runInBand

View File

@ -1,35 +1,42 @@
#!/usr/bin/env sh #!/usr/bin/env sh
export LD_PRELOAD=/usr/lib/$(arch)-linux-gnu/libmimalloc.so.2 lib_path="/usr/lib/$(arch)-linux-gnu/libmimalloc.so.2"
export LD_PRELOAD="$lib_path"
if [ "$DB_URL_FILE" ]; then if [ "$DB_URL_FILE" ]; then
export DB_URL=$(cat $DB_URL_FILE) DB_URL_CONTENT=$(cat "$DB_URL_FILE")
export DB_URL="$DB_URL_CONTENT"
unset DB_URL_FILE unset DB_URL_FILE
fi fi
if [ "$DB_HOSTNAME_FILE" ]; then if [ "$DB_HOSTNAME_FILE" ]; then
export DB_HOSTNAME=$(cat $DB_HOSTNAME_FILE) DB_HOSTNAME_CONTENT=$(cat "$DB_HOSTNAME_FILE")
export DB_HOSTNAME="$DB_HOSTNAME_CONTENT"
unset DB_HOSTNAME_FILE unset DB_HOSTNAME_FILE
fi fi
if [ "$DB_DATABASE_NAME_FILE" ]; then if [ "$DB_DATABASE_NAME_FILE" ]; then
export DB_DATABASE_NAME=$(cat $DB_DATABASE_NAME_FILE) DB_DATABASE_CONTENT=$(cat "$DB_DATABASE_NAME_FILE")
export DB_DATABASE_NAME="$DB_DATABASE_CONTENT"
unset DB_DATABASE_NAME_FILE unset DB_DATABASE_NAME_FILE
fi fi
if [ "$DB_USERNAME_FILE" ]; then if [ "$DB_USERNAME_FILE" ]; then
export DB_USERNAME=$(cat $DB_USERNAME_FILE) DB_USERNAME_CONTENT=$(cat "$DB_USERNAME_FILE")
export DB_USERNAME="$DB_USERNAME_CONTENT"
unset DB_USERNAME_FILE unset DB_USERNAME_FILE
fi fi
if [ "$DB_PASSWORD_FILE" ]; then if [ "$DB_PASSWORD_FILE" ]; then
export DB_PASSWORD=$(cat $DB_PASSWORD_FILE) DB_PASSWORD_CONTENT=$(cat "$DB_PASSWORD_FILE")
export DB_PASSWORD="$DB_PASSWORD_CONTENT"
unset DB_PASSWORD_FILE unset DB_PASSWORD_FILE
fi fi
if [ "$REDIS_PASSWORD_FILE" ]; then if [ "$REDIS_PASSWORD_FILE" ]; then
export REDIS_PASSWORD=$(cat $REDIS_PASSWORD_FILE) REDIS_PASSWORD_CONTENT=$(cat "$REDIS_PASSWORD_FILE")
export DB_PASSWORD="$REDIS_PASSWORD_CONTENT"
unset REDIS_PASSWORD_FILE unset REDIS_PASSWORD_FILE
fi fi
exec node /usr/src/app/dist/main $@ exec node /usr/src/app/dist/main "$@"