summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f01cf5baa1807d16de8edf42ad23799598752692 (plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Maintainer: Claudia Pellegrino <aur ät cpellegrino.de>
# Contributor:
#
# PKGBUILD reference: https://wiki.archlinux.org/index.php/PKGBUILD

pkgname=bash-it-git
pkgver=master
pkgrel=1
pkgdesc='A community Bash framework'
arch=('any')
url='https://github.com/Bash-it/bash-it'
license=('custom:undecided')
depends=('bash' 'curl' 'p7zip')
optdepends=(
  'ruby: ruby integration'
  'rbenv: rbenv integration'
)
conflicts=('bash-it')
install="${pkgname}.install"
source=(
  'https://github.com/Bash-it/bash-it/tarball/master'
  'LICENSE'
)
sha512sums=(
  'SKIP'
  'SKIP'
)
noextract=("${pkgname}.tar.gz")

prepare() {
  tar -x \
    -f "${srcdir}/${pkgname}.tar.gz" -z \
    --no-anchored --wildcards -C "${srcdir}" \
    --exclude='test' \
    --strip-components=1 \
    '.editorconfig' 'aliases' 'completion' 'custom' \
    'lib' 'plugins' 'template' 'themes' \
    'CONTRIBUTING.md' 'README.md' '*.sh'
}

package() {
  mkdir -p "${pkgdir}/usr/lib/${pkgname}"
  mkdir -p "${pkgdir}/usr/share/${pkgname}"
  mkdir -p "${pkgdir}/usr/share/doc/${pkgname}"
  mkdir -p "${pkgdir}/usr/share/licenses/${pkgname}"

  cp --preserve-mode -t \
    "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" \
    "${srcdir}/LICENSE"

  cp -r --preserve=mode -t "${pkgdir}/usr/lib/${pkgname}" \
    "${srcdir}"/{bash_it,install,uninstall}.sh \
    "${srcdir}"/{aliases,completion,custom,lib} \
    "${srcdir}"/{plugins,themes}

  cp -r --preserve=mode -t "${pkgdir}/usr/share/${pkgname}" \
    "${srcdir}"/template
  cp --preserve=mode -t "${pkgdir}/usr/share/doc/${pkgname}" \
    "${srcdir}"/*.md

  _templatedir="${pkgdir}/usr/share/${pkgname}/home_template/.bash_it"

  for _file_type in aliases completion plugins; do
    mkdir -p "${_templatedir}/${_file_type}/available"

    ln -fs \
      "${pkgdir}/usr/lib/${pkgname}/${_file_type}/available"/* \
      "${_templatedir}/${_file_type}/available/"
  done

  cp --preserve=mode -t "${_templatedir}" \
    "${srcdir}/.editorconfig"

  mkdir -p "${_templatedir}"/{custom,lib,template,themes}

  ln -fs \
    "${pkgdir}/usr/lib/${pkgname}"/{bash_it,install,uninstall}.sh \
    "${pkgdir}/usr/share/doc/${pkgname}"/* \
    "${_templatedir}/"

  for _customizable_dir in custom lib themes; do
    ln -fs \
      "${pkgdir}/usr/lib/${pkgname}/${_customizable_dir}"/* \
      "${_templatedir}/${_customizable_dir}/"
  done

  ln -fs \
    "${pkgdir}/usr/share/${pkgname}/template"/* \
    "${_templatedir}/template/"

  cp -r --preserve=mode -t ~/ "${_templatedir}"
}