summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorPumpkinCheshire2021-04-24 19:42:21 +0800
committerPumpkinCheshire2021-04-24 19:42:21 +0800
commit7921caaeaf23a9d61782833d4d44ed253417ad49 (patch)
tree9077813d3fc1fc769a278c024ba8c3ce3d8a21a0
parentf2605d800fab4b8f7f0180f6fdb7f1ca5f9317ab (diff)
downloadaur-7921caaeaf23a9d61782833d4d44ed253417ad49.tar.gz
rewrite the sh
-rw-r--r--.gitignore1
-rw-r--r--PKGBUILD23
-rwxr-xr-xwaifu2x-ncnn-vulkan31
3 files changed, 43 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index 018a3de0814..a5d486e1433 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
!PKGBUILD
!.SRCINFO
!.gitignore
+!waifu2x-ncnn-vulkan
diff --git a/PKGBUILD b/PKGBUILD
index c11facb08e9..998aa793924 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,9 +1,8 @@
# Maintainer: PumpkinCheshire <sollyonzou@gmail.com>
-_name=waifu2x-ncnn-vulkan
pkgname=waifu2x-ncnn-vulkan-bin
pkgver=20210210
-pkgrel=1
+pkgrel=2
pkgdesc="waifu2x converter ncnn version, runs fast on intel / amd / nvidia GPU with vulkan"
arch=('x86_64')
url="https://github.com/nihui/waifu2x-ncnn-vulkan"
@@ -12,21 +11,21 @@ depends=("vulkan-icd-loader" "vulkan-headers")
makedepends=()
provides=("waifu2x-ncnn-vulkan")
conflicts=("waifu2x-ncnn-vulkan" "waifu2x-ncnn-vulkan-git")
-source=("https://github.com/nihui/$_name/releases/download/$pkgver/$_name-$pkgver-ubuntu.zip")
-sha256sums=('ce0296c4788474bd5acd997169016ade32f02f49ce622a7a145dedd529d3e721')
+source=("https://github.com/nihui/${pkgname%-bin}/releases/download/$pkgver/${pkgname%-bin}-$pkgver-ubuntu.zip"
+ "waifu2x-ncnn-vulkan")
+sha256sums=('ce0296c4788474bd5acd997169016ade32f02f49ce622a7a145dedd529d3e721'
+ 'ef1588b9a32583a5adab7279d0d89729105743675c1525c8cb251d1496ae1d4f')
package() {
- cd "${srcdir}/$_name-$pkgver-ubuntu"
+ install -Dm755 ${pkgname%-bin} "${pkgdir}/usr/bin/${pkgname%-bin}"
+
+ cd "${srcdir}/${pkgname%-bin}-$pkgver-ubuntu"
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
- install -Dm755 "${srcdir}/$_name-$pkgver-ubuntu/$_name" "${pkgdir}/usr/share/$_name/$_name"
+ install -Dm755 "${srcdir}/${pkgname%-bin}-$pkgver-ubuntu/${pkgname%-bin}" "${pkgdir}/usr/share/${pkgname%-bin}/${pkgname%-bin}"
- cd "${srcdir}/$_name-$pkgver-ubuntu/"
+ cd "${srcdir}/${pkgname%-bin}-$pkgver-ubuntu/"
for f in models-*/*; do
- install -Dm 644 "$f" ${pkgdir}/usr/share/$_name/"$f"
+ install -Dm 644 "$f" ${pkgdir}/usr/share/${pkgname%-bin}/"$f"
done
-
- printf '#!/bin/sh\n/usr/share/waifu2x-ncnn-vulkan/waifu2x-ncnn-vulkan "$@"' >$_name
- install -Dm755 $_name "${pkgdir}/usr/bin/$_name"
-
}
diff --git a/waifu2x-ncnn-vulkan b/waifu2x-ncnn-vulkan
new file mode 100755
index 00000000000..54c37f6f4e6
--- /dev/null
+++ b/waifu2x-ncnn-vulkan
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+default_model_path="/usr/share/waifu2x-ncnn-vulkan/"
+readonly default_model_path
+
+args=""
+
+while getopts "hvi:o:n:s:t:m:g:j:xf:" arg; do
+ case $arg in
+ h) args="$args -$arg" ;;
+ v) args="$args -$arg" ;;
+ i) args="$args -$arg $OPTARG" ;;
+ o) args="$args -$arg $OPTARG" ;;
+ n) args="$args -$arg $OPTARG" ;;
+ s) args="$args -$arg $OPTARG" ;;
+ t) args="$args -$arg $OPTARG" ;;
+ m)
+ if ! [ -d $OPTARG ]; then
+ args="$args -m $default_model_path$OPTARG"
+ else
+ args="$args -$arg $OPTARG"
+ fi
+ ;;
+ g) args="$args -$arg $OPTARG" ;;
+ j) args="$args -$arg $OPTARG" ;;
+ x) args="$args -$arg" ;;
+ f) args="$args -$arg $OPTARG" ;;
+ esac
+done
+
+/usr/share/waifu2x-ncnn-vulkan/waifu2x-ncnn-vulkan $args