-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.sh
executable file
·58 lines (47 loc) · 1.1 KB
/
start.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env bash
get_device_path() {
REGEX='^PATH="(.+)" LABEL="vonk"*'
DEVICES="$(lsblk --pairs --output path,label --shell)"
echo "$DEVICES" | while read DEVICE
do
if [[ $DEVICE =~ $REGEX ]]
then
DEVICE_PATH="${BASH_REMATCH[1]}"
echo $DEVICE_PATH
fi
done
}
source .venv/bin/activate
if [[ $VONK_ENV == production ]] || [[ $* == --production ]]
then
VONK_MOUNT_POINT=/media/vonk-storage
else
VONK_MOUNT_POINT=storage
fi
export VONK_MOUNT_POINT=$VONK_MOUNT_POINT
if [[ $* == --frontend-only ]]
then
exec pnpm next dev
exit
fi
if [[ $* == --remote ]]
then
export RUN_LOCATION=remote
fi
if [[ $VONK_ENV == production ]] || [[ $* == --production ]]
then
if [[ ! -d "build" ]]
then
echo "Error starting, build the VONK project first! (pnpm run build)"
exit 1
fi
sudo mkdir -p $VONK_MOUNT_POINT
sudo mount $(get_device_path) $VONK_MOUNT_POINT -o uid=$USER -o gid=$USER
mkdir -p $VONK_MOUNT_POINT/photos
cd build
export NODE_ENV=production
exec node index.js
else
mkdir -p $VONK_MOUNT_POINT/photos
exec pnpm nodemon src/runtime/index.ts
fi