summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO7
-rw-r--r--PKGBUILD17
-rwxr-xr-xunity-editor-beta54
-rw-r--r--unity-editor-beta.install12
4 files changed, 83 insertions, 7 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 470925b0e65b..23523521f79e 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,8 +1,9 @@
pkgbase = unity-editor-beta
pkgdesc = The world's most popular development platform for creating 2D and 3D multiplatform games and interactive experiences.
pkgver = 2019.1.0a12
- pkgrel = 1
+ pkgrel = 2
url = https://unity3d.com/
+ install = unity-editor-beta.install
arch = x86_64
license = custom
depends = desktop-file-utils
@@ -27,6 +28,8 @@ pkgbase = unity-editor-beta
optdepends = unity-editor-beta-windows
optdepends = unity-editor-beta-facebook
optdepends = visual-studio-code-bin
+ optdepends = unityhub
+ optdepends = jq: needed for UnityHub integration helpers --register/--deregister
options = !strip
source = 2019.1.0a12.tar.xz::https://beta.unity3d.com/download/5175bce2e5d4/LinuxEditorInstaller/Unity.tar.xz
source = unity-editor-beta
@@ -34,7 +37,7 @@ pkgbase = unity-editor-beta
source = unity-editor-beta-icon.png
source = eula.txt
md5sums = eee04fe02f11b9c5a930ecf8de99b0c0
- md5sums = a0705606b7f36a6f1e4bc01be16336b1
+ md5sums = bac8a19031259cc585e602b115bae784
md5sums = 03837b6962d1050bbaf29b76e0f257e3
md5sums = 723f9e556821810682a6d1f4be540a74
md5sums = 24f6741eba3d591a0761f3c92e3cc1f7
diff --git a/PKGBUILD b/PKGBUILD
index de8b8bd355bb..43f827bfc94b 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,7 +4,7 @@ _prefix=/opt/UnityBeta
pkgname=unity-editor-beta
pkgver=2019.1.0a12
-pkgrel=1
+pkgrel=2
pkgdesc="The world's most popular development platform for creating 2D and 3D multiplatform games and interactive experiences."
arch=('x86_64')
url='https://unity3d.com/'
@@ -30,14 +30,17 @@ optdepends=("${pkgname}-doc"
"${pkgname}-webgl"
"${pkgname}-windows"
"${pkgname}-facebook"
- "visual-studio-code-bin")
+ "visual-studio-code-bin"
+ "unityhub"
+ "jq: needed for UnityHub integration helpers --register/--deregister")
+install=${pkgname}.install
source=("2019.1.0a12.tar.xz::https://beta.unity3d.com/download/5175bce2e5d4/LinuxEditorInstaller/Unity.tar.xz"
"${pkgname}"
"${pkgname}.desktop"
"${pkgname}-icon.png"
"eula.txt")
-md5sums=("eee04fe02f11b9c5a930ecf8de99b0c0"
- 'a0705606b7f36a6f1e4bc01be16336b1'
+md5sums=('eee04fe02f11b9c5a930ecf8de99b0c0'
+ 'bac8a19031259cc585e602b115bae784'
'03837b6962d1050bbaf29b76e0f257e3'
'723f9e556821810682a6d1f4be540a74'
'24f6741eba3d591a0761f3c92e3cc1f7')
@@ -55,7 +58,11 @@ package() {
find "${pkgdir}${_prefix}/Editor/Data" -type d -exec chmod ga+rx {} \;
# Add version to desktop file
- sed -i "/^Version=/c\Version=${_version}${_build}" "${srcdir}/${pkgname}.desktop"
+ sed -i "/^Version=/c\Version=${pkgver}" "${srcdir}/${pkgname}.desktop"
+
+ # Add version/name to launch script
+ sed -i "s/%PKGNAME%/${pkgname}/g" "${srcdir}/${pkgname}"
+ sed -i "s/%PKGVER%/${pkgver}/g" "${srcdir}/${pkgname}"
install -Dm644 -t "${pkgdir}/usr/share/applications" "${srcdir}/${pkgname}.desktop"
install -Dm644 -t "${pkgdir}/usr/share/icons/hicolor/256x256/apps" "${srcdir}/${pkgname}-icon.png"
diff --git a/unity-editor-beta b/unity-editor-beta
index 34c58d7265ff..6488e534398f 100755
--- a/unity-editor-beta
+++ b/unity-editor-beta
@@ -1,5 +1,59 @@
#!/bin/sh
+unityhub_editors_path="$HOME/.config/UnityHub"
+unityhub_editors_json="$unityhub_editors_path/editors.json"
+
+check_jq() {
+ hash jq 2> /dev/null
+ if [ $? -ne 0 ]; then
+ echo "ERROR: You need to install 'jq' to register/deregister %PKGNAME% with unithub"
+ exit 1
+ fi
+}
+
+check_unityhub() {
+ local unityhub_pids=$(pgrep unityhub)
+ if [ ! -z "$unityhub_pids" ]; then
+ echo "ERROR: Can't UnityHub config while it's running. Close all Unity/UnityHub processes and try again."
+ exit 1
+ fi
+}
+
+ensure_json() {
+ if [ ! -f "$unityhub_editors_json" ] || [ ! -s "$unityhub_editors_json" ]; then
+ mkdir -p "$unityhub_editors_path"
+ echo "{}" > "$unityhub_editors_json"
+ fi
+}
+
+unityhub_remove() {
+ local oldentries=$(cat "$unityhub_editors_json" \
+ | jq 'to_entries[] | select(.value.location == ["/usr/bin/%PKGNAME%"]) | [.key?]' \
+ | jq -cs '.')
+ cat "$unityhub_editors_json" | jq -c "delpaths($oldentries)" > /tmp/editors.json
+ mv /tmp/editors.json "$unityhub_editors_json"
+}
+
+unityhub_add() {
+ unityhub_remove
+ cat "$unityhub_editors_json" | jq -c ". + {\"%PKGVER%\":{version:\"%PKGVER%\",location:[\"/usr/bin/%PKGNAME%\"],manual:true}}" > /tmp/editors.json
+ mv /tmp/editors.json "$unityhub_editors_json"
+}
+
+if [ "$1" == "--register" ]; then
+ check_jq
+ check_unityhub
+ ensure_json
+ unityhub_add
+ exit 0
+elif [ "$1" == "--deregister" ]; then
+ check_jq
+ check_unityhub
+ ensure_json
+ unityhub_remove
+ exit 0
+fi
+
# This prevents the editor from crashing when opening projects in some systems
unset GTK_IM_MODULE
diff --git a/unity-editor-beta.install b/unity-editor-beta.install
new file mode 100644
index 000000000000..2949eec045f7
--- /dev/null
+++ b/unity-editor-beta.install
@@ -0,0 +1,12 @@
+unityhub_msg() {
+ echo "To integrate with UnityHub you can run 'unity-editor-beta --register' after every update."
+ echo "To remove the integration you can run 'unity-editor-beta --deregister' or manually remove the entry in UnityHub's GUI."
+}
+
+post_install() {
+ unityhub_msg
+}
+
+post_upgrade() {
+ unityhub_msg
+}