summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Zhang2019-03-14 14:35:55 +0800
committerBruce Zhang2019-03-14 14:35:55 +0800
commitc550ffa91286970dc05215f3e90098dec92e12b0 (patch)
tree9a91fa59ae682c66627ccae436ae3921d91af105
parent71b07138ae8d912a3ae30d17f46fa9cb39f832f7 (diff)
downloadaur-c550ffa91286970dc05215f3e90098dec92e12b0.tar.gz
ubport-installer: change source
Signed-off-by: Bruce Zhang <zttt183525594@gmail.com>
-rw-r--r--.SRCINFO27
-rw-r--r--.gitignore5
-rw-r--r--PKGBUILD65
-rw-r--r--rootless.patch21
-rw-r--r--ubports-installer.desktop8
-rw-r--r--ubports-installer.install7
-rw-r--r--ubports-installer.sh2
7 files changed, 99 insertions, 36 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 45ced73ef56..7ff815698e5 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,16 +1,25 @@
pkgbase = ubports-installer
- pkgdesc = Install Ubuntu Touch on Your Device
+ pkgdesc = A simple tool to install Ubuntu Touch on UBports devices
pkgver = 0.1.21_beta
- pkgrel = 3
- epoch = 1
- url = https://ubuntu-touch.io/get-ut
- install = ubports-installer.install
- arch = x86_64
+ pkgrel = 4
+ url = https://github.com/ubports/ubports-installer
+ arch = any
license = GPL3
- depends = gconf
+ makedepends = git
+ makedepends = jq
+ makedepends = npm
depends = android-tools
- source = https://github.com/ubports/ubports-installer/releases/download/0.1.21-beta/ubports-installer_0.1.21-beta_amd64.deb
- md5sums = 9f9667278991d35e64cc7286d23b439f
+ depends = android-udev
+ depends = electron
+ conflicts = ubports-installer-git
+ source = https://github.com/ubports/ubports-installer/archive/0.1.21-beta.tar.gz
+ source = ubports-installer.sh
+ source = ubports-installer.desktop
+ source = rootless.patch
+ sha512sums = 75b0f62c482e78925f9b9428d589d6c133b7693190e0de5de4f0efd8ce6d3f46f2fb3fa619850be6a4b227ca5ff0ddba77e1f33e9058d92f3b19632ce7c7ca90
+ sha512sums = d622cfe1f01d1ef0fc89c6d05e655f0396133142a3244353cc43dbefb493ac0e896f4927e350cda5138b4b369975e5755552f5dfaef53dee209af5eb1d90f5f2
+ sha512sums = 87d6760633d83b5d02abd3f54619fa1082a2f1a69be85ee010b2e552f6a926888c37aacb9b71d75b06d87311942dc219a3e51afd758cb2b9985a0bcb1d9a0455
+ sha512sums = 5e1a99f7bde3fd7b5b6b22d771421520e360f5f133fdc78ed35eea03969aa0f379df1ab720c792fd2c7155e92e4ccb70db9e77732ecedbb60e4ab294c8ea7107
pkgname = ubports-installer
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000000..14d14a41ad3
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*.part
+src
+pkg
+*.tar.gz
+*.pkg.tar.xz
diff --git a/PKGBUILD b/PKGBUILD
index 71c8919d73f..09d38b6e37b 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,29 +1,54 @@
+# Contributor: Matthias Lisin <ml@visu.li>
# Maintainer: Bruce Zhang <zttt183525594@gmail.com>
pkgname=ubports-installer
-_pkgcode=0.1.21
-_pkgstate=beta
-pkgver=${_pkgcode}_${_pkgstate}
-_pkgver=${_pkgcode}-${_pkgstate}
-pkgrel=3
-epoch=1
-pkgdesc="Install Ubuntu Touch on Your Device"
-arch=('x86_64')
-url="https://ubuntu-touch.io/get-ut"
+pkgver=0.1.21_beta
+pkgrel=4
+pkgdesc='A simple tool to install Ubuntu Touch on UBports devices'
+arch=(any)
+url='https://github.com/ubports/ubports-installer'
license=('GPL3')
-makedepends=()
-depends=('gconf' 'android-tools')
-install=ubports-installer.install
-source=("https://github.com/ubports/ubports-installer/releases/download/${_pkgver}/ubports-installer_${_pkgver}_amd64.deb")
-md5sums=('9f9667278991d35e64cc7286d23b439f')
+depends=('android-tools' 'android-udev' 'electron')
+makedepends=('git' 'jq' 'npm')
+conflicts=('ubports-installer-git')
+source=("https://github.com/ubports/ubports-installer/archive/${pkgver/_/-}.tar.gz"
+ ubports-installer.sh
+ ubports-installer.desktop
+ rootless.patch)
+sha512sums=('75b0f62c482e78925f9b9428d589d6c133b7693190e0de5de4f0efd8ce6d3f46f2fb3fa619850be6a4b227ca5ff0ddba77e1f33e9058d92f3b19632ce7c7ca90'
+ 'd622cfe1f01d1ef0fc89c6d05e655f0396133142a3244353cc43dbefb493ac0e896f4927e350cda5138b4b369975e5755552f5dfaef53dee209af5eb1d90f5f2'
+ '87d6760633d83b5d02abd3f54619fa1082a2f1a69be85ee010b2e552f6a926888c37aacb9b71d75b06d87311942dc219a3e51afd758cb2b9985a0bcb1d9a0455'
+ '5e1a99f7bde3fd7b5b6b22d771421520e360f5f133fdc78ed35eea03969aa0f379df1ab720c792fd2c7155e92e4ccb70db9e77732ecedbb60e4ab294c8ea7107')
prepare() {
- cd "$srcdir"
- # ar -x "ubports-installer_${_pkgver}_amd64.deb"
- mkdir "${pkgname}-${pkgver}"
- tar -Jxf data.tar.xz --directory="${srcdir}/${pkgname}-${pkgver}"
+ local cache="$srcdir/npm-cache"
+ local dist=/usr/lib/electron
+
+ patch -p1 -d "$pkgname-${pkgver/_/-}" < rootless.patch
+
+ cd "$pkgname-${pkgver/_/-}"
+ jq '.electronDist = $dist | .electronVersion = $version' \
+ --arg dist "$dist" \
+ --arg version "$(sed s/^v// $dist/version)" \
+ buildconfig-generic.json > new-buildconfig.json
+ mv new-buildconfig.json buildconfig-generic.json
+
+ npm uninstall --no-audit --cache "$cache" electron{,-packager,-sudo,-view-renderer} spectron
+}
+
+build() {
+ cd "$pkgname-${pkgver/_/-}"
+ node build.js --build-to-dir --linux --no-platform-tools
}
package() {
- cd "${srcdir}/${pkgname}-${pkgver}"
- find ./{opt,usr} -type f -exec install -Dm755 {} "${pkgdir}/{}" \;
+ install -Dm644 ubports-installer.desktop "$pkgdir/usr/share/applications/ubports-installer.desktop"
+ install -Dm755 ubports-installer.sh "$pkgdir/usr/bin/ubports-installer"
+
+ cd "$srcdir/$pkgname-${pkgver/_/-}/build/icons"
+ for i in *x*.png; do
+ install -Dm644 "$i" "$pkgdir/usr/share/icons/hicolor/${i%.png}/apps/ubports-installer.png"
+ done
+
+ cd "$srcdir/$pkgname-${pkgver/_/-}/dist/linux-unpacked/resources"
+ install -Dm644 app.asar "$pkgdir/usr/share/ubports-installer/app.asar"
}
diff --git a/rootless.patch b/rootless.patch
new file mode 100644
index 00000000000..9a17aa176e0
--- /dev/null
+++ b/rootless.patch
@@ -0,0 +1,21 @@
+diff -ura package.orig/src/utils.js package.new/src/utils.js
+--- package.orig/src/utils.js 2019-03-02 03:00:07.393462552 +0100
++++ package.new/src/utils.js 2019-03-02 02:59:53.770016930 +0100
+@@ -17,7 +17,6 @@
+ const tmp = require('tmp');
+ const exec = require('child_process').exec;
+ const cp = require('child_process');
+-const sudo = require('electron-sudo');
+ const winston = require('winston');
+ const getos = require('getos');
+ const commandExistsSync = require('command-exists').sync;
+@@ -387,8 +386,7 @@
+ }
+
+ var needRoot = () => {
+- if ((os.platform() === "win32") || isSnap()) return false;
+- return !process.env.SUDO_UID
++ return false
+ }
+
+ var ensureRoot = (m) => {
diff --git a/ubports-installer.desktop b/ubports-installer.desktop
new file mode 100644
index 00000000000..b5e2f7ce0a2
--- /dev/null
+++ b/ubports-installer.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Name=ubports-installer
+Comment=UBports Installer: The easy way to install Ubuntu Touch on UBports devices. A friendly cross-platform Installer for Ubuntu Touch. Just connect a supported device to your PC, follow the on-screen instructions and watch this awesome tool do all the rest.
+Exec=ubports-installer
+Terminal=false
+Type=Application
+Icon=ubports-installer
+Categories=Utility \ No newline at end of file
diff --git a/ubports-installer.install b/ubports-installer.install
deleted file mode 100644
index bc05d6a6c40..00000000000
--- a/ubports-installer.install
+++ /dev/null
@@ -1,7 +0,0 @@
-post_install() {
- ln -s /opt/ubports-installer/ubports-installer /usr/bin/ubports-installer
-}
-
-post_remove() {
- rm /usr/bin/ubports-installer
-}
diff --git a/ubports-installer.sh b/ubports-installer.sh
new file mode 100644
index 00000000000..2b5906b0fd3
--- /dev/null
+++ b/ubports-installer.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec electron /usr/share/ubports-installer/app.asar