summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--DEBIAN/control7
-rwxr-xr-xDEBIAN/postinst3
-rwxr-xr-xbuild.sh45
4 files changed, 59 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b9735b9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+*.deb
+*.tar.gz
+unityhub-package*
+*.AppImage
diff --git a/DEBIAN/control b/DEBIAN/control
new file mode 100644
index 0000000..783ff5f
--- /dev/null
+++ b/DEBIAN/control
@@ -0,0 +1,7 @@
+Package: unityhub
+Version: version
+Provides: unityhub
+Maintainer: Andrew Guschin <saintruler@gmail.com>
+Architecture: all
+Section: misc
+Description: Unity Hub application
diff --git a/DEBIAN/postinst b/DEBIAN/postinst
new file mode 100755
index 0000000..2507a94
--- /dev/null
+++ b/DEBIAN/postinst
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+ln -sf "/opt/unityhub/unityhub" "/usr/bin/unityhub"
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..b1869a4
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+base_dir="$(dirname $(readlink -f "$0") )"
+version="2.3.2-1"
+pkg_name="unityhub"
+pkg_folder="$base_dir/$pkg_name-package"
+
+# Downloading package files
+pkg_url="https://public-cdn.cloud.unity3d.com/hub/prod/UnityHub.AppImage"
+echo "Downloading sources..."
+wget "$pkg_url" -O "$base_dir/unityhub-${version}.AppImage"
+
+echo "Extracting files..."
+chmod +x "unityhub-${version}.AppImage"
+"./unityhub-${version}.AppImage" --appimage-extract
+chmod 775 "$base_dir/squashfs-root"
+
+echo "Preparing package config..."
+mkdir -p "$pkg_folder/opt"
+mkdir -p "$pkg_folder/usr/share/pixmaps"
+mkdir -p "$pkg_folder/usr/share/applications"
+cp -r "$base_dir/DEBIAN" "$pkg_folder"
+
+echo "Copying package files..."
+cp "$base_dir/squashfs-root/unityhub.png" "$pkg_folder/usr/share/pixmaps"
+cp "$base_dir/squashfs-root/unityhub.desktop" "$pkg_folder/usr/share/applications"
+mv "$base_dir/squashfs-root" "$pkg_folder/opt/unityhub"
+
+sed -i "s/Version:.*/Version: $version-1/g" "$pkg_folder/DEBIAN/control"
+sed -i "s/version=\".*\"/version=\"$version\"/g" "$pkg_folder/DEBIAN/postinst"
+sed -i "s/Exec=AppRun/Exec=unityhub \%u/g" "$pkg_folder/usr/share/applications/unityhub.desktop"
+sed -i "s/^SCRIPT_DIR.*$/SCRIPT_DIR=\"\/opt\/unityhub\"/g" "$pkg_folder/opt/unityhub/unityhub"
+
+chmod 755 -R "$pkg_folder/opt/unityhub/resources"
+
+rm -r "$pkg_folder/opt/unityhub/AppRun" \
+ "$pkg_folder/opt/unityhub/unityhub.desktop" \
+ "$pkg_folder/opt/unityhub/usr/share" \
+ "$pkg_folder"/opt/unityhub/LICENSE*
+
+# Building .deb file
+echo "Building package..."
+cd "$base_dir"
+fakeroot dpkg-deb --build "$pkg_folder"
+echo "done."