forked from pbek/QOwnNotes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.command
More file actions
executable file
·81 lines (61 loc) · 1.9 KB
/
update.command
File metadata and controls
executable file
·81 lines (61 loc) · 1.9 KB
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
#!/usr/bin/env bash
################################################
#
# QOwnNotes macOS updater script
#
################################################
#diskImageUrl="https://github.com/pbek/QOwnNotes/releases/download/macosx-b2381-103543/QOwnNotes-16.10.10.dmg"
#diskImageUrl="https://github.com/pbek/QOwnNotes/releases/download/macosx-b2376-114124/QOwnNotes-16.10.9.dmg"
#diskImageUrl="$1"
# QOwnNotes will parse the text: "$QOWNNOTES_RELEASE_URL"
diskImageUrl="$QOWNNOTES_RELEASE_URL"
#applicationsFolder="/Applications"
#applicationsFolder="$2"
# QOwnNotes will parse the text: "$QOWNNOTES_APPLICATIONS_PATH"
applicationsFolder="$QOWNNOTES_APPLICATIONS_PATH"
# https://bash.cyberciti.biz/guide/$IFS
IFS="
"
die () {
echo >&2 "$@"
read -p "Press [Enter] key to end..."
exit 1
}
echo "QOwnNotes macOS updater script"
echo
# check if we have 2 parameters
#[ "$#" -eq 2 ] || die "2 arguments required, $# provided"
if [ -z "$diskImageUrl" ]; then
die "diskImageUrl is empty"
fi
if [ -z "$applicationsFolder" ]; then
die "applicationsFolder is empty"
fi
tempDir=`mktemp -d` && cd $tempDir
mountPoint=`mktemp -d`
diskImage="QOwnNotes.dmg"
echo "Created temporary directory $tempDir"
echo "Downloading $diskImageUrl..."
echo
# downloading dmg
curl -L -o $diskImage $diskImageUrl
# mounting dmg
hdiutil attach -mountpoint $mountPoint $diskImage
# copy app to application folder
app="$mountPoint/QOwnNotes.app"
echo Syncing "$app" to applications folder
rsync -a --progress "$app" "$applicationsFolder"
# unmounting dmg
hdiutil detach $mountPoint
echo "Removing temporary files..."
rm $tempDir/$diskImage
rmdir $tempDir
rmdir $mountPoint
echo "Listing content of QOwnNotes.app..."
find "$applicationsFolder/QOwnNotes.app"
echo "Starting QOwnNotes..."
sleep 2
# open "$applicationsFolder/QOwnNotes.app"
"$applicationsFolder/QOwnNotes.app/Contents/MacOS/QOwnNotes" &
echo "Removing temporary script..."
rm $0