forked from 4v3ngR/immich-native-macos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.sh
executable file
·42 lines (34 loc) · 971 Bytes
/
uninstall.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
set -eux
# shellcheck disable=SC1091
. Scripts/config.env
delete_user() {
echo "INFO: deleting user"
sudo dscl . -delete "/Groups/$IMMICH_GROUP"
sudo dscl . -delete "/Users/$IMMICH_USER"
}
uninstall_daemons() {
echo "INFO: uninstalling daemons"
sudo launchctl bootout system /Library/LaunchDaemons/com.immich.machine.learning.plist
sudo launchctl bootout system /Library/LaunchDaemons/com.immich.plist
sudo rm -f /Library/LaunchDaemons/com.immich*plist
}
delete_postgres_db() {
echo "INFO: deleting PostgreSQL immich user and database"
psql-17 postgres << EOF
drop database immich;
drop user immich;
EOF
}
echo "WARNING: this will remove the Immich database and the complete installation directory, including the uploads directory"
echo "Continue? (y/n) "
read -r yn
case "$yn" in
[Yy]*) ;;
*) exit;;
esac
uninstall_daemons
delete_postgres_db
delete_user
echo "INFO: deleting $IMMICH_INSTALL_DIR"
sudo rm -rf "$IMMICH_INSTALL_DIR"