summaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
authorAndrew Guschin <saintruler@gmail.com>2020-07-10 13:27:05 +0400
committerAndrew Guschin <saintruler@gmail.com>2020-07-10 13:27:05 +0400
commit758ea780c00e7bc9e11b223d89db94a977507e66 (patch)
tree82a37a654434302d3bb97936fde8883bc7edde79 /build.sh
Added files for building unityhub .deb packageHEADmaster
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh45
1 files changed, 45 insertions, 0 deletions
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."