forked from notion-enhancer/notion-repackaged
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·82 lines (72 loc) · 1.56 KB
/
install
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
set -e
# Install tool for Notion package
PREFIX="${PREFIX:-/usr}"
APP_NAME="${APP_NAME:-notion-app}"
_print_help() {
echo "usage: $(basename "$0") [options] <pkg dir>"
echo ""
echo " <pkg dir> path to the notion package root directory"
echo ""
echo " --prefix <prefix> set filesystem prefix (default: $PREFIX)"
echo " --app-name <app name> set app name (default: $APP_NAME)"
echo " useful when packaging for distros (i.e. change to"
echo " so.notion.Notion for flatpak)"
echo " --help print this help page"
}
if [ "$#" -lt 1 ]
then
echo "incorrect use!"
_print_help
exit 1
fi
if [ "$#" -eq 1 -a "$1" = "--help" ]
then
_print_help
exit 0
fi
while [ "$#" -gt 1 ]
do
if [ "$1" = "--prefix" ]
then
shift
if [ -z "$1" ]
then
echo "filesystem prefix option value not specified!"
_print_help
exit 1
fi
PREFIX="$1"
shift
elif [ "$1" = "--app-name" ]
then
shift
if [ -z "$1" ]
then
echo "app name option value not specified!"
_print_help
exit 1
fi
APP_NAME="$1"
shift
elif [ "$1" = "--help" ]
then
_print_help
exit 0
fi
done
PKGDIR="$1"
if [ ! -d "$PKGDIR" ]
then
echo "notion package directory '$PKGDIR' doesn't exist"
exit 1
fi
if [ ! -d "$PREFIX" ]
then
echo "prefix directory '$PREFIX' doesn't exist"
exit 1
fi
# Copy Notion package
cp -a -t "$PREFIX" "$PKGDIR"/*
# Patch Notion package
sed -i "s~@prefix@~$PREFIX~g" "$PREFIX/bin/notion-app"