diff options
Diffstat (limited to 'build.sh')
| -rwxr-xr-x | build.sh | 45 |
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." |