-
Notifications
You must be signed in to change notification settings - Fork 10
/
install.sh
51 lines (42 loc) · 1.23 KB
/
install.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
#!/usr/bin/env bash
# Installs an extracted version of a notion
# tarball generated by build.sh
set -euo pipefail
# INSTALL_DIR is the directory where Notion will be installed.
INSTALL_DIR="/opt/notion"
WORKING_DIR=$(pwd)
# create_shortcut creates a shortcut for the current user
# to launch Notion from the desktop.
create_shortcut() {
cat <<EOS >Notion.desktop
[Desktop Entry]
Name=Notion
Name[en_US]=Notion
Comment=Unofficial Notion application for Linux
Exec="/opt/notion/notion"
Terminal=false
Categories=Office;TextEditor;Utility
Type=Application
Icon=${WORKING_DIR}/Notion_app_logo.png
StartupWMClass=notion
EOS
chmod +x Notion.desktop
# This can be updated if this path is not valid.
cp -p Notion.desktop "$HOME/.local/share/applications"
}
install_notion() {
if [[ -e "$INSTALL_DIR" ]]; then
echo "Error: $INSTALL_DIR already exists" >&2
exit 1
fi
topDir="$(dirname "$INSTALL_DIR")"
if [[ ! -w "$topDir" ]]; then
echo "Error: $topDir is not writable. Re-run with sudo?" >&2
exit 1
fi
mkdir -p "$INSTALL_DIR"
# Copy all files in the current directory to the install directory.
cp -rvp ./* "$INSTALL_DIR"
# Install the notion script to /usr/bin/notion
ln -s "$INSTALL_DIR/notion" /usr/bin/notion
}