From 758ea780c00e7bc9e11b223d89db94a977507e66 Mon Sep 17 00:00:00 2001 From: Andrew Guschin Date: Fri, 10 Jul 2020 13:27:05 +0400 Subject: Added files for building unityhub .deb package --- .gitignore | 4 ++++ DEBIAN/control | 7 +++++++ DEBIAN/postinst | 3 +++ build.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 .gitignore create mode 100644 DEBIAN/control create mode 100755 DEBIAN/postinst create mode 100755 build.sh 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 +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." -- cgit v1.2.3