-
Notifications
You must be signed in to change notification settings - Fork 6
/
build_pare.sh
executable file
·55 lines (44 loc) · 1.26 KB
/
build_pare.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
#!/bin/bash
set -e
ELECTRON_VERSION=11.3.0
EVERNOTE_VERSION=10.21.5-win-ddl-ga-2931
EVERNOTE_BINARY=evernote.exe
BUILD_ARCH=${1:-x64}
PACKAGE_ARCH=${2:-amd64}
BUILD_DIR=build-$BUILD_ARCH
PATH="node_modules/.bin:$PATH"
check-command() {
if ! command -v "$1" >/dev/null 2>&1; then
echo Missing command: "$1"
exit 1
fi
}
commands=(node npm 7z fakeroot dpkg g++ make)
# Check for required commands
for command in "${commands[@]}"; do
check-command "$command"
done
# Install NPM dependencies
if ! [ -d node_modules ]; then
npm install
fi
# Download Evernote executable
if ! [ -f $EVERNOTE_BINARY ]; then
origin=https://cdn1.evernote.com/boron/win/builds
wget "$origin/Evernote-$EVERNOTE_VERSION-setup.exe" -O evernote.exe
fi
# Setup the build directory
mkdir -p "$BUILD_DIR"
# Extract the Evernote executable
if ! [ -f "$BUILD_DIR/evernote-exe/\$PLUGINSDIR/app-64.7z" ]; then
7z x $EVERNOTE_BINARY -o"$BUILD_DIR/evernote-exe"
fi
# Extract the app bundle
if ! [ -f "$BUILD_DIR/app-bundle/resources/app.asar" ]; then
7z x "$BUILD_DIR/evernote-exe/\$PLUGINSDIR/app-64.7z" -o"$BUILD_DIR"/app-bundle
fi
# Extract the app container
if ! [ -d "$BUILD_DIR/app-unpacked" ]; then
asar extract \
"$BUILD_DIR/app-bundle/resources/app.asar" "$BUILD_DIR/app-unpacked"
fi