~mil/f_scripts

ref: 74b5b03866c16eceb9cbac37a8c9f82d2f4b6404 f_scripts/genscripts/gen_alpinepackage.sh -rwxr-xr-x 1.3 KiB
74b5b038Miles Alan f_maps: populate fbp strings based on mepo_ui_central_menu.sh menuoptions kbs 8 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>
# Contributor: Miles Alan <m@milesalan.com>
pkgname=f_scripts
pkgver='$(git tag | tail -n1)'
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::http://git.sr.ht/~mil/f_scripts/archive/$pkgver.tar.gz"
options="!check" # Has no tests
subpackages="' | grep .
  for FILE in ../scripts/f_*; do
    echo "	\$pkgname-$(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'"
	install -Dm755 "$builddir"/scripts/'$SCRIPTNAME' "$subpkgdir/usr/bin/'$SCRIPTNAME'"
}
'
  done
}

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

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