Conditionally detect Git tags and do a shallow clone

Closes: #20

Signed-off-by: Juhyung Park <qkrwngud825@gmail.com>
This commit is contained in:
Juhyung Park
2024-10-17 11:54:07 +09:00
parent a5defc61bb
commit 90f3a53f7c
2 changed files with 9 additions and 4 deletions

View File

@@ -8,7 +8,7 @@ This repository provides instructions and helper scripts to install [Immich](htt
* This guide installs Immich to `/var/lib/immich`. To change it, replace it to the directory you want in this README and `install.sh`'s `$IMMICH_PATH`.
* The [install.sh](install.sh) script currently is using Immich v1.117.0. It should be noted that due to the fast-evolving nature of Immich, the install script may get broken if you replace the `$TAG` to something more recent.
* The [install.sh](install.sh) script currently is using Immich v1.117.0. It should be noted that due to the fast-evolving nature of Immich, the install script may get broken if you replace the `$REV` to something more recent.
* `mimalloc` is deliberately disabled as this is a native install and sharing system library makes more sense.

View File

@@ -2,7 +2,7 @@
set -xeuo pipefail
TAG=v1.117.0
REV=v1.117.0
IMMICH_PATH=/var/lib/immich
APP=$IMMICH_PATH/app
@@ -41,9 +41,14 @@ mkdir -p $IMMICH_PATH/home
echo 'umask 077' > $IMMICH_PATH/home/.bashrc
TMP=/tmp/immich-$(uuidgen)
git clone https://github.com/immich-app/immich $TMP
if [[ $REV =~ ^[0-9A-Fa-f]+$ ]]; then
# REV is a full commit hash, full clone is required
git clone https://github.com/immich-app/immich $TMP
else
git clone https://github.com/immich-app/immich $TMP --depth=1 -b $REV
fi
cd $TMP
git reset --hard $TAG
git reset --hard $REV
rm -rf .git
# Use 127.0.0.1