~mil/f_scripts

ref: 0.3 f_scripts/genscripts/gen_alpinepackage.sh -rwxr-xr-x 1.2 KiB
f29da769Miles Alan f_audio, f_youtube: Set dac to 100%, fixed muted sound by default 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env osh
# This is basically a script that generate an APKBUILD for 
# f_scripts with each subpackage. So this is a metaprogramming script
# that generates another script..

header() {
  echo '
# Maintainer: Miles Alan <m@milesalan.com>
pkgname=f_scripts
pkgver=0.1
pkgrel=0
pkgdesc="Framebufferphone prompt-driven scripts which are compatible with fbp"
url="http://git.sr.ht/~mil/f_scripts"
arch="noarch"
license="GPL-3.0-or-later"
depends="oil"
source="$pkgname-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz"
options="!check" # Has no tests
subpackages="' | grep .
  for FILE in ../scripts/f_*; do
    echo "	f_scripts-$(basename $FILE)" 
  done
  echo '"'
}

packagefn() {
  echo '
package() {
	mkdir -p "$pkgdir/usr/bin"
}
'
}

gen() {
  for FILE in ../scripts/f_*; do
    unset DEP DEC
    . "$FILE" nonexistentfn 2>/dev/null
    SCRIPTNAME="$(basename "$FILE")"

    echo ''${SCRIPTNAME}'() {
	pkgdesc="$pkgname - '$SCRIPTNAME' script, '$DEC'"
	depends="$depends '$DEP'"
	mkdir -p "$subpkgdir/usr/bin/"
	install -Dm755 "$builddir"/scripts/'$SCRIPTNAME' "$subpkgdir/usr/bin/"
}
'
  done
}

main() {
  cd "$(dirname $(realpath $0))"
  header 
  packagefn
  gen
}

if [ -n "$1" ]; then "$@"; else main; fi